1/*-
2 * Copyright (c) 1991 Regents of the University of California.
3 * All rights reserved.
4 * Copyright (c) 1998 Matthew Dillon. All Rights Reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * The Mach Operating System project at Carnegie-Mellon University.
8 *
--- 63 unchanged lines hidden (view full) ---
72 *
73 */
74
75/*
76 * Resident memory management module.
77 */
78
79#include <sys/cdefs.h>
80__FBSDID("$FreeBSD: head/sys/vm/vm_page.c 228287 2011-12-05 18:29:25Z alc $");
81
82#include "opt_vm.h"
83
84#include <sys/param.h>
85#include <sys/systm.h>
86#include <sys/lock.h>
87#include <sys/kernel.h>
88#include <sys/limits.h>
--- 1211 unchanged lines hidden (view full) ---
1300 *
1301 * optional allocation flags:
1302 * VM_ALLOC_COUNT(number) the number of additional pages that the caller
1303 * intends to allocate
1304 * VM_ALLOC_IFCACHED return page only if it is cached
1305 * VM_ALLOC_IFNOTCACHED return NULL, do not reactivate if the page
1306 * is cached
1307 * VM_ALLOC_NOBUSY do not set the flag VPO_BUSY on the page
1308 * VM_ALLOC_NOOBJ page is not associated with an object and
1309 * should not have the flag VPO_BUSY set
1310 * VM_ALLOC_WIRED wire the allocated page
1311 * VM_ALLOC_ZERO prefer a zeroed page
1312 *
1313 * This routine may not sleep.
1314 */
1315vm_page_t
--- 108 unchanged lines hidden (view full) ---
1424 cnt.v_free_count--;
1425 }
1426
1427 /*
1428 * Only the PG_ZERO flag is inherited. The PG_CACHED or PG_FREE flag
1429 * must be cleared before the free page queues lock is released.
1430 */
1431 flags = 0;
1432 if (m->flags & PG_ZERO) {
1433 vm_page_zero_count--;
1434 if (req & VM_ALLOC_ZERO)
1435 flags = PG_ZERO;
1436 }
1437 m->flags = flags;
1438 mtx_unlock(&vm_page_queue_free_mtx);
1439 m->aflags = 0;
--- 154 unchanged lines hidden (view full) ---
1594 return (NULL);
1595
1596 /*
1597 * Initialize the pages. Only the PG_ZERO flag is inherited.
1598 */
1599 flags = 0;
1600 if ((req & VM_ALLOC_ZERO) != 0)
1601 flags = PG_ZERO;
1602 if ((req & VM_ALLOC_WIRED) != 0)
1603 atomic_add_int(&cnt.v_wire_count, npages);
1604 oflags = VPO_UNMANAGED;
1605 if (object != NULL) {
1606 if ((req & VM_ALLOC_NOBUSY) == 0)
1607 oflags |= VPO_BUSY;
1608 if (object->memattr != VM_MEMATTR_DEFAULT &&
1609 memattr == VM_MEMATTR_DEFAULT)
--- 1422 unchanged lines hidden ---
2 * Copyright (c) 1991 Regents of the University of California.
3 * All rights reserved.
4 * Copyright (c) 1998 Matthew Dillon. All Rights Reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * The Mach Operating System project at Carnegie-Mellon University.
8 *
--- 63 unchanged lines hidden (view full) ---
72 *
73 */
74
75/*
76 * Resident memory management module.
77 */
78
79#include <sys/cdefs.h>
80__FBSDID("$FreeBSD: head/sys/vm/vm_page.c 228287 2011-12-05 18:29:25Z alc $");
81
82#include "opt_vm.h"
83
84#include <sys/param.h>
85#include <sys/systm.h>
86#include <sys/lock.h>
87#include <sys/kernel.h>
88#include <sys/limits.h>
--- 1211 unchanged lines hidden (view full) ---
1300 *
1301 * optional allocation flags:
1302 * VM_ALLOC_COUNT(number) the number of additional pages that the caller
1303 * intends to allocate
1304 * VM_ALLOC_IFCACHED return page only if it is cached
1305 * VM_ALLOC_IFNOTCACHED return NULL, do not reactivate if the page
1306 * is cached
1307 * VM_ALLOC_NOBUSY do not set the flag VPO_BUSY on the page
1308 * VM_ALLOC_NOOBJ page is not associated with an object and
1309 * should not have the flag VPO_BUSY set
1310 * VM_ALLOC_WIRED wire the allocated page
1311 * VM_ALLOC_ZERO prefer a zeroed page
1312 *
1313 * This routine may not sleep.
1314 */
1315vm_page_t
--- 108 unchanged lines hidden (view full) ---
1424 cnt.v_free_count--;
1425 }
1426
1427 /*
1428 * Only the PG_ZERO flag is inherited. The PG_CACHED or PG_FREE flag
1429 * must be cleared before the free page queues lock is released.
1430 */
1431 flags = 0;
1432 if (m->flags & PG_ZERO) {
1433 vm_page_zero_count--;
1434 if (req & VM_ALLOC_ZERO)
1435 flags = PG_ZERO;
1436 }
1437 m->flags = flags;
1438 mtx_unlock(&vm_page_queue_free_mtx);
1439 m->aflags = 0;
--- 154 unchanged lines hidden (view full) ---
1594 return (NULL);
1595
1596 /*
1597 * Initialize the pages. Only the PG_ZERO flag is inherited.
1598 */
1599 flags = 0;
1600 if ((req & VM_ALLOC_ZERO) != 0)
1601 flags = PG_ZERO;
1602 if ((req & VM_ALLOC_WIRED) != 0)
1603 atomic_add_int(&cnt.v_wire_count, npages);
1604 oflags = VPO_UNMANAGED;
1605 if (object != NULL) {
1606 if ((req & VM_ALLOC_NOBUSY) == 0)
1607 oflags |= VPO_BUSY;
1608 if (object->memattr != VM_MEMATTR_DEFAULT &&
1609 memattr == VM_MEMATTR_DEFAULT)
--- 1422 unchanged lines hidden ---