folio_put_swap(9)
π
folio_put_swap β the kernel API manual, bestie edition π
okay so real talk: we're in the Kernel API Manual today and the main character is folio_put_swap(9). pull up a chair, this one's short but she's important β¨
πΈ NAME πΈ
folio_put_swap β decreases the swap count of swap entries of a folio. that's it, that's the vibe. lowkey does exactly what it says on the tin π
β¨ SYNOPSIS β¨
void folio_put_swap (struct folio *folio , struct page *page );
no return value, she just does the thing and dips π«Ά
π¦ ARGUMENTS π¦
folioβ the folio with swap entries bounded. and like, pay attention here: it must be in the swap cache and locked. no exceptions, bestie, it's giving non-negotiable πpageβ if it's notNULL, then you're only decreasing the swap count of this page. if it isNULL, wellβ¦ you know what you signed up for π
π₯ DESCRIPTION π₯
so here's the tea: this function will not free the swap slots, even if the swap count drops all the way to zero. why? because they're still pinned by the swap cache, periodt. π
if you do want them freed, the user may call folio_free_swap to free them. that's the move. iykyk π§
π CONTEXT π
the caller must ensure the folio is locked and in the swap cache. fr fr, do not skip this one, it's literally the whole assignment π
π SEE ALSO π
the kernel file ./mm/swapfile.c and her whole friend group:
swap_put_entries_cluster(9)swap_dup_entries_cluster(9)folio_alloc_swap(9)folio_dup_swap(9)swap_entry_swapped(9)folio_free_swap(9)swap_put_entries_direct(9)swap_alloc_hibernation_slot(9)swap_free_hibernation_slot(9)pin_hibernation_swap_type(9)unpin_hibernation_swap_type(9)find_hibernation_swap_type(9)
β reminder bestie: locked + in the swap cache, or this whole thing is a no-go π
and that's the page!! mwah π this lil icon lives under ./mm and was dated October 2026 β go off, ./mm, we stan a whole directory. ππ¦π
π¦ 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