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 230623 2012-01-27 20:18:31Z kmacy $");
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_NODUMP do not include the page in a kernel core dump
1309 * VM_ALLOC_NOOBJ page is not associated with an object and
1310 * should not have the flag VPO_BUSY set
1311 * VM_ALLOC_WIRED wire the allocated page
1312 * VM_ALLOC_ZERO prefer a zeroed page
1313 *
1314 * This routine may not sleep.
1315 */
1316vm_page_t
--- 108 unchanged lines hidden (view full) ---
1425 cnt.v_free_count--;
1426 }
1427
1428 /*
1429 * Only the PG_ZERO flag is inherited. The PG_CACHED or PG_FREE flag
1430 * must be cleared before the free page queues lock is released.
1431 */
1432 flags = 0;
1433 if (req & VM_ALLOC_NODUMP)
1434 flags |= PG_NODUMP;
1435 if (m->flags & PG_ZERO) {
1436 vm_page_zero_count--;
1437 if (req & VM_ALLOC_ZERO)
1438 flags = PG_ZERO;
1439 }
1440 m->flags = flags;
1441 mtx_unlock(&vm_page_queue_free_mtx);
1442 m->aflags = 0;
--- 154 unchanged lines hidden (view full) ---
1597 return (NULL);
1598
1599 /*
1600 * Initialize the pages. Only the PG_ZERO flag is inherited.
1601 */
1602 flags = 0;
1603 if ((req & VM_ALLOC_ZERO) != 0)
1604 flags = PG_ZERO;
1605 if ((req & VM_ALLOC_NODUMP) != 0)
1606 flags |= PG_NODUMP;
1607 if ((req & VM_ALLOC_WIRED) != 0)
1608 atomic_add_int(&cnt.v_wire_count, npages);
1609 oflags = VPO_UNMANAGED;
1610 if (object != NULL) {
1611 if ((req & VM_ALLOC_NOBUSY) == 0)
1612 oflags |= VPO_BUSY;
1613 if (object->memattr != VM_MEMATTR_DEFAULT &&
1614 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 230623 2012-01-27 20:18:31Z kmacy $");
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_NODUMP do not include the page in a kernel core dump
1309 * VM_ALLOC_NOOBJ page is not associated with an object and
1310 * should not have the flag VPO_BUSY set
1311 * VM_ALLOC_WIRED wire the allocated page
1312 * VM_ALLOC_ZERO prefer a zeroed page
1313 *
1314 * This routine may not sleep.
1315 */
1316vm_page_t
--- 108 unchanged lines hidden (view full) ---
1425 cnt.v_free_count--;
1426 }
1427
1428 /*
1429 * Only the PG_ZERO flag is inherited. The PG_CACHED or PG_FREE flag
1430 * must be cleared before the free page queues lock is released.
1431 */
1432 flags = 0;
1433 if (req & VM_ALLOC_NODUMP)
1434 flags |= PG_NODUMP;
1435 if (m->flags & PG_ZERO) {
1436 vm_page_zero_count--;
1437 if (req & VM_ALLOC_ZERO)
1438 flags = PG_ZERO;
1439 }
1440 m->flags = flags;
1441 mtx_unlock(&vm_page_queue_free_mtx);
1442 m->aflags = 0;
--- 154 unchanged lines hidden (view full) ---
1597 return (NULL);
1598
1599 /*
1600 * Initialize the pages. Only the PG_ZERO flag is inherited.
1601 */
1602 flags = 0;
1603 if ((req & VM_ALLOC_ZERO) != 0)
1604 flags = PG_ZERO;
1605 if ((req & VM_ALLOC_NODUMP) != 0)
1606 flags |= PG_NODUMP;
1607 if ((req & VM_ALLOC_WIRED) != 0)
1608 atomic_add_int(&cnt.v_wire_count, npages);
1609 oflags = VPO_UNMANAGED;
1610 if (object != NULL) {
1611 if ((req & VM_ALLOC_NOBUSY) == 0)
1612 oflags |= VPO_BUSY;
1613 if (object->memattr != VM_MEMATTR_DEFAULT &&
1614 memattr == VM_MEMATTR_DEFAULT)
--- 1422 unchanged lines hidden ---