Author: mbosma Date: Thu Jul 27 12:21:54 2006 New Revision: 23312
URL: http://svn.reactos.org/svn/reactos?rev=23312&view=rev Log: Page out the pages when they are not dirty. They were not freed at all before.
Modified: branches/cache_manager_rewrite/mm/freelist.c branches/cache_manager_rewrite/mm/section.c
Modified: branches/cache_manager_rewrite/mm/freelist.c URL: http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/freelis... ============================================================================== --- branches/cache_manager_rewrite/mm/freelist.c (original) +++ branches/cache_manager_rewrite/mm/freelist.c Thu Jul 27 12:21:54 2006 @@ -981,6 +981,12 @@ return MmPageArray[Pfn].ShareCount; }
+ULONG +MmGetMemoryConsumerPage(PFN_TYPE Pfn) +{ + return MmPageArray[Pfn].Flags.Consumer; +} + PFN_TYPE NTAPI MmAllocPage(ULONG Consumer, SWAPENTRY SavedSwapEntry)
Modified: branches/cache_manager_rewrite/mm/section.c URL: http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/section... ============================================================================== --- branches/cache_manager_rewrite/mm/section.c (original) +++ branches/cache_manager_rewrite/mm/section.c Thu Jul 27 12:21:54 2006 @@ -125,6 +125,9 @@ ULONG MmGetShareCountPage(PFN_TYPE Pfn);
+ULONG +MmGetMemoryConsumerPage (PFN_TYPE Pfn); + ULONG NTAPI MmGetPageEntrySectionSegment(PMM_SECTION_SEGMENT Segment, @@ -564,6 +567,7 @@ { ULONG Entry; ULONG ShareCount; + ULONG Consumer; PFN_TYPE Page;
Entry = MmGetPageEntrySectionSegment(Segment, Offset); @@ -578,6 +582,7 @@ KEBUGCHECK(0); } Page = PFN_FROM_SSE(Entry); + Consumer = MmGetMemoryConsumerPage(Page); /* * If we reducing the share count of this entry to zero then set the entry * to zero and tell the cache the page is no longer mapped. @@ -599,7 +604,8 @@ if (PageOut) { MmSetPageEntrySectionSegment(Segment, Offset, 0); - MmReleasePageMemoryConsumer(MC_USER, Page); + if(!Dirty && !(Entry & 0x2)) + MmReleasePageMemoryConsumer(Consumer, Page); } else { @@ -660,7 +666,7 @@ if (PageOut) { MmSetPageEntrySectionSegment(Segment, Offset, 0); - MmReleasePageMemoryConsumer(MC_USER, Page); + MmReleasePageMemoryConsumer(Consumer, Page); } else { @@ -672,7 +678,7 @@ if (PageOut && !Dirty && !(Entry & 0x2)) { MmSetPageEntrySectionSegment(Segment, Offset, 0); - MmReleasePageMemoryConsumer(MC_USER, Page); + MmReleasePageMemoryConsumer(Consumer, Page); } else { @@ -685,7 +691,7 @@ else { MmSetPageEntrySectionSegment(Segment, Offset, 0); - MmReleasePageMemoryConsumer(MC_USER, Page); + MmReleasePageMemoryConsumer(Consumer, Page); } } } @@ -720,7 +726,7 @@ CHECKPOINT1; // MmSetPageEntrySectionSegment(Segment, Offset, 0); } - MmReleasePageMemoryConsumer(MC_USER, Page); + MmReleasePageMemoryConsumer(Consumer, Page); } else { @@ -2387,7 +2393,7 @@ MmDeleteRmap(OldPage, AddressSpace->Process, PAddress); MmInsertRmap(NewPage, AddressSpace->Process, PAddress); MmLockSectionSegment(Segment); - MmUnsharePageEntrySectionSegment(Section, Segment, Offset, FALSE, FALSE); + MmUnsharePageEntrySectionSegment(Section, Segment, Offset, FALSE, TRUE); MmUnlockSectionSegment(Segment);
PageOp->Status = STATUS_SUCCESS; @@ -4906,7 +4912,7 @@ { MmDeleteRmap(Page, AddressSpace->Process, Address); DPRINT("%x\n", Address); - MmUnsharePageEntrySectionSegment(Section, Segment, Offset, Dirty, FALSE); + MmUnsharePageEntrySectionSegment(Section, Segment, Offset, Dirty, TRUE); } } } @@ -6506,7 +6512,7 @@ if (Pfn) { MmDeleteRmap(Pfn, NULL, (PVOID)((ULONG_PTR)CacheView->BaseAddress + Offset)); - MmUnsharePageEntrySectionSegment(Section, Segment, CacheView->SectionData.ViewOffset + Offset, Dirty, FALSE); + MmUnsharePageEntrySectionSegment(Section, Segment, CacheView->SectionData.ViewOffset + Offset, Dirty, TRUE); } } MmUnlockSectionSegment(Segment);