Re: [PATCH] drm/amdgpu: correct vram mgr node size calculation

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

 



Thanks and understand.

Philip

On 2020-01-28 2:59 p.m., Christian König wrote:
Am 28.01.20 um 20:55 schrieb Philip Yang:
Use pages_per_node instead of mem->num_pages to alloc vram, this will
increase the chance to get vram node after vram fragments.

NAK, this is intentional to aid TLB with continuous allocations.

The fallback to using pages_per_node is directly below, so your patch should be completely superfluous.

Regards,
Christian.


Signed-off-by: Philip Yang <Philip.Yang@xxxxxxx>
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 11 +++--------
  1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 82a3299e53c0..67a454f4c37a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -369,7 +369,7 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
      spin_lock(&mgr->lock);
      for (i = 0; pages_left >= pages_per_node; ++i) {
-        unsigned long pages = rounddown_pow_of_two(pages_left);
+        unsigned long pages = rounddown_pow_of_two(pages_per_node);
          r = drm_mm_insert_node_in_range(mm, &nodes[i], pages,
                          pages_per_node, 0,
@@ -383,15 +383,11 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
          pages_left -= pages;
      }
-    for (; pages_left; ++i) {
-        unsigned long pages = min(pages_left, pages_per_node);
+    if (pages_left) {
          uint32_t alignment = mem->page_alignment;
-        if (pages == pages_per_node)
-            alignment = pages_per_node;
-
          r = drm_mm_insert_node_in_range(mm, &nodes[i],
-                        pages, alignment, 0,
+                        pages_left, alignment, 0,
                          place->fpfn, lpfn,
                          mode);
          if (unlikely(r))
@@ -399,7 +395,6 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
          vis_usage += amdgpu_vram_mgr_vis_size(adev, &nodes[i]);
          amdgpu_vram_mgr_virt_start(mem, &nodes[i]);
-        pages_left -= pages;
      }
      spin_unlock(&mgr->lock);

_______________________________________________
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