drm/xe: Prioritize BO eviction based on VM exec queue priority
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v6 Latest8 patches 2 repliesIn review
- v54 patches 0 repliesSuperseded
- v44 patches 0 repliesSuperseded
Earlier versions · 3
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v3 | 4 patches | 0 replies | Superseded | |
| v2 | 4 patches | 0 replies | Superseded | |
| v1 | 2 patches | 2 replies | Superseded |
Changes in v6 from the cover letter
- Move DONTNEED to lowest priorty + continue purge scan across entire band
- Create sub-bands favoring WB over WC/UC for shrinking
Patches in v6 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/8 | drm/xe: Track exec queue priority band counts for user VMsdrivers/ drivers/ | +27 | 0 replies | |
| 2/8 | drm/xe: Re-prioritize VM's private BOs when adding an exec queuedrivers/ drivers/ drivers/ +3 more | +139 | 0 replies | |
| 3/8 | drm/xe: Lower BO TTM priority to lowest when fully unmapped from VMdrivers/ | +16 | 0 replies | |
| 4/8 | drm/xe: Fix up BO TTM priority for late VM bindsdrivers/ drivers/ drivers/ +1 more | +78 | 0 replies | |
| 5/8 | drm/xe: Adjust BO TTM priority on DONTNEED/WILLNEED madvise transitionsdrivers/ drivers/ drivers/ | +25 | 0 replies | |
| 6/8 | drm/xe: Limit purge shrinker pass to the lowest TTM priority banddrivers/ | +14 | 0 replies | |
| 7/8 | drm/ttm: Increase maximum TTM priorities to 8include/ | +1 | 0 replies | |
| 8/8 | drm/xe: Favor evicting WB-cached BOs within each priority banddrivers/ drivers/ drivers/ +2 more | +62 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v6 yet.
Cover letter [PATCH v6 0/8] drm/xe: Prioritize BO eviction based on VM exec queue priority
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(-)
Signature · 1 line
2.34.1