xe_bo_shrink(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the struct ttm_operation_ctx that 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 the struct ttm_tt is embedded in a struct 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:


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