vm_object.c (17334) | vm_object.c (17761) |
---|---|
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.77 1996/07/27 03:24:03 dyson Exp $ | 64 * $Id: vm_object.c,v 1.78 1996/07/30 03:08:14 dyson Exp $ |
65 */ 66 67/* 68 * Virtual memory object module. 69 */ 70#include "opt_ddb.h" 71 72#include <sys/param.h> --- 153 unchanged lines hidden (view full) --- 226} 227 228 229/* 230 * vm_object_reference: 231 * 232 * Gets another reference to the given object. 233 */ | 65 */ 66 67/* 68 * Virtual memory object module. 69 */ 70#include "opt_ddb.h" 71 72#include <sys/param.h> --- 153 unchanged lines hidden (view full) --- 226} 227 228 229/* 230 * vm_object_reference: 231 * 232 * Gets another reference to the given object. 233 */ |
234inline void | 234void |
235vm_object_reference(object) 236 register vm_object_t object; 237{ 238 if (object == NULL) 239 return; 240 241 if (object->ref_count == 0) { 242 if ((object->flags & OBJ_CANPERSIST) == 0) --- 84 unchanged lines hidden (view full) --- 327 } 328 329 /* 330 * See if this object can persist and has some resident 331 * pages. If so, enter it in the cache. 332 */ 333 if (object->flags & OBJ_CANPERSIST) { 334 if (object->resident_page_count != 0) { | 235vm_object_reference(object) 236 register vm_object_t object; 237{ 238 if (object == NULL) 239 return; 240 241 if (object->ref_count == 0) { 242 if ((object->flags & OBJ_CANPERSIST) == 0) --- 84 unchanged lines hidden (view full) --- 327 } 328 329 /* 330 * See if this object can persist and has some resident 331 * pages. If so, enter it in the cache. 332 */ 333 if (object->flags & OBJ_CANPERSIST) { 334 if (object->resident_page_count != 0) { |
335#if 0 |
|
335 vm_object_page_clean(object, 0, 0 ,TRUE, TRUE); | 336 vm_object_page_clean(object, 0, 0 ,TRUE, TRUE); |
337#endif |
|
336 TAILQ_INSERT_TAIL(&vm_object_cached_list, object, 337 cached_list); 338 vm_object_cached++; 339 340 vm_object_cache_trim(); 341 return; 342 } else { 343 object->flags &= ~OBJ_CANPERSIST; --- 43 unchanged lines hidden (view full) --- 387 panic("vm_object_deallocate: pageout in progress"); 388 389 /* 390 * Clean and free the pages, as appropriate. All references to the 391 * object are gone, so we don't need to lock it. 392 */ 393 if (object->type == OBJT_VNODE) { 394 struct vnode *vp = object->handle; | 338 TAILQ_INSERT_TAIL(&vm_object_cached_list, object, 339 cached_list); 340 vm_object_cached++; 341 342 vm_object_cache_trim(); 343 return; 344 } else { 345 object->flags &= ~OBJ_CANPERSIST; --- 43 unchanged lines hidden (view full) --- 389 panic("vm_object_deallocate: pageout in progress"); 390 391 /* 392 * Clean and free the pages, as appropriate. All references to the 393 * object are gone, so we don't need to lock it. 394 */ 395 if (object->type == OBJT_VNODE) { 396 struct vnode *vp = object->handle; |
397 int waslocked; |
|
395 | 398 |
396 VOP_LOCK(vp); | 399 waslocked = VOP_ISLOCKED(vp); 400 if (!waslocked) 401 VOP_LOCK(vp); |
397 vm_object_page_clean(object, 0, 0, TRUE, FALSE); 398 vinvalbuf(vp, V_SAVE, NOCRED, NULL, 0, 0); | 402 vm_object_page_clean(object, 0, 0, TRUE, FALSE); 403 vinvalbuf(vp, V_SAVE, NOCRED, NULL, 0, 0); |
399 VOP_UNLOCK(vp); | 404 if (!waslocked) 405 VOP_UNLOCK(vp); |
400 } 401 /* 402 * Now free the pages. For internal objects, this also removes them 403 * from paging queues. 404 */ 405 while ((p = TAILQ_FIRST(&object->memq)) != NULL) { 406 if (p->flags & PG_BUSY) 407 printf("vm_object_terminate: freeing busy page\n"); --- 1074 unchanged lines hidden --- | 406 } 407 /* 408 * Now free the pages. For internal objects, this also removes them 409 * from paging queues. 410 */ 411 while ((p = TAILQ_FIRST(&object->memq)) != NULL) { 412 if (p->flags & PG_BUSY) 413 printf("vm_object_terminate: freeing busy page\n"); --- 1074 unchanged lines hidden --- |