* Try to locklessly grab a page and fall back to the object lock if NOCREAT * is not set. */
| 4545 | * is not set. |
| 4546 | */ |
| 4547 | vm_page_t |
| 4548 | vm_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 |
no test coverage detected