All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/xe/bo: optimise TT population for DONTNEED BOs
@ 2026-07-23 13:34 Matthew Auld
  2026-07-23 13:39 ` Maarten Lankhorst
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Matthew Auld @ 2026-07-23 13:34 UTC (permalink / raw)
  To: intel-xe; +Cc: Thomas Hellström, Matthew Brost

When a VRAM buffer object is marked as DONTNEED, like in Mesa, the
driver skips migrating its contents to system memory and instead purges
the backing store during eviction (via xe_ttm_bo_purge).

However, xe_evict_flags() still returns tt_placement (XE_PL_TT) for VRAM
BOs even if they were marked DONTNEED.  This causes
ttm_bo_handle_move_mem() to call always call ttm_bo_populate() to
allocate destination system pages, only for those pages to be
immediately freed right after when xe_bo_move() calls xe_ttm_bo_purge().

Fix this by changing xe_evict_flags() to return sys_placement
(XE_PL_SYSTEM) for DONTNEED BOs.  This causes TTM to skip the population
step while still ensuring that TTM calls xe_bo_move(), so
xe_ttm_bo_purge() still triggers.

Assisted-by: Copilot:gemini-3.1-pro-preview
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
---
 drivers/gpu/drm/xe/xe_bo.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
index c266fa6bade1..1daa80079608 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -341,6 +341,11 @@ static void xe_evict_flags(struct ttm_buffer_object *tbo,
 		return;
 	}
 
+	if (xe_bo_madv_is_dontneed(bo)) {
+		*placement = sys_placement;
+		return;
+	}
+
 	/*
 	 * For xe, sg bos that are evicted to system just triggers a
 	 * rebind of the sg list upon subsequent validation to XE_PL_TT.
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-07-23 16:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23 13:34 [PATCH] drm/xe/bo: optimise TT population for DONTNEED BOs Matthew Auld
2026-07-23 13:39 ` Maarten Lankhorst
2026-07-23 13:42 ` ✓ CI.KUnit: success for " Patchwork
2026-07-23 14:17 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-23 16:00 ` [PATCH] " Thomas Hellström

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.