On Tue, 2026-10-27 at 13:31 -0700, 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]>

Reviewed-by: Thomas Hellström <[email protected]>



> ---
>  drivers/gpu/drm/xe/xe_pagefault.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_pagefault.c
> b/drivers/gpu/drm/xe/xe_pagefault.c
> index 5247321c805e..7d363160103a 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,9 @@ 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)
> +                             ttm_bo_move_to_lru_tail(&bo->ttm);
>               }
>               xe_validation_ctx_fini(&ctx);
>       } while (err == -EAGAIN);

Reply via email to