From 9e8a4109b0218b3068f3ed8113b47ddf097a641b Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Fri, 24 Dec 2010 22:54:24 +0000 Subject: [PATCH] Make sure to initialize our page operation mutex. Scan the whole range of the MemoryArea for pages to evict. This fixes cache section page eviction. svn path=/trunk/; revision=50134 --- reactos/ntoskrnl/cache/fssup.c | 2 ++ reactos/ntoskrnl/cache/section/swapout.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/cache/fssup.c b/reactos/ntoskrnl/cache/fssup.c index f436e744b1e..4af45ec85f1 100644 --- a/reactos/ntoskrnl/cache/fssup.c +++ b/reactos/ntoskrnl/cache/fssup.c @@ -25,6 +25,7 @@ extern VOID NTAPI CcpUnmapThread(PVOID Unused); extern VOID NTAPI CcpLazyWriteThread(PVOID Unused); HANDLE CcUnmapThreadHandle, CcLazyWriteThreadHandle; CLIENT_ID CcUnmapThreadId, CcLazyWriteThreadId; +FAST_MUTEX GlobalPageOperation; typedef struct _NOCC_PRIVATE_CACHE_MAP { @@ -98,6 +99,7 @@ CcInitializeCacheManager(VOID) CcCacheBitmap->SizeOfBitMap = ROUND_UP(CACHE_NUM_SECTIONS, 32); DPRINT("Cache has %d entries\n", CcCacheBitmap->SizeOfBitMap); ExInitializeFastMutex(&CcMutex); + ExInitializeFastMutex(&GlobalPageOperation); // MM stub KeInitializeEvent(&MmWaitPageEvent, SynchronizationEvent, FALSE); diff --git a/reactos/ntoskrnl/cache/section/swapout.c b/reactos/ntoskrnl/cache/section/swapout.c index 685104e3d64..691635dc58d 100644 --- a/reactos/ntoskrnl/cache/section/swapout.c +++ b/reactos/ntoskrnl/cache/section/swapout.c @@ -480,8 +480,8 @@ MiCacheEvictPages(PVOID BaseAddress, ULONG Target) MmLockCacheSectionSegment(Segment); for (i = 0; - i < Segment->Length.QuadPart - - MemoryArea->Data.CacheData.ViewOffset.QuadPart && + i < ((ULONG_PTR)MemoryArea->EndingAddress) - + ((ULONG_PTR)MemoryArea->StartingAddress) && Result < Target; i += PAGE_SIZE) { Offset.QuadPart = MemoryArea->Data.CacheData.ViewOffset.QuadPart + i;