swap_put_entries_cluster(9)
π swap_put_entries_cluster β bestie's guide to dropping swap counts π
okay so this is a page from the Kernel API Manual, and we're talking about swap_put_entries_cluster(9) β the little helper that decreases the swap count of slots inside one cluster. she's giving cleanup crew, she's giving "let me handle that for you", and honestly? obsessed. β¨
πΈ NAME πΈ
swap_put_entries_cluster β decrease the swap count of slots within one cluster π
like literally, that's her whole job. one cluster, a bunch of slots, counts go down. periodt.
β¨ SYNOPSIS β¨
void swap_put_entries_cluster (struct swap_info_struct *si , pgoff_t
offset , int nr , bool reclaim_cache );
yeah she returns void, no cap β nothing comes back, she just does the thing and dips. π
π¦ ARGUMENTS π¦
siβ the swap device, aka the main character of this whole operation. this is thestruct swap_info_struct *she's working on. π«Άoffsetβ start offset of slots. like where the party begins,pgoff_tstyle. πnrβ number of slots. how many we're doing,int. the more the merrier, honestly.reclaim_cacheβ abool, and here's the tea: if it'strue, she also reclaims the swap cache when slots are freed. so it's not just the counts going down, it's the cache getting tidied too. double duty, iconic. π₯
π DESCRIPTION π
so basically β this helper decreases the swap count of a set of slots, and she tries to batch free them. like, not one at a time like some kind of peasant, but batched. efficiency queen. π
and also (as if that wasn't enough), she reclaims the swap cache if reclaim_cache is true. so yeah. she does the counts, she does the freeing, and if you asked nicely with that true, she does the cache reclaim too. it's giving full service. π
β CONTEXT β
hiii, important safety moment bestie π¨ β the specified slots must be pinned by an existing swap count or a swap cache reference. that's the whole vibe. because of that pinning, they won't be released until this helper returns. so like, no funny business, no slots disappearing mid-call. she returns, then things can let go. iykyk. π
π§ SEE ALSO π§
the kernel file ./mm/swapfile.c is where she lives, and here's her whole friend group β go say hi:
swap_dup_entries_cluster(9)folio_alloc_swap(9)folio_dup_swap(9)folio_put_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)
not a single one skipped, we respect the whole squad. π«Άπ
and that's the page!! π she's sourced from ./mm, dated October 2026, and yeah β this whole writeup is swap_put_entries_cluster(9) and nothing else. mwah. πβ¨
π¦ 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