[PATCH] drm/amdgpu: only use kernel zone if need_dma32 is not required

Yang, Philip Philip.Yang at amd.com
Wed Jun 12 15:13:14 UTC 2019


TTM create two zones, kernel zone and dma32 zone for system memory. If
system memory address allocated is below 4GB, this account to dma32 zone
and will exhaust dma32 zone and trigger unnesssary TTM eviction.

Patch "drm/ttm: Account for kernel allocations in kernel zone only" only
handle the allocation for acc_size, the system memory page allocation is
through ttm_mem_global_alloc_page which still account to dma32 zone if
page is below 4GB.

Change-Id: I289b85d891b8f64a1422c42b1eab398098ab7ef7
Signed-off-by: Philip Yang <Philip.Yang at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 2778ff63d97d..79bb9dfe617b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1686,6 +1686,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 	}
 	adev->mman.initialized = true;
 
+	/* Only kernel zone (no dma32 zone) if device does not require dma32 */
+	if (!adev->need_dma32)
+		adev->mman.bdev.glob->mem_glob->num_zones = 1;
+
 	/* We opt to avoid OOM on system pages allocations */
 	adev->mman.bdev.no_retry = true;
 
-- 
2.17.1



More information about the amd-gfx mailing list