Deleted Added
full compact
vm_kern.c (98226) vm_kern.c (98450)
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

--- 47 unchanged lines hidden (view full) ---

56 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
57 * School of Computer Science
58 * Carnegie Mellon University
59 * Pittsburgh PA 15213-3890
60 *
61 * any improvements or extensions that they make and grant Carnegie the
62 * rights to redistribute these changes.
63 *
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

--- 47 unchanged lines hidden (view full) ---

56 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
57 * School of Computer Science
58 * Carnegie Mellon University
59 * Pittsburgh PA 15213-3890
60 *
61 * any improvements or extensions that they make and grant Carnegie the
62 * rights to redistribute these changes.
63 *
64 * $FreeBSD: head/sys/vm/vm_kern.c 98226 2002-06-14 18:21:01Z alc $
64 * $FreeBSD: head/sys/vm/vm_kern.c 98450 2002-06-19 20:47:18Z jeff $
65 */
66
67/*
68 * Kernel memory management.
69 */
70
71#include <sys/param.h>
72#include <sys/systm.h>

--- 269 unchanged lines hidden (view full) ---

342 goto bad;
343 }
344 offset = addr - VM_MIN_KERNEL_ADDRESS;
345 vm_object_reference(kmem_object);
346 vm_map_insert(map, kmem_object, offset, addr, addr + size,
347 VM_PROT_ALL, VM_PROT_ALL, 0);
348
349 for (i = 0; i < size; i += PAGE_SIZE) {
65 */
66
67/*
68 * Kernel memory management.
69 */
70
71#include <sys/param.h>
72#include <sys/systm.h>

--- 269 unchanged lines hidden (view full) ---

342 goto bad;
343 }
344 offset = addr - VM_MIN_KERNEL_ADDRESS;
345 vm_object_reference(kmem_object);
346 vm_map_insert(map, kmem_object, offset, addr, addr + size,
347 VM_PROT_ALL, VM_PROT_ALL, 0);
348
349 for (i = 0; i < size; i += PAGE_SIZE) {
350 int pflags;
350 /*
351 * Note: if M_NOWAIT specified alone, allocate from
352 * interrupt-safe queues only (just the free list). If
353 * M_USE_RESERVE is also specified, we can also
354 * allocate from the cache. Neither of the latter two
355 * flags may be specified from an interrupt since interrupts
356 * are not allowed to mess with the cache queue.
357 */
358retry:
351 /*
352 * Note: if M_NOWAIT specified alone, allocate from
353 * interrupt-safe queues only (just the free list). If
354 * M_USE_RESERVE is also specified, we can also
355 * allocate from the cache. Neither of the latter two
356 * flags may be specified from an interrupt since interrupts
357 * are not allowed to mess with the cache queue.
358 */
359retry:
359 m = vm_page_alloc(kmem_object, OFF_TO_IDX(offset + i),
360 ((flags & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT) ?
361 VM_ALLOC_INTERRUPT :
362 VM_ALLOC_SYSTEM);
360 if ((flags & (M_NOWAIT|M_USE_RESERVE)) == M_NOWAIT)
361 pflags = VM_ALLOC_INTERRUPT;
362 else
363 pflags = VM_ALLOC_SYSTEM;
363
364
365 if (flags & M_ZERO)
366 pflags |= VM_ALLOC_ZERO;
367
368 m = vm_page_alloc(kmem_object, OFF_TO_IDX(offset + i), pflags);
369
364 /*
365 * Ran out of space, free everything up and return. Don't need
366 * to lock page queues here as we know that the pages we got
367 * aren't on any queues.
368 */
369 if (m == NULL) {
370 if ((flags & M_NOWAIT) == 0) {
371 vm_map_unlock(map);

--- 145 unchanged lines hidden ---
370 /*
371 * Ran out of space, free everything up and return. Don't need
372 * to lock page queues here as we know that the pages we got
373 * aren't on any queues.
374 */
375 if (m == NULL) {
376 if ((flags & M_NOWAIT) == 0) {
377 vm_map_unlock(map);

--- 145 unchanged lines hidden ---