__swap_cache_del_folio(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 __swap_cache_del_folio β€” Kernel API Manual, section 9 🌸

okay so bestie, welcome to the group chat for __swap_cache_del_folio(9) πŸ’… this one lives in the Kernel API Manual, section 9, and she is very specific about the vibes she needs from you before she'll do her thing. let's get into it 🫢


✨ NAME ✨

__swap_cache_del_folio β€” literally just removes a folio from the swap cache. that's the whole personality. iconic, honestly πŸ’–


✨ SYNOPSIS ✨

void __swap_cache_del_folio (struct swap_cluster_info *ci , struct folio
*folio , swp_entry_t entry , void *shadow );

no cap, that's the exact signature, don't come for me about the spacing 😭


✨ ARGUMENTS ✨

four besties walk into the function:

  • ci β€” the locked swap cluster. she's the one holding the entries, and yes, she needs to be locked, we'll get to that πŸŽ€
  • folio β€” the folio. the main character. the whole reason we're here πŸ‘‘
  • entry β€” the first swap entry that the folio corresponds to. like, the folio's origin story ✨
  • shadow β€” the shadow value that gets filled in the swap cache. it's giving filling-in-the-blank πŸ¦‹

✨ DESCRIPTION ✨

so what does she actually do? she removes a folio from the swap cache and fills a shadow in place β€” like, right there, no detour, no extra stop 🌈

⚠️ but here's the thing, bestie: this won't put the folio's refcount. nope. not her job. the caller has to do that. so don't just walk away thinking it's handled, because it is not πŸ’€

✨ CONTEXT ✨

the pre-flight checklist, and please actually do it or things get weird 😭

caller must ensure:

  • the folio is locked and in the swap cache using the index of entry πŸ”₯
  • the cluster that holds the entries is locked πŸ”

that's the vibe check. pass it before you call her πŸ’œ


✨ SEE ALSO ✨

sibling functions and the gang, all linked up 🧚:

kernel file ./mm/swap_state.c β€” and the whole friend group:


and that's the page!! πŸ“ she ships out of ./mm, dated October 2026, in section 9 of the Kernel API Manual β€” mwah, slay, periodt πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from