From 18a6ac6ae4018dee1c69c6b7080630a8a024e2ea Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Mon, 5 Mar 2012 19:15:15 +0000 Subject: [PATCH] [NEWCC] - Don't allow a locked page to be paged out svn path=/trunk/; revision=56047 --- reactos/ntoskrnl/cache/section/swapout.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/reactos/ntoskrnl/cache/section/swapout.c b/reactos/ntoskrnl/cache/section/swapout.c index 1c6e4d73652..dcadefbe2bf 100644 --- a/reactos/ntoskrnl/cache/section/swapout.c +++ b/reactos/ntoskrnl/cache/section/swapout.c @@ -113,6 +113,13 @@ MmFinalizeSectionPageOut BOOLEAN WriteZero = FALSE, WritePage = FALSE; SWAPENTRY Swap = MmGetSavedSwapEntryPage(Page); + /* Bail early if the reference count isn't where we need it */ + if (MmGetReferenceCountPage(Page) != 1) + { + DPRINT1("Cannot page out locked page %x with ref count %d\n", Page, MmGetReferenceCountPage(Page)); + return STATUS_UNSUCCESSFUL; + } + MmLockSectionSegment(Segment); (void)InterlockedIncrementUL(&Segment->ReferenceCount); @@ -158,9 +165,6 @@ MmFinalizeSectionPageOut { DPRINT("Removing page %x for real\n", Page); MmSetSavedSwapEntryPage(Page, 0); - if (MmGetReferenceCountPage(Page) != 1) { - DPRINT1("ALERT: Page %x about to be evicted with ref count %d\n", Page, MmGetReferenceCountPage(Page)); - } MmReleasePageMemoryConsumer(MC_CACHE, Page); }