ttm_bo_swapout(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 β€” the ttm_operation_ctx that 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

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