xe_bo_shrink(9)
π xe_bo_shrink(9) β like, the Kernel API Manual, bestie π
okay so real talk, this is a page from the Kernel API Manual and it's about xe_bo_shrink β yes, the one that tries to shrink an xe bo. she's niche, she's powerful, she's giving memory-reclamation main character energy β¨ let's get into it.
πΈ NAME πΈ
xe_bo_shrink β literally just: try to shrink an xe bo. that's the whole vibe. no cap. π«Ά
β¨ SYNOPSIS β¨
long xe_bo_shrink (struct ttm_operation_ctx *ctx , struct
ttm_buffer_object *bo , const struct xe_bo_shrink_flags flags , unsigned
long *scanned );
look at her signature, so iconic, so many parameters π
π¦ ARGUMENTS π¦
ctxβ thestruct ttm_operation_ctxthat gets used for the shrinking. she's the context, she's the moment, she's the setup πboβ the TTM buffer object whose pages we wanna shrink. this is the target, the subject, the one being shrunk πflagsβ the flags that govern the shrink behaviour. they decide how it all goes down βscannedβ a pointer to a counter of the number of pages attempted to shrink. she's counting, she's keeping score π₯
π DESCRIPTION π
so what does she actually do? she tries to shrink β or purge β a bo, and if that works out, she unmaps dma. slay. β
β οΈ okay important caveat bestie: we need to be able to handle non xe bos too (the ghost bos π»), but only if thestruct ttm_ttis embedded in astruct xe_ttm_tt. no exceptions, that's the rule, iykyk.
when the function attempts to shrink the pages of a buffer object, the value pointed to by scanned gets updated. so yeah, she's mutating that counter, that's her whole thing π
π RETURN π
she returns either:
- the number of pages shrunken or purged π (the good ending)
- or a negative error code on failure π (the not-so-good ending)
π SEE ALSO π
the whole friend group shows up for this one, fr fr:
- Kernel file
./drivers/gpu/drm/xe/xe_bo.c xe_bo_has_single_placement(9)xe_bo_is_stolen_devmem(9)xe_bo_is_vm_bound(9)xe_bo_pin_account(9)xe_bo_unpin_account(9)xe_bo_is_visible_vram(9)xe_bo_move_notify(9)xe_bo_set_purgeable_shrinker(9)xe_bo_set_purgeable_state(9)xe_ttm_bo_purge(9)xe_bo_notifier_prepare_pinned(9)xe_bo_notifier_unprepare_pinned(9)xe_bo_evict_pinned(9)xe_bo_restore_pinned(9)xe_bo_read(9)xe_bo_alloc(9)xe_bo_free(9)xe_bo_init_locked(9)xe_bo_create_locked(9)xe_bo_create_user(9)xe_bo_create_pin_range_novm(9)xe_bo_create_pin_map_at_novm(9)xe_bo_create_pin_map(9)xe_bo_create_pin_map_novm(9)xe_managed_bo_reinit_in_vram(9)xe_bo_pin_external(9)xe_bo_pin(9)xe_bo_unpin_external(9)xe_bo_validate(9)xe_bo_decompress(9)xe_bo_lock(9)xe_bo_unlock(9)xe_bo_can_migrate(9)xe_bo_migrate(9)xe_bo_evict(9)xe_bo_needs_ccs_pages(9)__xe_bo_release_dummy(9)xe_bo_put_commit(9)xe_bo_dev_init(9)xe_bo_dev_fini(9)xe_bo_dumb_create(9)
and that's the page, bestie!! π§ this little icon came from ./drivers/gpu/drm/xe, dated October 2026, and she's filed under xe_bo_shrink(9) β go off, queen ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms