Patch by Zhao Shuai with some modifications by myself:

* Renamed sModifiedTemporaryPages to sModifiedNoSwapPages to better
  express what this variable is about.
* Changed tracking of sModifiedNoSwapPages. It really counts
  non-swappable pages only, now (if swap support is enabled).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26641 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-07-26 14:39:05 +00:00
parent c53e844a89
commit 134a2fd160
+23 -11
View File
@@ -58,7 +58,7 @@ static addr_t sPhysicalPageOffset;
static size_t sNumPages; static size_t sNumPages;
static size_t sReservedPages; static size_t sReservedPages;
static vint32 sPageDeficit; static vint32 sPageDeficit;
static size_t sModifiedTemporaryPages; static size_t sModifiedNoSwapPages;
static ConditionVariable sFreePageCondition; static ConditionVariable sFreePageCondition;
static spinlock sPageLock; static spinlock sPageLock;
@@ -621,8 +621,8 @@ dump_page_stats(int argc, char **argv)
sFreePageQueue.count); sFreePageQueue.count);
kprintf("clear queue: %p, count = %ld\n", &sClearPageQueue, kprintf("clear queue: %p, count = %ld\n", &sClearPageQueue,
sClearPageQueue.count); sClearPageQueue.count);
kprintf("modified queue: %p, count = %ld (%ld temporary)\n", kprintf("modified queue: %p, count = %ld (%ld no_swap)\n",
&sModifiedPageQueue, sModifiedPageQueue.count, sModifiedTemporaryPages); &sModifiedPageQueue, sModifiedPageQueue.count, sModifiedNoSwapPages);
kprintf("active queue: %p, count = %ld\n", &sActivePageQueue, kprintf("active queue: %p, count = %ld\n", &sActivePageQueue,
sActivePageQueue.count); sActivePageQueue.count);
kprintf("inactive queue: %p, count = %ld\n", &sInactivePageQueue, kprintf("inactive queue: %p, count = %ld\n", &sInactivePageQueue,
@@ -708,11 +708,15 @@ set_page_state_nolock(vm_page *page, int pageState)
if (pageState != PAGE_STATE_INACTIVE && page->cache != NULL) if (pageState != PAGE_STATE_INACTIVE && page->cache != NULL)
panic("to be freed page %p has cache", page); panic("to be freed page %p has cache", page);
} }
if (page->cache != NULL && page->cache->temporary) { if (page->cache != NULL && page->cache->temporary
#if ENABLE_SWAP_SUPPORT
&& page->wired_count > 0
#endif
) {
if (pageState == PAGE_STATE_MODIFIED) if (pageState == PAGE_STATE_MODIFIED)
sModifiedTemporaryPages++; sModifiedNoSwapPages++;
else if (page->state == PAGE_STATE_MODIFIED) else if (page->state == PAGE_STATE_MODIFIED)
sModifiedTemporaryPages--; sModifiedNoSwapPages--;
} }
#ifdef PAGE_ALLOCATION_TRACING #ifdef PAGE_ALLOCATION_TRACING
@@ -747,8 +751,12 @@ move_page_to_active_or_inactive_queue(vm_page *page, bool dequeued)
page->state = state; page->state = state;
enqueue_page(state == PAGE_STATE_ACTIVE enqueue_page(state == PAGE_STATE_ACTIVE
? &sActivePageQueue : &sInactivePageQueue, page); ? &sActivePageQueue : &sInactivePageQueue, page);
if (page->cache->temporary) if (page->cache->temporary) {
sModifiedTemporaryPages--; #if ENABLE_SWAP_SUPPORT
if (page->wired_count > 0)
#endif
sModifiedNoSwapPages--;
}
} else } else
set_page_state_nolock(page, state); set_page_state_nolock(page, state);
} }
@@ -953,7 +961,7 @@ page_writer(void* /*unused*/)
marker.state = PAGE_STATE_UNUSED; marker.state = PAGE_STATE_UNUSED;
while (true) { while (true) {
if (sModifiedPageQueue.count - sModifiedTemporaryPages < 1024) { if (sModifiedPageQueue.count - sModifiedNoSwapPages < 1024) {
int32 count = 0; int32 count = 0;
get_sem_count(sWriterWaitSem, &count); get_sem_count(sWriterWaitSem, &count);
if (count == 0) if (count == 0)
@@ -1819,8 +1827,12 @@ vm_page_free(vm_cache *cache, vm_page *page)
InterruptsSpinLocker _(sPageLock); InterruptsSpinLocker _(sPageLock);
if (page->cache == NULL && page->state == PAGE_STATE_MODIFIED if (page->cache == NULL && page->state == PAGE_STATE_MODIFIED
&& cache->temporary) && cache->temporary) {
sModifiedTemporaryPages--; #if ENABLE_SWAP_SUPPORT
if (page->wired_count > 0)
#endif
sModifiedNoSwapPages--;
}
set_page_state_nolock(page, PAGE_STATE_FREE); set_page_state_nolock(page, PAGE_STATE_FREE);
} }