phys_pager.c (9b4fcf851a73554063d4a2de9a4f10cd23a0a4f6) | phys_pager.c (89f6b8632cc94bca2738b4fcc26e1189ef4f5dde) |
---|---|
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. --- 20 unchanged lines hidden (view full) --- 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/conf.h> 32#include <sys/kernel.h> 33#include <sys/lock.h> 34#include <sys/proc.h> 35#include <sys/mutex.h> 36#include <sys/mman.h> | 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. --- 20 unchanged lines hidden (view full) --- 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/conf.h> 32#include <sys/kernel.h> 33#include <sys/lock.h> 34#include <sys/proc.h> 35#include <sys/mutex.h> 36#include <sys/mman.h> |
37#include <sys/rwlock.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> 43 44/* list of phys pager objects */ --- 73 unchanged lines hidden (view full) --- 118/* 119 * MPSAFE 120 */ 121static void 122phys_pager_dealloc(vm_object_t object) 123{ 124 125 if (object->handle != NULL) { | 38#include <sys/sysctl.h> 39 40#include <vm/vm.h> 41#include <vm/vm_object.h> 42#include <vm/vm_page.h> 43#include <vm/vm_pager.h> 44 45/* list of phys pager objects */ --- 73 unchanged lines hidden (view full) --- 119/* 120 * MPSAFE 121 */ 122static void 123phys_pager_dealloc(vm_object_t object) 124{ 125 126 if (object->handle != NULL) { |
126 VM_OBJECT_UNLOCK(object); | 127 VM_OBJECT_WUNLOCK(object); |
127 mtx_lock(&phys_pager_mtx); 128 TAILQ_REMOVE(&phys_pager_object_list, object, pager_object_list); 129 mtx_unlock(&phys_pager_mtx); | 128 mtx_lock(&phys_pager_mtx); 129 TAILQ_REMOVE(&phys_pager_object_list, object, pager_object_list); 130 mtx_unlock(&phys_pager_mtx); |
130 VM_OBJECT_LOCK(object); | 131 VM_OBJECT_WLOCK(object); |
131 } 132} 133 134/* 135 * Fill as many pages as vm_fault has allocated for us. 136 */ 137static int 138phys_pager_getpages(vm_object_t object, vm_page_t *m, int count, int reqpage) 139{ 140 int i; 141 | 132 } 133} 134 135/* 136 * Fill as many pages as vm_fault has allocated for us. 137 */ 138static int 139phys_pager_getpages(vm_object_t object, vm_page_t *m, int count, int reqpage) 140{ 141 int i; 142 |
142 VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); | 143 VM_OBJECT_ASSERT_WLOCKED(object); |
143 for (i = 0; i < count; i++) { 144 if (m[i]->valid == 0) { 145 if ((m[i]->flags & PG_ZERO) == 0) 146 pmap_zero_page(m[i]); 147 m[i]->valid = VM_PAGE_BITS_ALL; 148 } 149 KASSERT(m[i]->valid == VM_PAGE_BITS_ALL, 150 ("phys_pager_getpages: partially valid page %p", m[i])); --- 52 unchanged lines hidden --- | 144 for (i = 0; i < count; i++) { 145 if (m[i]->valid == 0) { 146 if ((m[i]->flags & PG_ZERO) == 0) 147 pmap_zero_page(m[i]); 148 m[i]->valid = VM_PAGE_BITS_ALL; 149 } 150 KASSERT(m[i]->valid == VM_PAGE_BITS_ALL, 151 ("phys_pager_getpages: partially valid page %p", m[i])); --- 52 unchanged lines hidden --- |