ttm_bo_shrink(9)
π 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β thestruct ttm_operation_ctxthat 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:
ttm_move_memcpy(9)ttm_bo_move_memcpy(9)ttm_buffer_object_transfer(9)ttm_io_prot(9)ttm_bo_kmap_try_from_panic(9)ttm_bo_kmap(9)ttm_bo_kunmap(9)ttm_bo_vmap(9)ttm_bo_vunmap(9)ttm_bo_move_accel_cleanup(9)ttm_bo_move_sync_cleanup(9)ttm_bo_pipeline_gutting(9)ttm_lru_walk_for_evict(9)ttm_bo_lru_cursor_fini(9)ttm_bo_lru_cursor_init(9)ttm_bo_lru_cursor_next(9)ttm_bo_lru_cursor_first(9)ttm_bo_shrink_suitable(9)ttm_bo_shrink_avoid_wait(9)
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
- 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