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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
  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.
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux