Author: mbosma
Date: Mon Jul 31 16:13:46 2006
New Revision: 23392
URL:
http://svn.reactos.org/svn/reactos?rev=23392&view=rev
Log:
Release pages after they have been flushed if no one uses them.
Modified:
branches/cache_manager_rewrite/mm/section.c
Modified: branches/cache_manager_rewrite/mm/section.c
URL:
http://svn.reactos.org/svn/reactos/branches/cache_manager_rewrite/mm/sectio…
==============================================================================
--- branches/cache_manager_rewrite/mm/section.c (original)
+++ branches/cache_manager_rewrite/mm/section.c Mon Jul 31 16:13:46 2006
@@ -612,11 +612,10 @@
FileObject = Section->FileObject;
SavedSwapEntry = MmGetSavedSwapEntryPage(Page);
- if (PageOut)
+ if (PageOut && !Dirty && !(Entry & 0x2))
{
MmSetPageEntrySectionSegment(Segment, Offset, 0);
- if(!Dirty && !(Entry & 0x2))
- MmReleasePageMemoryConsumer(Consumer, Page);
+ MmReleasePageMemoryConsumer(Consumer, Page);
}
else
{
@@ -6615,6 +6614,18 @@
{
MmspWriteDataSectionPages(Context);
}
+
+ /* Release pages which just have been waiting for flushing */
+ for (i = Offset.u.LowPart / PAGE_SIZE; i < Length/PAGE_SIZE; i++)
+ {
+ Entry = MmGetPageEntrySectionSegment(Segment, i * PAGE_SIZE);
+ if(Entry && MmGetShareCountPage(PFN_FROM_SSE(Entry)) == 0)
+ {
+ MmSetPageEntrySectionSegment(Segment, i * PAGE_SIZE, 0);
+ MmReleasePageMemoryConsumer(MC_CACHE, PFN_FROM_SSE(Entry));
+ }
+ }
+
return STATUS_SUCCESS;
}