Skip to content

Commit ca9e511

Browse files
mbrost05Thomas Hellström
authored andcommitted
drm/xe: Adjust page count tracepoints in shrinker
Page accounting can change via the shrinker without calling xe_ttm_tt_unpopulate(), which normally updates page count tracepoints through update_global_total_pages. Add a call to update_global_total_pages when the shrinker successfully shrinks a BO. v2: - Don't adjust global accounting when pinning (Stuart) Cc: stable@vger.kernel.org Fixes: ce3d39f ("drm/xe/bo: add GPU memory trace points") Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Stuart Summers <stuart.summers@intel.com> Link: https://patch.msgid.link/20260107205732.2267541-1-matthew.brost@intel.com (cherry picked from commit cc54eab) Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
1 parent 9dd1f5f commit ca9e511

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/gpu/drm/xe/xe_bo.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,7 @@ static long xe_bo_shrink_purge(struct ttm_operation_ctx *ctx,
10551055
unsigned long *scanned)
10561056
{
10571057
struct xe_device *xe = ttm_to_xe_device(bo->bdev);
1058+
struct ttm_tt *tt = bo->ttm;
10581059
long lret;
10591060

10601061
/* Fake move to system, without copying data. */
@@ -1079,8 +1080,10 @@ static long xe_bo_shrink_purge(struct ttm_operation_ctx *ctx,
10791080
.writeback = false,
10801081
.allow_move = false});
10811082

1082-
if (lret > 0)
1083+
if (lret > 0) {
10831084
xe_ttm_tt_account_subtract(xe, bo->ttm);
1085+
update_global_total_pages(bo->bdev, -(long)tt->num_pages);
1086+
}
10841087

10851088
return lret;
10861089
}
@@ -1166,8 +1169,10 @@ long xe_bo_shrink(struct ttm_operation_ctx *ctx, struct ttm_buffer_object *bo,
11661169
if (needs_rpm)
11671170
xe_pm_runtime_put(xe);
11681171

1169-
if (lret > 0)
1172+
if (lret > 0) {
11701173
xe_ttm_tt_account_subtract(xe, tt);
1174+
update_global_total_pages(bo->bdev, -(long)tt->num_pages);
1175+
}
11711176

11721177
out_unref:
11731178
xe_bo_put(xe_bo);

0 commit comments

Comments
 (0)