Introduce VM_ALLOC_NOBUSY, an option to vm_page_alloc() and vm_page_grab()
that indicates that the caller does not want a page with its busy flag set. In many places, the global page queues lock is acquired and released just to clear the busy flag on a just allocated page. Both the allocation of the page and the clearing of the busy flag occur while the containing vm object is locked. So, the busy flag might as well never be set.
This commit is contained in:
parent
7a9167aadd
commit
faeb949021
@ -843,7 +843,7 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
|
||||
if (req & VM_ALLOC_ZERO)
|
||||
flags = PG_ZERO | PG_BUSY;
|
||||
}
|
||||
if (req & VM_ALLOC_NOOBJ)
|
||||
if (req & (VM_ALLOC_NOBUSY | VM_ALLOC_NOOBJ))
|
||||
flags &= ~PG_BUSY;
|
||||
m->flags = flags;
|
||||
if (req & VM_ALLOC_WIRED) {
|
||||
@ -1420,7 +1420,8 @@ vm_page_grab(vm_object_t object, vm_pindex_t pindex, int allocflags)
|
||||
} else {
|
||||
if (allocflags & VM_ALLOC_WIRED)
|
||||
vm_page_wire(m);
|
||||
vm_page_busy(m);
|
||||
if ((allocflags & VM_ALLOC_NOBUSY) == 0)
|
||||
vm_page_busy(m);
|
||||
vm_page_unlock_queues();
|
||||
return (m);
|
||||
}
|
||||
|
@ -317,6 +317,7 @@ extern struct mtx vm_page_queue_mtx;
|
||||
#define VM_ALLOC_ZERO 0x0040 /* Try to obtain a zeroed page */
|
||||
#define VM_ALLOC_RETRY 0x0080 /* vm_page_grab() only */
|
||||
#define VM_ALLOC_NOOBJ 0x0100 /* No associated object */
|
||||
#define VM_ALLOC_NOBUSY 0x0200 /* Do not busy the page */
|
||||
|
||||
void vm_page_flag_set(vm_page_t m, unsigned short bits);
|
||||
void vm_page_flag_clear(vm_page_t m, unsigned short bits);
|
||||
|
Loading…
Reference in New Issue
Block a user