Make vm_page_alloc() return PG_ZERO only if VM_ALLOC_ZERO is specified.

The objective being to eliminate some cases of page queues locking.
(See, for example, vm/vm_fault.c revision 1.160.)

Reviewed by:	tegge

(Also, pointed out by tegge that I changed vm_fault.c before changing
vm_page.c.  Oops.)
This commit is contained in:
Alan Cox 2003-01-12 23:32:46 +00:00
parent 277b215162
commit a15700fe32

View File

@ -755,7 +755,7 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
{
vm_page_t m = NULL;
vm_pindex_t color;
int page_req, s;
int flags, page_req, s;
page_req = req & VM_ALLOC_CLASS_MASK;
@ -844,12 +844,13 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, int req)
/*
* Initialize structure. Only the PG_ZERO flag is inherited.
*/
flags = PG_BUSY;
if (m->flags & PG_ZERO) {
vm_page_zero_count--;
m->flags = PG_ZERO | PG_BUSY;
} else {
m->flags = PG_BUSY;
if (req & VM_ALLOC_ZERO)
flags = PG_ZERO | PG_BUSY;
}
m->flags = flags;
if (req & VM_ALLOC_WIRED) {
atomic_add_int(&cnt.v_wire_count, 1);
m->wire_count = 1;