[NTOS]: Drop a reference count to the page table in MiDeleteSystemPageableVm as ARM3 now owns PDEs. This helps out yet again to free a little bit of extra RAM up.

svn path=/trunk/; revision=55999
This commit is contained in:
Sir Richard 2012-03-04 17:42:56 +00:00
parent e3e2689cbf
commit 6c3e9221be
2 changed files with 11 additions and 10 deletions

View file

@ -371,9 +371,10 @@ MiCompleteProtoPteFault(IN BOOLEAN StoreInstruction,
IN PMMPFN Pfn1) IN PMMPFN Pfn1)
{ {
MMPTE TempPte; MMPTE TempPte;
PMMPTE OriginalPte; PMMPTE OriginalPte, PageTablePte;
ULONG_PTR Protection; ULONG_PTR Protection;
PFN_NUMBER PageFrameIndex; PFN_NUMBER PageFrameIndex;
PMMPFN Pfn2;
/* Must be called with an valid prototype PTE, with the PFN lock held */ /* Must be called with an valid prototype PTE, with the PFN lock held */
ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
@ -386,7 +387,12 @@ MiCompleteProtoPteFault(IN BOOLEAN StoreInstruction,
Pfn1 = MiGetPfnEntry(PageFrameIndex); Pfn1 = MiGetPfnEntry(PageFrameIndex);
Pfn1->u3.e1.PrototypePte = 1; Pfn1->u3.e1.PrototypePte = 1;
/* FIXME: Increment the share count for the page table */ /* Increment the share count for the page table */
// FIXME: This doesn't work because we seem to bump the sharecount to two, and MiDeletePte gets annoyed and ASSERTs.
// This could be beause MiDeletePte is now being called from strange code in Rosmm
PageTablePte = MiAddressToPte(PointerPte);
Pfn2 = MiGetPfnEntry(PageTablePte->u.Hard.PageFrameNumber);
//Pfn2->u2.ShareCount++;
/* Check where we should be getting the protection information from */ /* Check where we should be getting the protection information from */
if (PointerPte->u.Soft.PageFileHigh == MI_PTE_LOOKUP_NEEDED) if (PointerPte->u.Soft.PageFileHigh == MI_PTE_LOOKUP_NEEDED)

View file

@ -116,8 +116,7 @@ MiDeleteSystemPageableVm(IN PMMPTE PointerPte,
{ {
PFN_COUNT ActualPages = 0; PFN_COUNT ActualPages = 0;
PETHREAD CurrentThread = PsGetCurrentThread(); PETHREAD CurrentThread = PsGetCurrentThread();
PMMPFN Pfn1; PMMPFN Pfn1, Pfn2;
//PMMPFN Pfn2;
PFN_NUMBER PageFrameIndex, PageTableIndex; PFN_NUMBER PageFrameIndex, PageTableIndex;
KIRQL OldIrql; KIRQL OldIrql;
ASSERT(KeGetCurrentIrql() <= APC_LEVEL); ASSERT(KeGetCurrentIrql() <= APC_LEVEL);
@ -150,7 +149,7 @@ MiDeleteSystemPageableVm(IN PMMPTE PointerPte,
/* Get the page table entry */ /* Get the page table entry */
PageTableIndex = Pfn1->u4.PteFrame; PageTableIndex = Pfn1->u4.PteFrame;
//Pfn2 = MiGetPfnEntry(PageTableIndex); Pfn2 = MiGetPfnEntry(PageTableIndex);
/* Lock the PFN database */ /* Lock the PFN database */
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
@ -160,10 +159,7 @@ MiDeleteSystemPageableVm(IN PMMPTE PointerPte,
MiDecrementShareCount(Pfn1, PageFrameIndex); MiDecrementShareCount(Pfn1, PageFrameIndex);
/* Decrement the page table too */ /* Decrement the page table too */
DPRINT("FIXME: ARM3 should decrement the pool PDE refcount for: %p\n", PageTableIndex);
#if 0 // ARM3: Dont't trust this yet
MiDecrementShareCount(Pfn2, PageTableIndex); MiDecrementShareCount(Pfn2, PageTableIndex);
#endif
/* Release the PFN database */ /* Release the PFN database */
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
@ -293,8 +289,7 @@ MiDeletePte(IN PMMPTE PointerPte,
/* There should only be 1 shared reference count */ /* There should only be 1 shared reference count */
ASSERT(Pfn1->u2.ShareCount == 1); ASSERT(Pfn1->u2.ShareCount == 1);
/* FIXME: Drop the reference on the page table. For now, leak it until RosMM is gone */ /* Drop the reference on the page table. */
//DPRINT1("Dropping a ref...\n");
MiDecrementShareCount(MiGetPfnEntry(Pfn1->u4.PteFrame), Pfn1->u4.PteFrame); MiDecrementShareCount(MiGetPfnEntry(Pfn1->u4.PteFrame), Pfn1->u4.PteFrame);
/* Mark the PFN for deletion and dereference what should be the last ref */ /* Mark the PFN for deletion and dereference what should be the last ref */