VM_PAGE_GRAB(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’– VM_PAGE_GRAB πŸ’–

okay so bestie, welcome to the vm_page_grab page β€” it's section 9 of the Kernel Developer's Manual, so yeah, we're in kernel-dev territory, put your big-girl hat on πŸ‘‘


✨ NAME ✨

vm_page_grab β€” literally just returns a page from an object, that's the whole vibe πŸŽ€


🌸 SYNOPSIS 🌸

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

vm_page_t
vm_page_grab(vm_object_t object, vm_pindex_t pindex, int allocflags);

like yes, you need all three includes, don't skip any, i'm watching πŸ‘€


πŸ¦‹ DESCRIPTION πŸ¦‹

so vm_page_grab() returns the page at pindex from the given object. that's the whole job, no cap πŸ’…

if the page exists and is busy? she's gonna sleep while waiting for it. like, full on napping. if the page doesn't exist? it gets allocated. either way the function sleeps until the allocation request can actually be satisfied β€” she doesn't do "maybe", she does "yes" ⭐

the lock rules, listen up bestie 🫢: the function requires the object to be locked on entry, and it returns with the object locked. and if vm_page_grab() sleeps for any reason, the object lock gets temporarily dropped β€” so don't be weird about it, that's just how she rolls 😭

vm_page_grab() supports all of the flags supported by vm_page_alloc(9). like, all of them, she's not picky. and in addition, vm_page_grab() supports this one extra flag:

  • VM_ALLOC_IGN_SBUSY β€” when you're waiting for the busy state of the existing page to drain, this makes her only test for exclusive busy and ignore the shared busy counter πŸ™ˆ

πŸ’€ RETURN VALUES πŸ’€

vm_page_grab() always returns the page. always. periodt. no null, no maybe, just page πŸ‘‘


πŸ”₯ SEE ALSO πŸ”₯


πŸ’œ AUTHORS πŸ’œ

this manual page was written by Chad David <davidc@acns.ab.ca> β€” ty Chad, icon behaviour 🌈


and that's the whole page, bestie πŸ“ this one's from the Debian fam, dated August 23, 2013 (yes, a vintage, she's been iconic for a minute 🧚) β€” catch you on the next man page! πŸ’–βœ¨

πŸ“¦ where this page comes from