VM_PAGE_GRAB(9)
π 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
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved
- Copyright (c) 2013 The FreeBSD Foundation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms