VM_PAGE_WIRE(9)

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

okay so this is a page from the Kernel Developer's Manual, section 9, and it's literally all about vm_page_wire, vm_page_unwire β€” wiring and unwiring pages. no cap, that's the whole NAME situation.


✨ SYNOPSIS ✨

before you can even breathe in this file, you gotta pull in the headers, periodt:

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

and then the two functions, in all their glory:

void
vm_page_wire(vm_page_t m);

void
vm_page_unwire(vm_page_t m, int activate);

🌸 DESCRIPTION 🌸

okay so vm_page_wire() β€” the way this works is it increments the wire count on a page 🫢, and it also removes it from whatever queue it is on. it's giving "you're mine now, no queue for you."

then we got vm_page_unwire() πŸ’… β€” this one releases one of the wirings on the page. just one! one at a time, we're being gentle.

and here's the part you gotta remember, bestie: when write_count reaches zero, the page gets placed back onto a queue:

  • the active queue β€” if activate is non-zero βœ…
  • the inactive queue β€” if activate is zero

but wait, there's a lil plot twist πŸ™ˆ β€” if the page is unmanaged (that means PG_UNMANAGED is set), then the page is just left sitting on PQ_NONE. it stays right there. iconic behaviour honestly.

lowkey important: write_count hitting zero is the trigger for the whole re-queueing thing, so keep an eye on that count, fr fr.

πŸ‘‘ AUTHORS πŸ‘‘

this manual page was written by Chad David <davidc@acns.ab.ca> β€” give them their flowers πŸ’


and that's the whole vibe check, bestie β€” this came to you courtesy of Debian, dated July 13, 2001, under the title VM_PAGE_WIRE(9). slay, go wire some pages πŸ¦‹βœ¨

πŸ“¦ where this page comes from