From 24264b8dc284fd26bf5d8d4cfb97b6861598d550 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 28 Feb 2012 08:34:16 +0000 Subject: [PATCH] [NTOSKRNL] - Change MmDereferencePage to MmReleasePageMemoryConsumer to do proper page usage tracking - Remove an unnecessary reference and dereference svn path=/trunk/; revision=55897 --- reactos/ntoskrnl/cache/section/data.c | 2 +- reactos/ntoskrnl/cache/section/swapout.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/reactos/ntoskrnl/cache/section/data.c b/reactos/ntoskrnl/cache/section/data.c index 3a8f5a30fd5..91c63e03405 100644 --- a/reactos/ntoskrnl/cache/section/data.c +++ b/reactos/ntoskrnl/cache/section/data.c @@ -278,7 +278,7 @@ _MiFlushMappedSection &Segment->FileObject->FileName, Status); } - MmDereferencePage(Page); + MmReleasePageMemoryConsumer(MC_CACHE, Page); } } diff --git a/reactos/ntoskrnl/cache/section/swapout.c b/reactos/ntoskrnl/cache/section/swapout.c index e298a75e767..daea8a81296 100644 --- a/reactos/ntoskrnl/cache/section/swapout.c +++ b/reactos/ntoskrnl/cache/section/swapout.c @@ -157,11 +157,10 @@ MmFinalizeSectionPageOut { 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 @@ MmPageOutCacheSection if (NT_SUCCESS(Status)) { - MmDereferencePage(Required->Page[0]); + MmReleasePageMemoryConsumer(MC_CACHE, Required->Page[0]); } MmUnlockSectionSegment(Segment); @@ -461,13 +460,11 @@ MiCacheEvictPages(PMM_SECTION_SEGMENT Segment, ULONG Target) 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); } } }