Skip to content

Commit 85d4652

Browse files
mbrost05gregkh
authored andcommitted
drm/xe: Adjust page count tracepoints in shrinker
commit ca9e511 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 569ed6a commit 85d4652

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
@@ -1008,6 +1008,7 @@ static long xe_bo_shrink_purge(struct ttm_operation_ctx *ctx,
10081008
unsigned long *scanned)
10091009
{
10101010
struct xe_device *xe = ttm_to_xe_device(bo->bdev);
1011+
struct ttm_tt *tt = bo->ttm;
10111012
long lret;
10121013

10131014
/* Fake move to system, without copying data. */
@@ -1032,8 +1033,10 @@ static long xe_bo_shrink_purge(struct ttm_operation_ctx *ctx,
10321033
.writeback = false,
10331034
.allow_move = false});
10341035

1035-
if (lret > 0)
1036+
if (lret > 0) {
10361037
xe_ttm_tt_account_subtract(xe, bo->ttm);
1038+
update_global_total_pages(bo->bdev, -(long)tt->num_pages);
1039+
}
10371040

10381041
return lret;
10391042
}
@@ -1119,8 +1122,10 @@ long xe_bo_shrink(struct ttm_operation_ctx *ctx, struct ttm_buffer_object *bo,
11191122
if (needs_rpm)
11201123
xe_pm_runtime_put(xe);
11211124

1122-
if (lret > 0)
1125+
if (lret > 0) {
11231126
xe_ttm_tt_account_subtract(xe, tt);
1127+
update_global_total_pages(bo->bdev, -(long)tt->num_pages);
1128+
}
11241129

11251130
out_unref:
11261131
xe_bo_put(xe_bo);

0 commit comments

Comments
 (0)