From 3539fc6e191942dbc454cec7155c5a2540d9455c Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Fri, 17 Apr 2009 14:26:17 +0000 Subject: [PATCH] page writer: * When writing a page failed it is not a good idea to re-enqueue it at the tail of the modified queue, since that is definitely behind the page writer's marker and the page would be picked up again before reaching the end of the queue. If that happened with more than 256 pages, the page writer would keep picking up only those non-writable pages and make no more progress. * When selecting pages also skip temporary pages, if there's no more swap space available, since trying to write those pages would most likely fail anyway (triggering the first problem). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30230 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/vm_page.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/vm/vm_page.cpp b/src/system/kernel/vm/vm_page.cpp index 65578caa21..4c3a16af77 100644 --- a/src/system/kernel/vm/vm_page.cpp +++ b/src/system/kernel/vm/vm_page.cpp @@ -32,6 +32,7 @@ #include #include +#include "VMAnonymousCache.h" #include "IORequest.h" #include "PageCacheLocker.h" @@ -1120,7 +1121,9 @@ PageWriterRun::Go() { InterruptsSpinLocker locker(sPageLock); page->state = PAGE_STATE_MODIFIED; - enqueue_page(&sModifiedPageQueue, page); + enqueue_page_to_head(&sModifiedPageQueue, page); + // Enqueue to the head, so we don't put it behind the + // page writer's marker again. } if (!page->busy_writing) { @@ -1243,7 +1246,8 @@ page_writer(void* /*unused*/) if (page->wired_count > 0 || (cache->temporary #if ENABLE_SWAP_SUPPORT - && (!lowOnPages /*|| page->usage_count > 0*/) + && (!lowOnPages /*|| page->usage_count > 0*/ + || swap_available_pages() == 0) #endif )) { continue;