swap_put_entries_cluster(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 the struct swap_info_struct * she's working on. 🫢
  • offset β€” start offset of slots. like where the party begins, pgoff_t style. πŸ“
  • nr β€” number of slots. how many we're doing, int. the more the merrier, honestly.
  • reclaim_cache β€” a bool, and here's the tea: if it's true, 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:

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