ttm_bo_shrink(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ttm_bo_shrink(9) β€” the Kernel API Manual, bestie edition πŸŽ€

okay so bestie, welcome to ttm_bo_shrink from the kernel API manual β€” yes it's a real function, yes it's in the kernel, and yes we're gonna get into it πŸ’–


✨ NAME ✨

ttm_bo_shrink β€” a lil helper that shrinks a ttm buffer object. that's the whole vibe, no cap πŸ¦‹


🌸 SYNOPSIS 🌸

long ttm_bo_shrink (struct ttm_operation_ctx *ctx , struct
ttm_buffer_object *bo , const struct ttm_bo_shrink_flags flags );

like literally just look at that signature, it's giving "i know exactly what i'm doing" πŸ‘‘


🫢 ARGUMENTS 🫢

  • ctx β€” the struct ttm_operation_ctx that the shrinking operation rides on. context queen πŸ’…
  • bo β€” the buffer object. the main character, honestly πŸŽ€
  • flags β€” flags that govern how the shrinking behaves. it's giving ground rules ✨

πŸ”₯ DESCRIPTION πŸ”₯

so here's the tea πŸ“: this function uses the ttm_tt_back_up functionality to back up or purge a struct ttm_tt. iconic behaviour, honestly.

and if the bo is not in system, it gets moved there first. like, it literally relocates before doing anything else. respect the process πŸ™ˆ


⭐ RETURN ⭐

it hands you back the number of pages shrunken or purged β€” and if things go sideways, a negative error code on failure. not me getting a negative error code 😭


πŸ¦‹ SEE ALSO πŸ¦‹

kernel file ./drivers/gpu/drm/ttm/ttm_bo_util.c, plus the whole friend group:


that's the whole page, bestie, you ate πŸ’œ and fr fr, this one lives at ./drivers/gpu/drm/ttm, dated October 2026, filed under ttm_bo_shrink(9) β€” slay πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from