diff mbox

[5/5] drm/ttm: keep original behavior except bo device with flag no_retry

Message ID 1517556145-23505-5-git-send-email-Hongbo.He@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

He, Hongbo Feb. 2, 2018, 7:22 a.m. UTC
Signed-off-by: Roger He <Hongbo.He@amd.com>
---
 drivers/gpu/drm/ttm/ttm_memory.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index 875e5b8..25e1ce0 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -503,8 +503,11 @@  static int ttm_mem_global_reserve(struct ttm_mem_global *glob,
 		limit = (capable(CAP_SYS_ADMIN)) ?
 			zone->emer_mem : zone->max_mem;
 
-		total_used_mem = zone->used_mem + swap_glob_mem;
-		limit += glob->max_swap_mem;
+		total_used_mem = zone->used_mem;
+		if (glob->bdev && glob->bdev->no_retry) {
+			total_used_mem += swap_glob_mem;
+			limit += glob->max_swap_mem;
+		}
 		if (total_used_mem > limit)
 			goto out_unlock;
 	}