[PATCH v6 0/8] drm/xe: Prioritize BO eviction based on VM exec queue priority
Matthew Brost <[email protected]> Thu, 30 Jul 2026 19:24:31 -0700
| Newsgroups | org.freedesktop.lists.intel-xe |
|---|---|
| Message-ID | <[email protected]> |
This series ties a BO's TTM LRU priority (i.e. how likely it is to be
picked for eviction/shrinking under memory pressure) to how userspace
is actually using the VM and BOs it belongs to, instead of treating
every BO the same.
The reasoning behind the heuristic:
- Kernel BOs, and any BO not private to a single VM (no vm_id, e.g.
shared/exported buffers), are given the highest priority so they
are the least likely to be evicted -- these are foundational or
shared resources.
- BOs private to a VM are then prioritized based on the highest
priority band userspace has assigned to any exec queue attached to
that VM: a VM with a HIGH priority exec queue keeps its BOs at the
highest priority (matching kernel/shared BOs), a VM with only
NORMAL priority queues (or none yet) gets the next priority band
down, and a VM with only LOW priority queues gets the band below
that.
- The lowest priority band is reserved exclusively for BOs (private
or shared) that have no VMA mappings left anywhere. This lets
userspace use an unbind as a signal of "drop this from my working
set, but keep the backing store around in case I need it again" --
the BO is retained, just made a preferred candidate for
eviction/shrinking until it is rebound.
v3:
- Rebase for CI
v4:
- Fix issues raised by Sashiko
v5:
- Fix more issues raised by Sashiko
v6:
- Move DONTNEED to lowest priorty + continue purge scan across entire band
- Create sub-bands favoring WB over WC/UC for shrinking
Matt
Matthew Brost (8):
drm/xe: Track exec queue priority band counts for user VMs
drm/xe: Re-prioritize VM's private BOs when adding an exec queue
drm/xe: Lower BO TTM priority to lowest when fully unmapped from VM
drm/xe: Fix up BO TTM priority for late VM binds
drm/xe: Adjust BO TTM priority on DONTNEED/WILLNEED madvise
transitions
drm/xe: Limit purge shrinker pass to the lowest TTM priority band
drm/ttm: Increase maximum TTM priorities to 8
drm/xe: Favor evicting WB-cached BOs within each priority band
drivers/gpu/drm/xe/xe_bo.c | 35 ++++-
drivers/gpu/drm/xe/xe_bo.h | 37 ++++-
drivers/gpu/drm/xe/xe_bo_types.h | 17 ++-
drivers/gpu/drm/xe/xe_dma_buf.c | 2 +-
drivers/gpu/drm/xe/xe_pagefault.c | 2 +
drivers/gpu/drm/xe/xe_shrinker.c | 15 ++
drivers/gpu/drm/xe/xe_vm.c | 246 ++++++++++++++++++++++++++++--
drivers/gpu/drm/xe/xe_vm.h | 4 +
drivers/gpu/drm/xe/xe_vm_types.h | 13 ++
include/drm/ttm/ttm_resource.h | 2 +-
10 files changed, 350 insertions(+), 23 deletions(-)
--
2.34.1