Update used page table entry counts when mapping pages in cache sections.

svn path=/trunk/; revision=55837
This commit is contained in:
Art Yerkes 2012-02-24 10:05:06 +00:00
parent 34136e69cf
commit 3e19b0bab3
2 changed files with 29 additions and 0 deletions

View file

@ -49,6 +49,7 @@
#include "../newcc.h"
#define NDEBUG
#include <debug.h>
#include "../mm/ARM3/miarm.h"
#define DPRINTC DPRINT
@ -56,6 +57,7 @@ LIST_ENTRY MiSegmentList;
extern KEVENT MpwThreadEvent;
extern KSPIN_LOCK MiSectionPageTableLock;
extern PMMWSL MmWorkingSetList;
/* GLOBALS *******************************************************************/
@ -137,9 +139,18 @@ MiZeroFillSection
{
MmSetPageEntrySectionSegment(Segment, &FileOffset, MAKE_PFN_SSE(Page));
Address = ((PCHAR)MemoryArea->StartingAddress) + FileOffset.QuadPart - FirstMapped.QuadPart;
MmReferencePage(Page);
MmCreateVirtualMapping(NULL, Address, PAGE_READWRITE, &Page, 1);
MmInsertRmap(Page, NULL, Address);
#if (_MI_PAGING_LEVELS == 2)
/* Reference Page Directory Entry */
if(Address < MmSystemRangeStart)
{
MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]++;
ASSERT(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] <= PTE_COUNT);
}
#endif
}
else
MmReleasePageMemoryConsumer(MC_CACHE, Page);

View file

@ -49,10 +49,12 @@
#include "newmm.h"
#define NDEBUG
#include <debug.h>
#include "../mm/ARM3/miarm.h"
#define DPRINTC DPRINT
extern KEVENT MmWaitPageEvent;
extern PMMWSL MmWorkingSetList;
NTSTATUS
NTAPI
@ -140,6 +142,14 @@ MmNotPresentFaultCachePage
{
DPRINT("Set %x in address space @ %x\n", Required->Page[0], Address);
Status = MmCreateVirtualMapping(Process, Address, Attributes, Required->Page, 1);
#if (_MI_PAGING_LEVELS == 2)
/* Reference Page Directory Entry */
if(Address < MmSystemRangeStart)
{
MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]++;
ASSERT(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] <= PTE_COUNT);
}
#endif
if (NT_SUCCESS(Status))
{
MmInsertRmap(Required->Page[0], Process, Address);
@ -164,6 +174,14 @@ MmNotPresentFaultCachePage
MmReferencePage(Page);
Status = MmCreateVirtualMapping(Process, Address, Attributes, &Page, 1);
#if (_MI_PAGING_LEVELS == 2)
/* Reference Page Directory Entry */
if(Address < MmSystemRangeStart)
{
MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)]++;
ASSERT(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] <= PTE_COUNT);
}
#endif
if (NT_SUCCESS(Status))
{
MmInsertRmap(Page, Process, Address);