summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_contig.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2010-05-06 04:57:33 +0000
committerkib <kib@FreeBSD.org>2010-05-06 04:57:33 +0000
commit99fafb0cededdbb037eba3a3a0b21ce36481d832 (patch)
treeb0708fbfab991d9936b1dbd4c8788203ed87c301 /sys/vm/vm_contig.c
parent76fc3e2dd04efb46c3b0c9d67c4287f017df3c40 (diff)
downloadFreeBSD-src-99fafb0cededdbb037eba3a3a0b21ce36481d832.zip
FreeBSD-src-99fafb0cededdbb037eba3a3a0b21ce36481d832.tar.gz
Add a helper function vm_pageout_page_lock(), similar to tegge'
vm_pageout_fallback_object_lock(), to obtain the page lock while having page queue lock locked, and still maintain the page position in a queue. Use the helper to lock the page in the pageout daemon and contig launder iterators instead of skipping the page if its lock is contested. Skipping locked pages easily causes pagedaemon or launder to not make a progress with page cleaning. Proposed and reviewed by: alc
Diffstat (limited to 'sys/vm/vm_contig.c')
-rw-r--r--sys/vm/vm_contig.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/vm/vm_contig.c b/sys/vm/vm_contig.c
index c1c8618..1286c17 100644
--- a/sys/vm/vm_contig.c
+++ b/sys/vm/vm_contig.c
@@ -168,8 +168,10 @@ vm_contig_launder(int queue)
if ((m->flags & PG_MARKER) != 0)
continue;
- if (!vm_page_trylock(m))
- continue;
+ if (!vm_pageout_page_lock(m, &next)) {
+ vm_page_unlock(m);
+ return (FALSE);
+ }
KASSERT(VM_PAGE_INQUEUE2(m, queue),
("vm_contig_launder: page %p's queue is not %d", m, queue));
error = vm_contig_launder_page(m, &next);
OpenPOWER on IntegriCloud