diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-04-17 01:25:23 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1997-04-17 01:25:23 +0000 |
commit | 88b359233160997d773bfca12d4654247062701d (patch) | |
tree | 54f9173892d3b02700bcb5bd04f403869b91a844 /sys/vm/vm_fault.c | |
parent | 823c29b4663430510be1e46e888f930ca96a9ab4 (diff) |
Removal of race conditions. Inspired by Charles Hannum's
<mycroft@netbsd.org> reorganization of the vm_collapse logic, although not
used verbatim. We no longer collapse objects from the pagedaemon as that
is not necessary anymore with the more aggressive collapses that gets done.
This also increases performance of loaded systems. Much KNF too.
Diffstat (limited to 'sys/vm/vm_fault.c')
-rw-r--r-- | sys/vm/vm_fault.c | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index e591f555d16..5a28eb128ab 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_fault.c,v 1.5 1996/11/23 21:47:14 kstailey Exp $ */ +/* $OpenBSD: vm_fault.c,v 1.6 1997/04/17 01:25:17 niklas Exp $ */ /* $NetBSD: vm_fault.c,v 1.18 1996/05/20 17:40:02 mrg Exp $ */ /* @@ -145,12 +145,12 @@ vm_fault(map, vaddr, fault_type, change_wiring) } #define UNLOCK_THINGS { \ - object->paging_in_progress--; \ + vm_object_paging_end(object); \ vm_object_unlock(object); \ if (object != first_object) { \ vm_object_lock(first_object); \ FREE_PAGE(first_m); \ - first_object->paging_in_progress--; \ + vm_object_paging_end(first_object); \ vm_object_unlock(first_object); \ } \ UNLOCK_MAP; \ @@ -191,11 +191,7 @@ vm_fault(map, vaddr, fault_type, change_wiring) vm_object_lock(first_object); first_object->ref_count++; -#ifdef DIAGNOSTIC - if (first_object->paging_in_progress == 0xdead) - panic("vm_fault: first_object deallocated"); -#endif - first_object->paging_in_progress++; + vm_object_paging_begin(first_object); /* * INVARIANTS (through entire routine): @@ -407,7 +403,7 @@ vm_fault(map, vaddr, fault_type, change_wiring) * in the top object with zeros. */ if (object != first_object) { - object->paging_in_progress--; + vm_object_paging_end(object); vm_object_unlock(object); object = first_object; @@ -425,14 +421,10 @@ vm_fault(map, vaddr, fault_type, change_wiring) else { vm_object_lock(next_object); if (object != first_object) - object->paging_in_progress--; + vm_object_paging_end(object); vm_object_unlock(object); object = next_object; -#ifdef DIAGNOSTIC - if (object->paging_in_progress == 0xdead) - panic("vm_fault: object deallocated (1)"); -#endif - object->paging_in_progress++; + vm_object_paging_begin(object); } } @@ -508,7 +500,7 @@ vm_fault(map, vaddr, fault_type, change_wiring) * We no longer need the old page or object. */ PAGE_WAKEUP(m); - object->paging_in_progress--; + vm_object_paging_end(object); vm_object_unlock(object); /* @@ -529,15 +521,10 @@ vm_fault(map, vaddr, fault_type, change_wiring) * But we have to play ugly games with * paging_in_progress to do that... */ - object->paging_in_progress--; + vm_object_paging_end(object); vm_object_collapse(object); -#ifdef DIAGNOSTIC - if (object->paging_in_progress == 0xdead) - panic("vm_fault: object deallocated (2)"); -#endif - object->paging_in_progress++; - } - else { + vm_object_paging_begin(object); + } else { prot &= ~VM_PROT_WRITE; m->flags |= PG_COPYONWRITE; } |