MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vm_page_grab_sleep

Function vm_page_grab_sleep

freebsd/vm/vm_page.c:4374–4396  ·  view source on GitHub ↗

* vm_page_grab_sleep * * Sleep for busy according to VM_ALLOC_ parameters. Returns true * if the caller should retry and false otherwise. * * If the object is locked on entry the object will be unlocked with * false returns and still locked but possibly having been dropped * with true returns. */

Source from the content-addressed store, hash-verified

4372 * with true returns.
4373 */
4374static bool
4375vm_page_grab_sleep(vm_object_t object, vm_page_t m, vm_pindex_t pindex,
4376 const char *wmesg, int allocflags, bool locked)
4377{
4378
4379 if ((allocflags & VM_ALLOC_NOWAIT) != 0)
4380 return (false);
4381
4382 /*
4383 * Reference the page before unlocking and sleeping so that
4384 * the page daemon is less likely to reclaim it.
4385 */
4386 if (locked && (allocflags & VM_ALLOC_NOCREAT) == 0)
4387 vm_page_reference(m);
4388
4389 if (_vm_page_busy_sleep(object, m, pindex, wmesg, allocflags, locked) &&
4390 locked)
4391 VM_OBJECT_WLOCK(object);
4392 if ((allocflags & VM_ALLOC_WAITFAIL) != 0)
4393 return (false);
4394
4395 return (true);
4396}
4397
4398/*
4399 * Assert that the grab flags are valid.

Callers 4

vm_page_grabFunction · 0.85
vm_page_acquire_unlockedFunction · 0.85
vm_page_grab_validFunction · 0.85
vm_page_grab_pagesFunction · 0.85

Calls 2

vm_page_referenceFunction · 0.85
_vm_page_busy_sleepFunction · 0.85

Tested by

no test coverage detected