swap_put_entries_direct(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, welcome to swap_put_entries_direct(9) β€” it's from the Kernel API Manual, and it's giving β€œrelease the reference, then reclaim if nobody's holding on” realness πŸ’…βœ¨

πŸŽ€ NAME πŸŽ€

swap_put_entries_direct is literally the β€œdrop a reference on this whole range of swap entries” girlie, and if no more references remain, she also tries to reclaim their cache. slay. πŸ’–

✨ SYNOPSIS ✨

void swap_put_entries_direct (swp_entry_t entry , int nr );

🌸 ARGUMENTS 🌸

  • entry β€” the first entry of the range. πŸŽ€
  • nr β€” the number of entries in the range. πŸ¦‹

πŸ’– DESCRIPTION πŸ’–

okay so here's the lore: it goes through each swap entry in the contiguous range and releases a reference. If any swap entries become free, it tries to reclaim their underlying folios β€” but only if those folios are present. πŸ‘‘

The offset range is defined by [entry.offset, entry.offset + nr), no cap. 🌈

πŸ¦‹ CONTEXT πŸ¦‹

bestie, caution moment: the caller must ensure there is no race condition on the reference owner β€” e.g., by locking the PTL of a PTE containing the entry being released. Don't skip the lock, iykyk. πŸ”’πŸ˜­

πŸ”₯ SEE ALSO πŸ”₯

Kernel file: ./mm/swapfile.c


that's the whole page, bestie β€” sourced from ./mm, dated October 2026, and filed under swap_put_entries_direct(9). mwah πŸ’‹πŸ«ΆπŸŒˆ

πŸ“¦ where this page comes from