Deleted Added
full compact
vm_fault.c (170174) vm_fault.c (170291)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1994 John S. Dyson
5 * All rights reserved.
6 * Copyright (c) 1994 David Greenman
7 * All rights reserved.
8 *

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

67 * rights to redistribute these changes.
68 */
69
70/*
71 * Page fault handling module.
72 */
73
74#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * Copyright (c) 1994 John S. Dyson
5 * All rights reserved.
6 * Copyright (c) 1994 David Greenman
7 * All rights reserved.
8 *

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

67 * rights to redistribute these changes.
68 */
69
70/*
71 * Page fault handling module.
72 */
73
74#include <sys/cdefs.h>
75__FBSDID("$FreeBSD: head/sys/vm/vm_fault.c 170174 2007-06-01 01:12:45Z jeff $");
75__FBSDID("$FreeBSD: head/sys/vm/vm_fault.c 170291 2007-06-04 21:38:48Z attilio $");
76
77#include <sys/param.h>
78#include <sys/systm.h>
79#include <sys/kernel.h>
80#include <sys/lock.h>
81#include <sys/mutex.h>
82#include <sys/proc.h>
83#include <sys/resourcevar.h>

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

214 vm_object_t next_object;
215 vm_page_t marray[VM_FAULT_READ];
216 int hardfault;
217 int faultcount;
218 struct faultstate fs;
219
220 hardfault = 0;
221 growstack = TRUE;
76
77#include <sys/param.h>
78#include <sys/systm.h>
79#include <sys/kernel.h>
80#include <sys/lock.h>
81#include <sys/mutex.h>
82#include <sys/proc.h>
83#include <sys/resourcevar.h>

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

214 vm_object_t next_object;
215 vm_page_t marray[VM_FAULT_READ];
216 int hardfault;
217 int faultcount;
218 struct faultstate fs;
219
220 hardfault = 0;
221 growstack = TRUE;
222 PCPU_LAZY_INC(cnt.v_vm_faults);
222 PCPU_INC(cnt.v_vm_faults);
223
224RetryFault:;
225
226 /*
227 * Find the backing store object and offset into it to begin the
228 * search.
229 */
230 fs.map = map;

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

389 VM_OBJECT_LOCK(fs.object);
390 if (fs.m == vm_page_lookup(fs.object,
391 fs.pindex)) {
392 vm_page_sleep_if_busy(fs.m, TRUE,
393 "vmpfw");
394 }
395 vm_object_pip_wakeup(fs.object);
396 VM_OBJECT_UNLOCK(fs.object);
223
224RetryFault:;
225
226 /*
227 * Find the backing store object and offset into it to begin the
228 * search.
229 */
230 fs.map = map;

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

389 VM_OBJECT_LOCK(fs.object);
390 if (fs.m == vm_page_lookup(fs.object,
391 fs.pindex)) {
392 vm_page_sleep_if_busy(fs.m, TRUE,
393 "vmpfw");
394 }
395 vm_object_pip_wakeup(fs.object);
396 VM_OBJECT_UNLOCK(fs.object);
397 PCPU_LAZY_INC(cnt.v_intrans);
397 PCPU_INC(cnt.v_intrans);
398 vm_object_deallocate(fs.first_object);
399 goto RetryFault;
400 }
401 queue = fs.m->queue;
402
403 vm_pageq_remove_nowakeup(fs.m);
404
405 if (VM_PAGE_RESOLVEQUEUE(fs.m, queue) == PQ_CACHE &&

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

663 fs.first_m = NULL;
664
665 /*
666 * Zero the page if necessary and mark it valid.
667 */
668 if ((fs.m->flags & PG_ZERO) == 0) {
669 pmap_zero_page(fs.m);
670 } else {
398 vm_object_deallocate(fs.first_object);
399 goto RetryFault;
400 }
401 queue = fs.m->queue;
402
403 vm_pageq_remove_nowakeup(fs.m);
404
405 if (VM_PAGE_RESOLVEQUEUE(fs.m, queue) == PQ_CACHE &&

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

663 fs.first_m = NULL;
664
665 /*
666 * Zero the page if necessary and mark it valid.
667 */
668 if ((fs.m->flags & PG_ZERO) == 0) {
669 pmap_zero_page(fs.m);
670 } else {
671 PCPU_LAZY_INC(cnt.v_ozfod);
671 PCPU_INC(cnt.v_ozfod);
672 }
672 }
673 PCPU_LAZY_INC(cnt.v_zfod);
673 PCPU_INC(cnt.v_zfod);
674 fs.m->valid = VM_PAGE_BITS_ALL;
675 break; /* break to PAGE HAS BEEN FOUND */
676 } else {
677 KASSERT(fs.object != next_object,
678 ("object loop %p", next_object));
679 VM_OBJECT_LOCK(next_object);
680 vm_object_pip_add(next_object, 1);
681 if (fs.object != fs.first_object)

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

747 * process'es object. The page is
748 * automatically made dirty.
749 */
750 vm_page_rename(fs.m, fs.first_object, fs.first_pindex);
751 vm_page_unlock_queues();
752 vm_page_busy(fs.m);
753 fs.first_m = fs.m;
754 fs.m = NULL;
674 fs.m->valid = VM_PAGE_BITS_ALL;
675 break; /* break to PAGE HAS BEEN FOUND */
676 } else {
677 KASSERT(fs.object != next_object,
678 ("object loop %p", next_object));
679 VM_OBJECT_LOCK(next_object);
680 vm_object_pip_add(next_object, 1);
681 if (fs.object != fs.first_object)

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

747 * process'es object. The page is
748 * automatically made dirty.
749 */
750 vm_page_rename(fs.m, fs.first_object, fs.first_pindex);
751 vm_page_unlock_queues();
752 vm_page_busy(fs.m);
753 fs.first_m = fs.m;
754 fs.m = NULL;
755 PCPU_LAZY_INC(cnt.v_cow_optim);
755 PCPU_INC(cnt.v_cow_optim);
756 } else {
757 /*
758 * Oh, well, lets copy it.
759 */
760 pmap_copy_page(fs.m, fs.first_m);
761 fs.first_m->valid = VM_PAGE_BITS_ALL;
762 }
763 if (fs.m) {

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

775 /*
776 * Only use the new page below...
777 */
778 fs.object = fs.first_object;
779 fs.pindex = fs.first_pindex;
780 fs.m = fs.first_m;
781 if (!is_first_object_locked)
782 VM_OBJECT_LOCK(fs.object);
756 } else {
757 /*
758 * Oh, well, lets copy it.
759 */
760 pmap_copy_page(fs.m, fs.first_m);
761 fs.first_m->valid = VM_PAGE_BITS_ALL;
762 }
763 if (fs.m) {

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

775 /*
776 * Only use the new page below...
777 */
778 fs.object = fs.first_object;
779 fs.pindex = fs.first_pindex;
780 fs.m = fs.first_m;
781 if (!is_first_object_locked)
782 VM_OBJECT_LOCK(fs.object);
783 PCPU_LAZY_INC(cnt.v_cow_faults);
783 PCPU_INC(cnt.v_cow_faults);
784 } else {
785 prot &= ~VM_PROT_WRITE;
786 }
787 }
788
789 /*
790 * We must verify that the maps have not changed since our last
791 * lookup.

--- 549 unchanged lines hidden ---
784 } else {
785 prot &= ~VM_PROT_WRITE;
786 }
787 }
788
789 /*
790 * We must verify that the maps have not changed since our last
791 * lookup.

--- 549 unchanged lines hidden ---