1/*- 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 49 unchanged lines hidden (view full) --- 58 * rights to redistribute these changes. 59 */ 60 61/* 62 * Kernel memory management. 63 */ 64 65#include <sys/cdefs.h> |
66__FBSDID("$FreeBSD: head/sys/vm/vm_kern.c 230623 2012-01-27 20:18:31Z kmacy $"); |
67 68#include <sys/param.h> 69#include <sys/systm.h> 70#include <sys/kernel.h> /* for ticks and hz */ 71#include <sys/eventhandler.h> 72#include <sys/lock.h> 73#include <sys/mutex.h> 74#include <sys/proc.h> --- 302 unchanged lines hidden (view full) --- 377 378 if ((flags & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT) 379 pflags = VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED; 380 else 381 pflags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED; 382 383 if (flags & M_ZERO) 384 pflags |= VM_ALLOC_ZERO; |
385 if (flags & M_NODUMP) 386 pflags |= VM_ALLOC_NODUMP; |
387 388 VM_OBJECT_LOCK(kmem_object); 389 for (i = 0; i < size; i += PAGE_SIZE) { 390retry: 391 m = vm_page_alloc(kmem_object, OFF_TO_IDX(offset + i), pflags); 392 393 /* 394 * Ran out of space, free everything up and return. Don't need --- 220 unchanged lines hidden --- |