On Wed, Oct 28, 2026 at 09:59:26AM +0000, Matthew Auld wrote:
> On 27/10/2026 22:49, Matthew Brost wrote:
> > Servicing a page fault validates the VMA's backing store and binds it,
> > making the BO part of the VM's active working set, but unlike exec it
> > never moves anything on the TTM LRU. In fault mode, where a VM may run
> > for a long time without a single exec, the BOs the GPU actually touches
> > therefore drift towards the LRU head and are picked by eviction and by
> > the shrinker ahead of genuinely cold BOs.
> >
> > Bump the BO's LRU on a successful page fault.
> >
> > Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
> > Signed-off-by: Matthew Brost <[email protected]>
> > ---
> > drivers/gpu/drm/xe/xe_pagefault.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/xe/xe_pagefault.c
> > b/drivers/gpu/drm/xe/xe_pagefault.c
> > index 5247321c805e..6828f81df50e 100644
> > --- a/drivers/gpu/drm/xe/xe_pagefault.c
> > +++ b/drivers/gpu/drm/xe/xe_pagefault.c
> > @@ -201,6 +201,8 @@ static int xe_pagefault_handle_vma(struct xe_gt *gt,
> > struct xe_vma *vma,
> > xe_validation_ctx_init(&ctx, &vm->xe->val, &exec,
> > (struct xe_val_flags) {});
> > drm_exec_until_all_locked(&exec) {
> > + struct xe_bo *bo = xe_vma_bo(vma);
> > +
> > err = xe_pagefault_begin(&exec, vma, tile->mem.vram,
> > needs_vram == 1);
> > drm_exec_retry_on_contention(&exec);
> > @@ -221,6 +223,11 @@ static int xe_pagefault_handle_vma(struct xe_gt *gt,
> > struct xe_vma *vma,
> > xe_pagefault_set_error(pf,
> > XE_PAGEFAULT_ERROR_VMA_REBIND);
> > break;
> > }
> > +
> > + if (bo) {
> > + scoped_guard(spinlock, &vm->xe->ttm.lru_lock)
> > + ttm_bo_move_to_lru_tail(&bo->ttm);
>
> Would it be cleaner to just use ttm_bo_move_to_lru_tail_unlocked() without
> the scoped guard stuff?
>
Yes, that would be better. Will adjust.
Matt
> Reviewed-by: Matthew Auld <[email protected]>
>
> > + }
> > }
> > xe_validation_ctx_fini(&ctx);
> > } while (err == -EAGAIN);
>