drm/amd/amdgpu: not allow gtt size exceed 75%*system memory size
Subsystems (2)
PATCH 1/1 drm/amd/amdgpu: not allow gtt size exceed 75%*system memory size
keep consistency with threshold of swapout
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +8 -3
@@ -1330,9 +1330,14 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)DRM_INFO ("amdgpu: %uM of VRAM memory ready\n" , (unsigned ) (adev->mc.real_vram_size / (1024 *1024 ))); -if (amdgpu_gtt_size ==-1 ) - gtt_size =max ((AMDGPU_DEFAULT_GTT_SIZE_MB <<20 ), - adev->mc.mc_vram_size); +if (amdgpu_gtt_size ==-1 ) { +struct sysinfo si; + +si_meminfo (&si); + gtt_size =min (max ((AMDGPU_DEFAULT_GTT_SIZE_MB <<20 ), + adev->mc.mc_vram_size), + ((uint64_t )si.totalram * si.mem_unit *3 /4 )); + }else gtt_size = (uint64_t )amdgpu_gtt_size <<20 ; r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_TT , gtt_size >>PAGE_SHIFT );
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1510557395-3934-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org
Am 13.11.2017 um 08:16 schrieb Roger He:
Quoted 4 lines
keep consistency with threshold of swapout
Change-Id I5b14d18ed7a9f79810cc50c023ac9e240bddf101Signed-off-by Roger He <[email protected]>
I still think multiple lines would be easier to read, but if you prefer it like this I'm fine with it as well.
Patch is Reviewed-by: Christian König <[email protected]>
Regards,
Christian.
Quoted 16 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +1
-3@@ -1330,9 +1330,14 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)DRM_INFO ("amdgpu: %uM of VRAM memory ready\n" , (unsigned ) (adev->mc.real_vram_size / (1024 *1024 ))); -if (amdgpu_gtt_size ==-1 ) - gtt_size =max ((AMDGPU_DEFAULT_GTT_SIZE_MB <<20 ), - adev->mc.mc_vram_size); +if (amdgpu_gtt_size ==-1 ) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c int amdgpu_ttm_init(struct amdgpu_device *adev) · line 1343
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +7
-0+struct sysinfo si; + +si_meminfo (&si); + gtt_size =min (max ((AMDGPU_DEFAULT_GTT_SIZE_MB <<20 ), + adev->mc.mc_vram_size), + ((uint64_t )si.totalram * si.mem_unit *3 /4 )); + }else gtt_size = (uint64_t )amdgpu_gtt_size <<20 ; r =ttm_bo_init_mm (&adev->mman.bdev,TTM_PL_TT , gtt_size >>PAGE_SHIFT );
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx