diff options
author | alc <alc@FreeBSD.org> | 2002-12-18 04:02:02 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2002-12-18 04:02:02 +0000 |
commit | a0ec4e567056f7171d897a337bb918a3bdf26ddd (patch) | |
tree | 5d52ca139406c9c1e508e084441bf0e5b4009813 /sys/vm | |
parent | 345fe7ca1fc1ac7cd3fb8480e6c130cfc68292a3 (diff) | |
download | FreeBSD-src-a0ec4e567056f7171d897a337bb918a3bdf26ddd.zip FreeBSD-src-a0ec4e567056f7171d897a337bb918a3bdf26ddd.tar.gz |
Hold the page queues lock when performing vm_page_flag_set().
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/swap_pager.c | 8 | ||||
-rw-r--r-- | sys/vm/vm_pageout.c | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 2f43bc4..78d9849 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -1107,6 +1107,7 @@ swap_pager_getpages(object, m, count, reqpage) bp->b_bufsize = PAGE_SIZE * (j - i); bp->b_pager.pg_reqpage = reqpage - i; + vm_page_lock_queues(); { int k; @@ -1115,6 +1116,7 @@ swap_pager_getpages(object, m, count, reqpage) vm_page_flag_set(m[k], PG_SWAPINPROG); } } + vm_page_unlock_queues(); bp->b_npages = j - i; pbgetvp(swapdev_vp, bp); @@ -1149,10 +1151,11 @@ swap_pager_getpages(object, m, count, reqpage) * is set in the meta-data. */ s = splvm(); + vm_page_lock_queues(); while ((mreq->flags & PG_SWAPINPROG) != 0) { vm_page_flag_set(mreq, PG_WANTED | PG_REFERENCED); cnt.v_intrans++; - if (tsleep(mreq, PSWP, "swread", hz*20)) { + if (msleep(mreq, &vm_page_queue_mtx, PSWP, "swread", hz*20)) { printf( "swap_pager: indefinite wait buffer: device:" " %s, blkno: %ld, size: %ld\n", @@ -1161,6 +1164,7 @@ swap_pager_getpages(object, m, count, reqpage) ); } } + vm_page_unlock_queues(); splx(s); /* @@ -1358,7 +1362,9 @@ swap_pager_putpages(object, m, count, sync, rtvals) vm_page_dirty(mreq); rtvals[i+j] = VM_PAGER_OK; + vm_page_lock_queues(); vm_page_flag_set(mreq, PG_SWAPINPROG); + vm_page_unlock_queues(); bp->b_pages[j] = mreq; } bp->b_npages = n; diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index d81d581..924909c 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -857,8 +857,10 @@ rescan0: * before being freed. This significantly extends * the thrash point for a heavily loaded machine. */ + vm_page_lock_queues(); vm_page_flag_set(m, PG_WINATCFLS); vm_pageq_requeue(m); + vm_page_unlock_queues(); } else if (maxlaunder > 0) { /* * We always want to try to flush some dirty pages if |