swap_put_entries_direct(9)
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
swap_put_entries_cluster(9)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_alloc_hibernation_slot(9)swap_free_hibernation_slot(9)pin_hibernation_swap_type(9)unpin_hibernation_swap_type(9)find_hibernation_swap_type(9)
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
- 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