folio_free_swap(9)
β¨ folio_free_swap(9) β¨
okay so this is a page from the Kernel API Manual, and bestie, we're about to learn how to give swap space back π like literally handing the bytes back to the universe. it's giving spring cleaning for your memory. let's GO π¦
πΈ NAME πΈ
folio_free_swap β frees the swap space that this folio was using, no cap π
π SYNOPSIS π
bool folio_free_swap (struct folio *folio );
that's the whole vibe check: you hand it a struct folio * and you get a bool back. simple, iconic, periodt β¨
π«Ά ARGUMENTS π«Ά
folioβ the folio we're removing. like, the actual star of the show π this is the one whose swap space is getting released.
π DESCRIPTION π
so here's the tea β if swap is getting full, or if there are literally no more mappings of this folio, then that's your cue to call folio_free_swap and free its swap space. main character energy: the folio is done, the mappings are gone (or the swap is bursting), and the swap space gets to go home π β¨
lowkey important: it's an either/or situation, bestie β swap getting full or no more mappings of the folio. both of those are valid reasons to call it π
π₯ RETURN π₯
it returns true if we were actually able to release the swap space π like, that's the good ending. that's the slay.
π SEE ALSO π
the whole friend group, fr fr β all living in the kernel file ./mm/swapfile.c:
swap_put_entries_cluster(9)swap_dup_entries_cluster(9)folio_alloc_swap(9)folio_dup_swap(9)folio_put_swap(9)swap_entry_swapped(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)
iykyk, go read them all, they're all connected π§π
and that's the page!! this lil beauty comes from ./mm and it's dated October 2026 β go forth and free those swap folios, bestie, you've got this πβπ
π¦ 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