phys_pager.c (77062) | phys_pager.c (79224) |
---|---|
1/* 2 * Copyright (c) 2000 Peter Wemm 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 * | 1/* 2 * Copyright (c) 2000 Peter Wemm 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 8 unchanged lines hidden (view full) --- 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 * |
25 * $FreeBSD: head/sys/vm/phys_pager.c 77062 2001-05-23 19:52:23Z jhb $ | 25 * $FreeBSD: head/sys/vm/phys_pager.c 79224 2001-07-04 16:20:28Z dillon $ |
26 */ 27 28#include <sys/param.h> 29#include <sys/systm.h> 30#include <sys/linker_set.h> 31#include <sys/conf.h> 32#include <sys/kernel.h> 33#include <sys/lock.h> | 26 */ 27 28#include <sys/param.h> 29#include <sys/systm.h> 30#include <sys/linker_set.h> 31#include <sys/conf.h> 32#include <sys/kernel.h> 33#include <sys/lock.h> |
34#include <sys/proc.h> |
|
34#include <sys/mutex.h> 35#include <sys/mman.h> 36#include <sys/sysctl.h> 37 38#include <vm/vm.h> 39#include <vm/vm_object.h> 40#include <vm/vm_page.h> 41#include <vm/vm_pager.h> --- 15 unchanged lines hidden (view full) --- 57} 58 59static vm_object_t 60phys_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, 61 vm_ooffset_t foff) 62{ 63 vm_object_t object; 64 | 35#include <sys/mutex.h> 36#include <sys/mman.h> 37#include <sys/sysctl.h> 38 39#include <vm/vm.h> 40#include <vm/vm_object.h> 41#include <vm/vm_page.h> 42#include <vm/vm_pager.h> --- 15 unchanged lines hidden (view full) --- 58} 59 60static vm_object_t 61phys_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, 62 vm_ooffset_t foff) 63{ 64 vm_object_t object; 65 |
66 GIANT_REQUIRED; 67 |
|
65 /* 66 * Offset should be page aligned. 67 */ 68 if (foff & PAGE_MASK) 69 return (NULL); 70 71 size = round_page(size); 72 73 if (handle != NULL) { 74 /* 75 * Lock to prevent object creation race condition. 76 */ 77 while (phys_pager_alloc_lock) { 78 phys_pager_alloc_lock = -1; | 68 /* 69 * Offset should be page aligned. 70 */ 71 if (foff & PAGE_MASK) 72 return (NULL); 73 74 size = round_page(size); 75 76 if (handle != NULL) { 77 /* 78 * Lock to prevent object creation race condition. 79 */ 80 while (phys_pager_alloc_lock) { 81 phys_pager_alloc_lock = -1; |
79 msleep(&phys_pager_alloc_lock, &vm_mtx, PVM, "swpalc", 0); | 82 tsleep(&phys_pager_alloc_lock, PVM, "swpalc", 0); |
80 } 81 phys_pager_alloc_lock = 1; 82 83 /* 84 * Look up pager, creating as necessary. 85 */ 86 object = vm_pager_object_lookup(&phys_pager_object_list, handle); 87 if (object == NULL) { --- 111 unchanged lines hidden --- | 83 } 84 phys_pager_alloc_lock = 1; 85 86 /* 87 * Look up pager, creating as necessary. 88 */ 89 object = vm_pager_object_lookup(&phys_pager_object_list, handle); 90 if (object == NULL) { --- 111 unchanged lines hidden --- |