Author: cgutman
Date: Tue Feb 28 08:34:16 2012
New Revision: 55897

URL: http://svn.reactos.org/svn/reactos?rev=55897&view=rev
Log:
[NTOSKRNL]
- Change MmDereferencePage to MmReleasePageMemoryConsumer to do proper page 
usage tracking
- Remove an unnecessary reference and dereference

Modified:
    trunk/reactos/ntoskrnl/cache/section/data.c
    trunk/reactos/ntoskrnl/cache/section/swapout.c

Modified: trunk/reactos/ntoskrnl/cache/section/data.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/data.c?rev=55897&r1=55896&r2=55897&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/data.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/data.c [iso-8859-1] Tue Feb 28 
08:34:16 2012
@@ -278,7 +278,7 @@
                                         &Segment->FileObject->FileName,
                                         Status);
                        }
-                       MmDereferencePage(Page);
+                       MmReleasePageMemoryConsumer(MC_CACHE, Page);
                }
        }
 

Modified: trunk/reactos/ntoskrnl/cache/section/swapout.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/swapout.c?rev=55897&r1=55896&r2=55897&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] Tue Feb 28 
08:34:16 2012
@@ -157,11 +157,10 @@
        {
                DPRINT("Removing page %x for real\n", Page);
                MmSetSavedSwapEntryPage(Page, 0);
-               // Note: the other one is held by MmTrimUserMemory
-               if (MmGetReferenceCountPage(Page) != 2) {
+               if (MmGetReferenceCountPage(Page) != 1) {
                        DPRINT1("ALERT: Page %x about to be evicted with ref 
count %d\n", Page, MmGetReferenceCountPage(Page));
                }
-               MmDereferencePage(Page);
+               MmReleasePageMemoryConsumer(MC_CACHE, Page);
        }
 
        MmUnlockSectionSegment(Segment);
@@ -216,7 +215,7 @@
 
        if (NT_SUCCESS(Status)) 
        {
-               MmDereferencePage(Required->Page[0]);
+               MmReleasePageMemoryConsumer(MC_CACHE, Required->Page[0]);
        } 
 
        MmUnlockSectionSegment(Segment);
@@ -461,13 +460,11 @@
                        Entry = MmGetPageEntrySectionSegment(Segment, &Offset);
                        if (Entry && !IS_SWAP_FROM_SSE(Entry)) {
                                Page = PFN_FROM_SSE(Entry);
-                               MmReferencePage(Page);
                                MmUnlockSectionSegment(Segment);
                                Status = MmpPageOutPhysicalAddress(Page);
                                if (NT_SUCCESS(Status))
                                        Result++;
                                MmLockSectionSegment(Segment);
-                               MmReleasePageMemoryConsumer(MC_CACHE, Page);
                        }
                }
        }


Reply via email to