1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

Only do object paging_in_progress wakeups if someone is waiting on this

condition.

Submitted by:	John Dyson
This commit is contained in:
David Greenman 1995-02-22 09:15:35 +00:00
parent 50ce2102e1
commit c0503609a0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=6618
6 changed files with 70 additions and 22 deletions

View File

@ -39,7 +39,7 @@
* from: Utah $Hdr: swap_pager.c 1.4 91/04/30$
*
* @(#)swap_pager.c 8.9 (Berkeley) 3/21/94
* $Id: swap_pager.c,v 1.25 1995/02/02 09:08:00 davidg Exp $
* $Id: swap_pager.c,v 1.26 1995/02/21 01:22:44 davidg Exp $
*/
/*
@ -1608,8 +1608,12 @@ swap_pager_finish(spc)
vm_object_t object = spc->spc_m[0]->object;
int i;
if ((object->paging_in_progress -= spc->spc_count) == 0)
object->paging_in_progress -= spc->spc_count;
if ((object->paging_in_progress == 0) &&
(object->flags & OBJ_PIPWNT)) {
object->flags &= ~OBJ_PIPWNT;
thread_wakeup((int) object);
}
/*
* If no error mark as clean and inform the pmap system. If error,

View File

@ -66,7 +66,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_fault.c,v 1.17 1995/01/26 01:40:04 davidg Exp $
* $Id: vm_fault.c,v 1.18 1995/02/02 09:08:17 davidg Exp $
*/
/*
@ -165,15 +165,21 @@ vm_fault(map, vaddr, fault_type, change_wiring)
#define UNLOCK_THINGS { \
object->paging_in_progress--; \
if (object->paging_in_progress == 0) \
if ((object->paging_in_progress == 0) && \
(object->flags & OBJ_PIPWNT)) { \
object->flags &= ~OBJ_PIPWNT; \
wakeup((caddr_t)object); \
} \
vm_object_unlock(object); \
if (object != first_object) { \
vm_object_lock(first_object); \
FREE_PAGE(first_m); \
first_object->paging_in_progress--; \
if (first_object->paging_in_progress == 0) \
if ((first_object->paging_in_progress == 0) && \
(first_object->flags & OBJ_PIPWNT)) { \
first_object->flags &= ~OBJ_PIPWNT; \
wakeup((caddr_t)first_object); \
} \
vm_object_unlock(first_object); \
} \
UNLOCK_MAP; \
@ -441,8 +447,11 @@ RetryFault:;
*/
if (object != first_object) {
object->paging_in_progress--;
if (object->paging_in_progress == 0)
if (object->paging_in_progress == 0 &&
(object->flags & OBJ_PIPWNT)) {
object->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) object);
}
vm_object_unlock(object);
object = first_object;
@ -460,8 +469,11 @@ RetryFault:;
vm_object_lock(next_object);
if (object != first_object) {
object->paging_in_progress--;
if (object->paging_in_progress == 0)
if (object->paging_in_progress == 0 &&
(object->flags & OBJ_PIPWNT)) {
object->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) object);
}
}
vm_object_unlock(object);
object = next_object;
@ -539,8 +551,11 @@ RetryFault:;
*/
PAGE_WAKEUP(m);
object->paging_in_progress--;
if (object->paging_in_progress == 0)
if (object->paging_in_progress == 0 &&
(object->flags & OBJ_PIPWNT)) {
object->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) object);
}
vm_object_unlock(object);
/*
@ -562,8 +577,11 @@ RetryFault:;
* paging_in_progress to do that...
*/
object->paging_in_progress--;
if (object->paging_in_progress == 0)
if (object->paging_in_progress == 0 &&
(object->flags & OBJ_PIPWNT)) {
object->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) object);
}
vm_object_collapse(object);
object->paging_in_progress++;
} else {

View File

@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_object.c,v 1.24 1995/02/20 14:21:58 davidg Exp $
* $Id: vm_object.c,v 1.25 1995/02/21 01:22:47 davidg Exp $
*/
/*
@ -270,11 +270,13 @@ vm_object_deallocate(object)
do {
s = splhigh();
while( robject->paging_in_progress) {
while (robject->paging_in_progress) {
robject->flags |= OBJ_PIPWNT;
tsleep(robject, PVM, "objde1", 0);
}
while( object->paging_in_progress) {
while (object->paging_in_progress) {
object->flags |= OBJ_PIPWNT;
tsleep(object, PVM, "objde2", 0);
}
splx(s);
@ -379,6 +381,7 @@ vm_object_terminate(object)
s = splhigh();
while (object->paging_in_progress) {
vm_object_unlock(object);
object->flags |= OBJ_PIPWNT;
tsleep((caddr_t) object, PVM, "objtrm", 0);
vm_object_lock(object);
}
@ -494,6 +497,7 @@ vm_object_page_clean(object, start, end, syncio, de_queue)
* Wait until the pageout daemon is through with the object.
*/
while (object->paging_in_progress) {
object->flags |= OBJ_PIPWNT;
tsleep(object, PVM, "objpcw", 0);
}
@ -776,8 +780,10 @@ vm_object_pmap_remove(object, start, end)
}
vm_object_unlock(object);
--object->paging_in_progress;
if (object->paging_in_progress == 0)
if (object->paging_in_progress == 0 && (object->flags & OBJ_PIPWNT)) {
object->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) object);
}
}
/*
@ -1406,8 +1412,11 @@ vm_object_collapse(object)
object->pager, object->paging_offset,
object->shadow_offset);
object->paging_in_progress--;
if (object->paging_in_progress == 0)
if (object->paging_in_progress == 0 &&
(object->flags & OBJ_PIPWNT)) {
object->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) object);
}
} else {
object->paging_in_progress++;
/*
@ -1422,12 +1431,19 @@ vm_object_collapse(object)
*/
swap_pager_freespace(object->pager, 0, object->paging_offset);
object->paging_in_progress--;
if (object->paging_in_progress == 0)
if (object->paging_in_progress == 0 &&
(object->flags & OBJ_PIPWNT)) {
object->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) object);
}
}
backing_object->paging_in_progress--;
if (backing_object->paging_in_progress == 0)
if (backing_object->paging_in_progress == 0 &&
(backing_object->flags & OBJ_PIPWNT)) {
backing_object->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) backing_object);
}
}
/*
* Object now shadows whatever backing_object did.
@ -1630,8 +1646,10 @@ vm_object_page_remove(object, start, end)
}
}
--object->paging_in_progress;
if (object->paging_in_progress == 0)
if (object->paging_in_progress == 0 && (object->flags & OBJ_PIPWNT)) {
object->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) object);
}
}
/*

View File

@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_object.h,v 1.5 1995/01/24 10:13:24 davidg Exp $
* $Id: vm_object.h,v 1.6 1995/02/02 09:08:56 davidg Exp $
*/
/*
@ -112,6 +112,7 @@ struct vm_object {
#define OBJ_DEAD 0x0008 /* used to mark dead objects during rundown */
#define OBJ_ILOCKED 0x0010 /* lock from modification */
#define OBJ_ILOCKWT 0x0020 /* wait for lock from modification */
#define OBJ_PIPWNT 0x0040 /* paging in progress wanted */
TAILQ_HEAD(vm_object_hash_head, vm_object_hash_entry);

View File

@ -65,7 +65,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_pageout.c,v 1.35 1995/02/14 06:09:15 phk Exp $
* $Id: vm_pageout.c,v 1.36 1995/02/20 23:35:45 davidg Exp $
*/
/*
@ -290,8 +290,11 @@ vm_pageout_clean(m, sync)
* collapse.
*/
if (pageout_status[i] != VM_PAGER_PEND) {
if (--object->paging_in_progress == 0)
if ((--object->paging_in_progress == 0) &&
(object->flags & OBJ_PIPWNT)) {
object->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) object);
}
if ((ms[i]->flags & (PG_REFERENCED|PG_WANTED)) ||
pmap_is_referenced(VM_PAGE_TO_PHYS(ms[i]))) {
pmap_clear_reference(VM_PAGE_TO_PHYS(ms[i]));

View File

@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* from: @(#)vnode_pager.c 7.5 (Berkeley) 4/20/91
* $Id: vnode_pager.c,v 1.22 1995/02/03 06:46:28 davidg Exp $
* $Id: vnode_pager.c,v 1.23 1995/02/21 01:22:48 davidg Exp $
*/
/*
@ -225,6 +225,7 @@ vnode_pager_dealloc(pager)
object = (vm_object_t) vp->v_vmdata;
if (object) {
while (object->paging_in_progress) {
object->flags |= OBJ_PIPWNT;
tsleep(object, PVM, "vnpdea", 0);
}
}
@ -565,8 +566,11 @@ vnode_pager_iodone(bp)
pmap_qremove(paddr, npages);
if (obj) {
--obj->paging_in_progress;
if (obj->paging_in_progress == 0)
if (obj->paging_in_progress == 0 &&
(obj->flags & OBJ_PIPWNT)) {
obj->flags &= ~OBJ_PIPWNT;
wakeup((caddr_t) obj);
}
} else {
panic("vnode_pager_iodone: object is gone???");
}