Skip to contentSkip to conversation

drm/amd/amdgpu: decrease ttm bo priority to fix performance drop when VRAM pressure

PATCH In review Roger.He 3 participants 3 messages Mar 27, 2017 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

Roger.He

author
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: decrease ttm bo priority to fix performance drop when VRAM pressure

1. When VRAM pressue and trigger huge evictions there is performance drop, this patch fix it.
2. Also reserve priority for KFD using

Change-Id Idcd2db65be69d62bcbd7dfaa3bcf9bc964d6d122
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +---
 include/drm/ttm/ttm_bo_driver.h            | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -3
index 434c931..d6b2de9 100644
@@ -405,10 +405,8 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
 	if (unlikely(r != 0))
 		return r;
 
-	bo->tbo.priority = ilog2(bo->tbo.num_pages);
 	if (kernel)
-		bo->tbo.priority *= 2;
-	bo->tbo.priority = min(bo->tbo.priority, TTM_MAX_BO_PRIORITY - 1);
+		bo->tbo.priority = 1;
 
 	if (flags & AMDGPU_GEM_CREATE_VRAM_CLEARED &&
 	    bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) {
include/drm/ttm/ttm_bo_driver.h +1 -1
index c3d74be..7777d14 100644
@@ -42,7 +42,7 @@
 #include <linux/spinlock.h>
 #include <linux/reservation.h>
 
-#define TTM_MAX_BO_PRIORITY	16U
+#define TTM_MAX_BO_PRIORITY	4U
 
 struct ttm_backend_func {
 	/**
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): 1490616311-32137-1-git-send-email-Hongbo.He-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

Am 27.03.2017 um 14:05 schrieb Roger.He:

Quoted 6 lines

1. When VRAM pressue and trigger huge evictions there is performance drop, this patch fix it.
2. Also reserve priority for KFD using

Change-Id Idcd2db65be69d62bcbd7dfaa3bcf9bc964d6d122
Quoted 26 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +---
  include/drm/ttm/ttm_bo_driver.h            | 2 +-
  2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -3
index 434c931..d6b2de9 100644
@@ -405,10 +405,8 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
  	if (unlikely(r != 0))
  		return r;
 
-	bo->tbo.priority = ilog2(bo->tbo.num_pages);
  	if (kernel)
-		bo->tbo.priority *= 2;
-	bo->tbo.priority = min(bo->tbo.priority, TTM_MAX_BO_PRIORITY - 1);
+		bo->tbo.priority = 1;
 
  	if (flags & AMDGPU_GEM_CREATE_VRAM_CLEARED &&
  	    bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) {
include/drm/ttm/ttm_bo_driver.h +0 -0
index c3d74be..7777d14 100644

include/drm/ttm/ttm_bo_driver.h line 48

Quoted 8 lines
include/drm/ttm/ttm_bo_driver.h +1 -1
@@ -42,7 +42,7 @@
  #include <linux/spinlock.h>
  #include <linux/reservation.h>
 
-#define TTM_MAX_BO_PRIORITY	16U
+#define TTM_MAX_BO_PRIORITY	4U
 
  struct ttm_backend_func {
  	/**

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to a message not in the archive
Quoted 32 lines · Roger.He

1. When VRAM pressue and trigger huge evictions there is performance drop, this patch fix it.
2. Also reserve priority for KFD using

Change-Id Idcd2db65be69d62bcbd7dfaa3bcf9bc964d6d122
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +---
 include/drm/ttm/ttm_bo_driver.h            | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -3
index 434c931..d6b2de9 100644
@@ -405,10 +405,8 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
        if (unlikely(r != 0))
                return r;
 
-       bo->tbo.priority = ilog2(bo->tbo.num_pages);
        if (kernel)
-               bo->tbo.priority *= 2;
-       bo->tbo.priority = min(bo->tbo.priority, TTM_MAX_BO_PRIORITY - 1);
+               bo->tbo.priority = 1;
 
        if (flags & AMDGPU_GEM_CREATE_VRAM_CLEARED &&
            bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) {
include/drm/ttm/ttm_bo_driver.h +0 -0
index c3d74be..7777d14 100644

include/drm/ttm/ttm_bo_driver.h line 45

Quoted 5 lines
include/drm/ttm/ttm_bo_driver.h +1 -1
@@ -42,7 +42,7 @@
 #include <linux/spinlock.h>
 #include <linux/reservation.h>
 
-#define TTM_MAX_BO_PRIORITY    16U
+#define TTM_MAX_BO_PRIORITY    4U

I'd suggest splitting this out as a separate patch.

Alex

Quoted 10 lines
include/drm/ttm/ttm_bo_driver.h +0 -1
 struct ttm_backend_func {
        /**
--

2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx