[PATCH] drm/amd/amdgpu: Bail out of BO node creation if not enough VRAM (v2)

Christian König ckoenig.leichtzumerken at gmail.com
Wed Jun 12 08:03:14 UTC 2019


Am 12.06.19 um 09:26 schrieb Michel Dänzer:
> On 2019-06-11 6:54 p.m., StDenis, Tom wrote:
>> (v2): Return 0 and set mem->mm_node to NULL.
>>
>> Signed-off-by: Tom St Denis <tom.stdenis at amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 18 +++++++++++++-----
>>   1 file changed, 13 insertions(+), 5 deletions(-)
>>
>> [...]
>>   
>> @@ -284,6 +284,14 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
>>   	if (!lpfn)
>>   		lpfn = man->size;
>>   
>> +	/* bail out quickly if there's likely not enough VRAM for this BO */
>> +	atomic64_add(mem->num_pages << PAGE_SHIFT, &mgr->usage);
>> +	if (atomic64_read(&mgr->usage) > adev->gmc.mc_vram_size) {
> Should probably use atomic64_add_return instead of atomic64_add +
> atomic64_read.
>
> Also, AFAICT this doesn't allow any VRAM overcommit, which seems a bit
> conservative?

This is the low level VRAM manager. Here we can't overcomit anyway and 
need to return early for TTM to evict things.

Christian.


More information about the amd-gfx mailing list