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

Function vm_page_grab_unlocked

freebsd/vm/vm_page.c:4547–4573  ·  view source on GitHub ↗

* Try to locklessly grab a page and fall back to the object lock if NOCREAT * is not set. */

Source from the content-addressed store, hash-verified

4545 * is not set.
4546 */
4547vm_page_t
4548vm_page_grab_unlocked(vm_object_t object, vm_pindex_t pindex, int allocflags)
4549{
4550 vm_page_t m;
4551
4552 vm_page_grab_check(allocflags);
4553
4554 if (!vm_page_acquire_unlocked(object, pindex, NULL, &m, allocflags))
4555 return (NULL);
4556 if (m != NULL)
4557 return (m);
4558
4559 /*
4560 * The radix lockless lookup should never return a false negative
4561 * errors. If the user specifies NOCREAT they are guaranteed there
4562 * was no page present at the instant of the call. A NOCREAT caller
4563 * must handle create races gracefully.
4564 */
4565 if ((allocflags & VM_ALLOC_NOCREAT) != 0)
4566 return (NULL);
4567
4568 VM_OBJECT_WLOCK(object);
4569 m = vm_page_grab(object, pindex, allocflags);
4570 VM_OBJECT_WUNLOCK(object);
4571
4572 return (m);
4573}
4574
4575/*
4576 * Grab a page and make it valid, paging in if necessary. Pages missing from

Callers 4

mappedread_sfFunction · 0.85
dmu_read_pagesFunction · 0.85
vfs_bio_getpagesFunction · 0.85
vn_read_from_objFunction · 0.85

Calls 3

vm_page_grab_checkFunction · 0.85
vm_page_acquire_unlockedFunction · 0.85
vm_page_grabFunction · 0.85

Tested by

no test coverage detected