mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/xe: count UMA shrinkable BOs as reclaimable without swap
@ 2026-06-26 11:26 aquiles
  2026-06-26 11:26 ` [PATCH 2/2] drm/xe: skip resv fence wait in xe_svm_invalidate if no ranges are bound aquiles
  0 siblings, 1 reply; 2+ messages in thread
From: aquiles @ 2026-06-26 11:26 UTC (permalink / raw)
  To: matthew.brost, thomas.hellstrom, rodrigo.vivi
  Cc: airlied, simona, intel-xe, dri-devel, linux-kernel, aquiles

On integrated (UMA) devices all GPU buffer objects reside in system RAM.
xe_shrinker_count() previously gated shrinkable (non-purgeable) page
counts on ttm_backup_bytes_avail(), so those pages were invisible to
the kernel's memory reclaim on systems without swap configured.

On UMA, shrinkable system-memory BOs can be reclaimed independently of
swap availability. Report them unconditionally so the shrinker can
always request their eviction under memory pressure.

Signed-off-by: aquiles <achillezongo07@gmail.com>
---
 drivers/gpu/drm/xe/xe_shrinker.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_shrinker.c b/drivers/gpu/drm/xe/xe_shrinker.c
index 83374cd57..3ca2de342 100644
--- a/drivers/gpu/drm/xe/xe_shrinker.c
+++ b/drivers/gpu/drm/xe/xe_shrinker.c
@@ -140,16 +140,22 @@ xe_shrinker_count(struct shrinker *shrink, struct shrink_control *sc)
 {
 	struct xe_shrinker *shrinker = to_xe_shrinker(shrink);
 	unsigned long num_pages;
+	long uma_reclaimable_pages;
 	bool can_backup = !!(sc->gfp_mask & __GFP_FS);
+	bool is_uma = !IS_DGFX(shrinker->xe);
 
 	num_pages = ttm_backup_bytes_avail() >> PAGE_SHIFT;
 	read_lock(&shrinker->lock);
 
+	uma_reclaimable_pages = is_uma ? shrinker->shrinkable_pages : 0;
+
 	if (can_backup)
-		num_pages = min_t(unsigned long, num_pages, shrinker->shrinkable_pages);
+		num_pages = min_t(unsigned long, num_pages,
+				  shrinker->shrinkable_pages - uma_reclaimable_pages);
 	else
 		num_pages = 0;
 
+	num_pages += uma_reclaimable_pages;
 	num_pages += shrinker->purgeable_pages;
 	read_unlock(&shrinker->lock);
 
-- 
2.54.0


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

end of thread, other threads:[~2026-06-26 11:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-26 11:26 [PATCH 1/2] drm/xe: count UMA shrinkable BOs as reclaimable without swap aquiles
2026-06-26 11:26 ` [PATCH 2/2] drm/xe: skip resv fence wait in xe_svm_invalidate if no ranges are bound aquiles

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®