folio_free_swap(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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:

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