From 47b27e38f3183629d9bfc9ca3a4daf0efbc68d1c Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Wed, 12 May 2010 19:11:49 +0000 Subject: [PATCH] [NTOS]: Fix MiInsertPageInFreeList, it was using the ARM3 PFN Database macro, even though we are still using the Mm PFN Database. Also, it was lacking the code to notify the zero-page thread, and to increase available pages. svn path=/trunk/; revision=47178 --- reactos/ntoskrnl/mm/ARM3/pfnlist.c | 16 +++++++++++----- reactos/ntoskrnl/mm/freelist.c | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/reactos/ntoskrnl/mm/ARM3/pfnlist.c b/reactos/ntoskrnl/mm/ARM3/pfnlist.c index 3af1fef57ea..ff17eb0b3c8 100644 --- a/reactos/ntoskrnl/mm/ARM3/pfnlist.c +++ b/reactos/ntoskrnl/mm/ARM3/pfnlist.c @@ -466,7 +466,7 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) (PageFrameIndex >= MmLowestPhysicalPage)); /* Get the PFN entry */ - Pfn1 = MI_PFN_TO_PFNENTRY(PageFrameIndex); + Pfn1 = MiGetPfnEntry(PageFrameIndex); /* Sanity checks that a right kind of page is being inserted here */ ASSERT(Pfn1->u4.MustBeCached == 0); @@ -484,7 +484,7 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) if (LastPage != LIST_HEAD) { /* Link us with the previous page, so we're at the end now */ - MI_PFN_TO_PFNENTRY(LastPage)->u1.Flink = PageFrameIndex; + MiGetPfnEntry(LastPage)->u1.Flink = PageFrameIndex; } else { @@ -507,8 +507,8 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) Pfn1->u4.InPageError = 0; Pfn1->u4.AweAllocation = 0; - /* Not yet until we switch to this */ - //MmAvailablePages++; + /* Increase available pages */ + MmAvailablePages++; /* Check if we've reached the configured low memory threshold */ if (MmAvailablePages == MmLowMemoryThreshold) @@ -552,7 +552,13 @@ MiInsertPageInFreeList(IN PFN_NUMBER PageFrameIndex) ColorTable->Count++; #endif - /* FIXME: Notify zero page thread if enough pages are on the free list now */ + /* Notify zero page thread if enough pages are on the free list now */ + extern KEVENT ZeroPageThreadEvent; + if ((MmFreePageListHead.Total > 8) && !(KeReadStateEvent(&ZeroPageThreadEvent))) + { + /* This is ReactOS-specific */ + KeSetEvent(&ZeroPageThreadEvent, IO_NO_INCREMENT, FALSE); + } } /* EOF */ diff --git a/reactos/ntoskrnl/mm/freelist.c b/reactos/ntoskrnl/mm/freelist.c index 7107e1e05a1..80694e368df 100644 --- a/reactos/ntoskrnl/mm/freelist.c +++ b/reactos/ntoskrnl/mm/freelist.c @@ -49,7 +49,7 @@ SIZE_T MmPagedPoolCommit; SIZE_T MmPeakCommitment; SIZE_T MmtotalCommitLimitMaximum; -static KEVENT ZeroPageThreadEvent; +KEVENT ZeroPageThreadEvent; static BOOLEAN ZeroPageThreadShouldTerminate = FALSE; static RTL_BITMAP MiUserPfnBitMap;