ttm_bo_swapout(9)
π ttm_bo_swapout(9) β like, the whole page, bestie
okay so real talk: this is a page from the Kernel API Manual (yes, the kernel has a manual, she's iconic) and today's main character is ttm_bo_swapout. grab a strawberry drink π and let's get into it.
β¨ NAME β¨
ttm_bo_swapout β swaps out buffer objects chilling on the LRU list, over to shmem. that's the whole vibe. no cap. π¦
πΈ SYNOPSIS πΈ
s64 ttm_bo_swapout (struct ttm_device *bdev , struct ttm_operation_ctx
*ctx , struct ttm_resource_manager *man , gfp_t gfp_flags , s64 target
);
she returns an s64, she takes five args, she's booked and busy π
π ARGUMENTS π
okay so the five besties she needs:
bdevβ the ttm device. like, THE device. the one and only πctxβ thettm_operation_ctxthat governs the whole swapout operation. she's in charge, respectfully π«Άmanβ the resource manager whose resources / buffer objects are goint to be swapped out. yes, that's a typo up in the original and we're keeping it, it's canon now πgfp_flagsβ the gfp flags used for shmem page allocations. allocation mood ring, basically πtargetβ the desired number of pages to swap out. desired!! as in a wish, a dream, a goal β¨
π₯ RETURN π₯
she gives you back the number of pages actually swapped out β key word actually, the dream and the reality are not always the same β or a negative error code on error. so if it's negative, something went off, bestie π
π§ SEE ALSO π§
literally the whole friend group. kernel file: ./drivers/gpu/drm/ttm/ttm_bo.c
ttm_bo_move_to_lru_tail(9)ttm_bo_set_bulk_move(9)ttm_bo_eviction_valuable(9)ttm_bo_evict_first(9)ttm_bo_alloc_at_place(9)struct ttm_bo_evict_walk(9)ttm_bo_evict_cgroup(9)ttm_bo_pin(9)ttm_bo_unpin(9)ttm_bo_alloc_resource(9)ttm_bo_validate(9)ttm_bo_init_reserved(9)ttm_bo_init_validate(9)ttm_bo_unmap_virtual(9)ttm_bo_wait_ctx(9)struct ttm_bo_swapout_walk(9)ttm_bo_populate(9)
ngl go read ttm_bo_evict_first(9) right after this one, they're giving sibling energy π
and that's the page!! mwah π this one came straight out of ./drivers/gpu/drm/ttm, dated October 2026 β so yeah, future knowledge, we stay ahead of the timeline β periodt.
π¦ 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