Author: cgutman Date: Mon Mar 5 19:15:15 2012 New Revision: 56047
URL: http://svn.reactos.org/svn/reactos?rev=56047&view=rev Log: [NEWCC] - Don't allow a locked page to be paged out
Modified: trunk/reactos/ntoskrnl/cache/section/swapout.c
Modified: trunk/reactos/ntoskrnl/cache/section/swapout.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/cache/section/swap... ============================================================================== --- trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/cache/section/swapout.c [iso-8859-1] Mon Mar 5 19:15:15 2012 @@ -113,6 +113,13 @@ 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 @@ { 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); }