VM_PAGE_HOLD(9)

πŸ’– VM_PAGE_HOLD β€” bestie edition πŸ’–

okay so this is from the Kernel Developer's Manual, section 9, and it's literally about telling a page "you're not going anywhere, girl." sit down, hydrate, let's go 🫢


✨ NAME ✨

vm_page_hold, vm_page_unhold β€” update a page's hold count πŸ’…


🌸 SYNOPSIS 🌸

#include <sys/param.h>
#include <vm/vm.h>
#include <vm/vm_page.h>

void
vm_page_hold(vm_page_t m);

void
vm_page_unhold(vm_page_t m);

like, that's the whole entrance. two functions. both void. both iconic. no cap.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so vm_page_hold() bumps the hold count on a page. what does that mean for the page's whole life? it means the page daemon is not allowed to free it. that's it. that's the protection. πŸ›‘οΈ

now here's the tea, bestie β€” vm_page_hold() is for very temporary wiring of a page only. while its hold count is greater than zero, that page will not be considered for paging or reallocation. so do not treat it like a long-term situationship.

also, huge note: while wired pages get yanked off whatever queue they're sitting on, vm_page_hold() does not touch where the page lives. if it was on a queue before you called, it's still on that queue after you called. no relocation, no glow-up, no nothing. πŸ“

so if you actually need a page held for a long stretch of time? that's vm_page_wire(9) territory. different function, different vibe, go read that one. πŸ‘‘

and vm_page_unhold()? that's the release. it reduces the hold count on the page. and once the hold count hits zero β€” heads up β€” it's totally possible the page daemon will free that page. so like, don't unhold and then act surprised. πŸ’€


πŸ‘€ SEE ALSO πŸ‘€


πŸ’œ AUTHORS πŸ’œ

This manual page was written by Chad David <davidc@acns.ab.ca>. thank you for your service king 🫑


and that's the whole page, fr fr. this one came from Debian, dated July 13, 2001, and it's page VM_PAGE_HOLD(9) from the Kernel Developer's Manual. mwah, go hold a page responsibly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from