swap_cache_has_folio(9)
π swap_cache_has_folio(9) π
okay so real talk, this is a page from the Kernel API Manual and honestly? it's a little one but she's important. literally the vibe check for swap slots. let's get into it π«Ά
β¨ NAME β¨
swap_cache_has_folio β bestie, this one checks if a swap slot has cache. that's the whole job. no cap. π
πΈ SYNOPSIS πΈ
bool swap_cache_has_folio (swp_entry_t entry );
it returns a bool, she takes exactly one thing, and she is not complicated. iconic behavior honestly β¨
π ARGUMENTS π
entryβ a swap entry that's pointing at the slot you're curious about. that's it, that's the argument. she's just here to tell you which slot we're talking about π₯
π CONTEXT π
okay this part is the serious part, listen up:
the caller must make sure entry is valid, and must protect the swap device either with a reference count or with locks. like, that's on you, not on her. she's not doing the vibes-checking for you π
no like fr fr, don't skip this bit. validity + protection (refcount or locks) is the whole prerequisite. don't be that person π
π¦ SEE ALSO π¦
she does not exist in a vacuum, she's got a whole friend group:
- the kernel file
./mm/swap_state.cβ that's where she lives, that's her home π swap_cache_get_folio(9)swap_cache_get_shadow(9)__swap_cache_add_check(9)__swap_cache_add_folio(9)__swap_cache_del_folio(9)swap_cache_del_folio(9)__swap_cache_replace_folio(9)swap_cache_alloc_folio(9)swap_update_readahead(9)swapin_sync(9)swap_cluster_readahead(9)swap_vma_readahead(9)swapin_readahead(9)
like she literally ate and left crumbs, go read the whole squad π
and that's the page!! π
cute little sign-off moment: this whole thing comes from ./mm, dated October 2026, and yes she's filed under swap_cache_has_folio(9) for all your future reference needs πβ¨ mwah, go touch some folios π§
π¦ 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