vm_object.c (7204) | vm_object.c (7243) |
---|---|
1/* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 47 unchanged lines hidden (view full) --- 56 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 57 * School of Computer Science 58 * Carnegie Mellon University 59 * Pittsburgh PA 15213-3890 60 * 61 * any improvements or extensions that they make and grant Carnegie the 62 * rights to redistribute these changes. 63 * | 1/* 2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * The Mach Operating System project at Carnegie-Mellon University. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 47 unchanged lines hidden (view full) --- 56 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 57 * School of Computer Science 58 * Carnegie Mellon University 59 * Pittsburgh PA 15213-3890 60 * 61 * any improvements or extensions that they make and grant Carnegie the 62 * rights to redistribute these changes. 63 * |
64 * $Id: vm_object.c,v 1.34 1995/03/20 10:20:41 davidg Exp $ | 64 * $Id: vm_object.c,v 1.35 1995/03/21 01:11:42 davidg Exp $ |
65 */ 66 67/* 68 * Virtual memory object module. 69 */ 70 71#include <sys/param.h> 72#include <sys/systm.h> --- 406 unchanged lines hidden (view full) --- 479 * vm_object_page_clean 480 * 481 * Clean all dirty pages in the specified range of object. 482 * Leaves page on whatever queue it is currently on. 483 * 484 * Odd semantics: if start == end, we clean everything. 485 * 486 * The object must be locked. | 65 */ 66 67/* 68 * Virtual memory object module. 69 */ 70 71#include <sys/param.h> 72#include <sys/systm.h> --- 406 unchanged lines hidden (view full) --- 479 * vm_object_page_clean 480 * 481 * Clean all dirty pages in the specified range of object. 482 * Leaves page on whatever queue it is currently on. 483 * 484 * Odd semantics: if start == end, we clean everything. 485 * 486 * The object must be locked. |
487 * Returns true |
|
487 */ 488boolean_t 489vm_object_page_clean(object, start, end, syncio, de_queue) 490 register vm_object_t object; 491 register vm_offset_t start; 492 register vm_offset_t end; 493 boolean_t syncio; 494 boolean_t de_queue; 495{ 496 register vm_page_t p, nextp; 497 int size; | 488 */ 489boolean_t 490vm_object_page_clean(object, start, end, syncio, de_queue) 491 register vm_object_t object; 492 register vm_offset_t start; 493 register vm_offset_t end; 494 boolean_t syncio; 495 boolean_t de_queue; 496{ 497 register vm_page_t p, nextp; 498 int size; |
499 int s; |
|
498 499 if (object->pager == NULL) 500 return 1; 501 502 if (start != end) { 503 start = trunc_page(start); 504 end = round_page(end); 505 } 506 size = end - start; 507 508again: 509 /* 510 * Wait until the pageout daemon is through with the object. 511 */ | 500 501 if (object->pager == NULL) 502 return 1; 503 504 if (start != end) { 505 start = trunc_page(start); 506 end = round_page(end); 507 } 508 size = end - start; 509 510again: 511 /* 512 * Wait until the pageout daemon is through with the object. 513 */ |
514 s = splhigh(); |
|
512 while (object->paging_in_progress) { 513 object->flags |= OBJ_PIPWNT; 514 tsleep(object, PVM, "objpcw", 0); 515 } | 515 while (object->paging_in_progress) { 516 object->flags |= OBJ_PIPWNT; 517 tsleep(object, PVM, "objpcw", 0); 518 } |
519 splx(s); |
|
516 517 nextp = object->memq.tqh_first; 518 while ((p = nextp) && ((start == end) || (size != 0))) { 519 nextp = p->listq.tqe_next; 520 if (start == end || (p->offset >= start && p->offset < end)) { 521 if ((p->flags & PG_BUSY) || p->busy) { | 520 521 nextp = object->memq.tqh_first; 522 while ((p = nextp) && ((start == end) || (size != 0))) { 523 nextp = p->listq.tqe_next; 524 if (start == end || (p->offset >= start && p->offset < end)) { 525 if ((p->flags & PG_BUSY) || p->busy) { |
522 int s = splhigh(); | 526 s = splhigh(); |
523 524 p->flags |= PG_WANTED; 525 tsleep(p, PVM, "objpcn", 0); 526 splx(s); 527 goto again; 528 } 529 size -= PAGE_SIZE; 530 --- 1212 unchanged lines hidden --- | 527 528 p->flags |= PG_WANTED; 529 tsleep(p, PVM, "objpcn", 0); 530 splx(s); 531 goto again; 532 } 533 size -= PAGE_SIZE; 534 --- 1212 unchanged lines hidden --- |