[ros-diffs] [sir_richard] 47178: [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.

sir_richard at svn.reactos.org sir_richard at svn.reactos.org
Wed May 12 21:11:49 CEST 2010


Author: sir_richard
Date: Wed May 12 21:11:49 2010
New Revision: 47178

URL: http://svn.reactos.org/svn/reactos?rev=47178&view=rev
Log:
[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.

Modified:
    trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c
    trunk/reactos/ntoskrnl/mm/freelist.c

Modified: trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c?rev=47178&r1=47177&r2=47178&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/pfnlist.c [iso-8859-1] Wed May 12 21:11:49 2010
@@ -466,7 +466,7 @@
            (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 @@
     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 @@
     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 @@
     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 */

Modified: trunk/reactos/ntoskrnl/mm/freelist.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/freelist.c?rev=47178&r1=47177&r2=47178&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] Wed May 12 21:11:49 2010
@@ -49,7 +49,7 @@
 SIZE_T MmPeakCommitment; 
 SIZE_T MmtotalCommitLimitMaximum;
 
-static KEVENT ZeroPageThreadEvent;
+KEVENT ZeroPageThreadEvent;
 static BOOLEAN ZeroPageThreadShouldTerminate = FALSE;
 static RTL_BITMAP MiUserPfnBitMap;
 




More information about the Ros-diffs mailing list