vm_fault.c (44250) | vm_fault.c (46349) |
---|---|
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 * --- 52 unchanged lines hidden (view full) --- 61 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 62 * School of Computer Science 63 * Carnegie Mellon University 64 * Pittsburgh PA 15213-3890 65 * 66 * any improvements or extensions that they make and grant Carnegie the 67 * rights to redistribute these changes. 68 * | 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 * --- 52 unchanged lines hidden (view full) --- 61 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 62 * School of Computer Science 63 * Carnegie Mellon University 64 * Pittsburgh PA 15213-3890 65 * 66 * any improvements or extensions that they make and grant Carnegie the 67 * rights to redistribute these changes. 68 * |
69 * $Id: vm_fault.c,v 1.100 1999/02/17 09:08:29 dillon Exp $ | 69 * $Id: vm_fault.c,v 1.101 1999/02/25 06:00:52 alc Exp $ |
70 */ 71 72/* 73 * Page fault handling module. 74 */ 75 76#include <sys/param.h> 77#include <sys/systm.h> --- 326 unchanged lines hidden (view full) --- 404 vm_pindex_t firstpindex, tmppindex; 405 if (fs.first_pindex < 406 2*(VM_FAULT_READ_BEHIND + VM_FAULT_READ_AHEAD + 1)) 407 firstpindex = 0; 408 else 409 firstpindex = fs.first_pindex - 410 2*(VM_FAULT_READ_BEHIND + VM_FAULT_READ_AHEAD + 1); 411 | 70 */ 71 72/* 73 * Page fault handling module. 74 */ 75 76#include <sys/param.h> 77#include <sys/systm.h> --- 326 unchanged lines hidden (view full) --- 404 vm_pindex_t firstpindex, tmppindex; 405 if (fs.first_pindex < 406 2*(VM_FAULT_READ_BEHIND + VM_FAULT_READ_AHEAD + 1)) 407 firstpindex = 0; 408 else 409 firstpindex = fs.first_pindex - 410 2*(VM_FAULT_READ_BEHIND + VM_FAULT_READ_AHEAD + 1); 411 |
412 /* 413 * note: partially valid pages cannot be 414 * included in the lookahead - NFS piecemeal 415 * writes will barf on it badly. 416 */ 417 |
|
412 for(tmppindex = fs.first_pindex - 1; 413 tmppindex >= firstpindex; 414 --tmppindex) { 415 vm_page_t mt; 416 mt = vm_page_lookup( fs.first_object, tmppindex); 417 if (mt == NULL || (mt->valid != VM_PAGE_BITS_ALL)) 418 break; 419 if (mt->busy || --- 127 unchanged lines hidden (view full) --- 547 vm_object_pip_wakeup(fs.object); 548 549 fs.object = fs.first_object; 550 fs.pindex = fs.first_pindex; 551 fs.m = fs.first_m; 552 } 553 fs.first_m = NULL; 554 | 418 for(tmppindex = fs.first_pindex - 1; 419 tmppindex >= firstpindex; 420 --tmppindex) { 421 vm_page_t mt; 422 mt = vm_page_lookup( fs.first_object, tmppindex); 423 if (mt == NULL || (mt->valid != VM_PAGE_BITS_ALL)) 424 break; 425 if (mt->busy || --- 127 unchanged lines hidden (view full) --- 553 vm_object_pip_wakeup(fs.object); 554 555 fs.object = fs.first_object; 556 fs.pindex = fs.first_pindex; 557 fs.m = fs.first_m; 558 } 559 fs.first_m = NULL; 560 |
561 /* 562 * Zero the page if necessary and mark it valid. 563 */ |
|
555 if ((fs.m->flags & PG_ZERO) == 0) { 556 vm_page_zero_fill(fs.m); | 564 if ((fs.m->flags & PG_ZERO) == 0) { 565 vm_page_zero_fill(fs.m); |
557 } 558 else | 566 } else { |
559 cnt.v_ozfod++; | 567 cnt.v_ozfod++; |
568 } |
|
560 cnt.v_zfod++; | 569 cnt.v_zfod++; |
570 fs.m->valid = VM_PAGE_BITS_ALL; |
|
561 break; /* break to PAGE HAS BEEN FOUND */ 562 } else { 563 if (fs.object != fs.first_object) { 564 vm_object_pip_wakeup(fs.object); 565 } 566 KASSERT(fs.object != next_object, ("object loop %p", next_object)); 567 fs.object = next_object; 568 vm_object_pip_add(fs.object, 1); --- 214 unchanged lines hidden (view full) --- 783#ifdef INVARIANTS 784 if ((fs.m->flags & PG_BUSY) == 0) { 785 printf("WARNING! PAGE %p NOT BUSY!!!\n", fs.m); 786 vm_page_busy(fs.m); 787 } 788#endif 789 790 unlock_things(&fs); | 571 break; /* break to PAGE HAS BEEN FOUND */ 572 } else { 573 if (fs.object != fs.first_object) { 574 vm_object_pip_wakeup(fs.object); 575 } 576 KASSERT(fs.object != next_object, ("object loop %p", next_object)); 577 fs.object = next_object; 578 vm_object_pip_add(fs.object, 1); --- 214 unchanged lines hidden (view full) --- 793#ifdef INVARIANTS 794 if ((fs.m->flags & PG_BUSY) == 0) { 795 printf("WARNING! PAGE %p NOT BUSY!!!\n", fs.m); 796 vm_page_busy(fs.m); 797 } 798#endif 799 800 unlock_things(&fs); |
791 fs.m->valid = VM_PAGE_BITS_ALL; 792 vm_page_flag_clear(fs.m, PG_ZERO); | |
793 | 801 |
802 /* 803 * Sanity check: page must be completely valid or it is not fit to 804 * map into user space. vm_pager_get_pages() ensures this. 805 */ 806 807 if (fs.m->valid != VM_PAGE_BITS_ALL) { 808 vm_page_zero_invalid(fs.m, TRUE); 809 printf("Warning: page %p partially invalid on fault\n", fs.m); 810 } 811 |
|
794 pmap_enter(fs.map->pmap, vaddr, VM_PAGE_TO_PHYS(fs.m), prot, wired); | 812 pmap_enter(fs.map->pmap, vaddr, VM_PAGE_TO_PHYS(fs.m), prot, wired); |
813 |
|
795 if (((fault_flags & VM_FAULT_WIRE_MASK) == 0) && (wired == 0)) { 796 pmap_prefault(fs.map->pmap, vaddr, fs.entry); 797 } 798 | 814 if (((fault_flags & VM_FAULT_WIRE_MASK) == 0) && (wired == 0)) { 815 pmap_prefault(fs.map->pmap, vaddr, fs.entry); 816 } 817 |
818 vm_page_flag_clear(fs.m, PG_ZERO); |
|
799 vm_page_flag_set(fs.m, PG_MAPPED|PG_REFERENCED); 800 if (fault_flags & VM_FAULT_HOLD) 801 vm_page_hold(fs.m); 802 803 /* 804 * If the page is not wired down, then put it where the pageout daemon 805 * can find it. 806 */ --- 390 unchanged lines hidden --- | 819 vm_page_flag_set(fs.m, PG_MAPPED|PG_REFERENCED); 820 if (fault_flags & VM_FAULT_HOLD) 821 vm_page_hold(fs.m); 822 823 /* 824 * If the page is not wired down, then put it where the pageout daemon 825 * can find it. 826 */ --- 390 unchanged lines hidden --- |