if (IsListEmpty(&AllocationListHead) || MmAvailablePages < MiMinimumAvailablePages)
{
KeReleaseSpinLock(&AllocationListLock, OldIrql);
+ if(Consumer == MC_USER) MmRemoveLRUUserPage(Page);
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
MmDereferencePage(Page);
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
Target--;
(*NrFreedPages)++;
}
- else if (Status == STATUS_PAGEFILE_QUOTA)
- {
- MmRemoveLRUUserPage(CurrentPage);
- MmInsertLRULastUserPage(CurrentPage);
- }
CurrentPage = NextPage;
}
PsGetCurrentThread() == MiBalancerThreadId.UniqueThread;
}
+VOID NTAPI MiSetConsumer(IN PFN_TYPE Pfn, IN ULONG Consumer);
+
NTSTATUS
NTAPI
MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
if ((Consumer == MC_NPPOOL) || (Consumer == MC_SYSTEM) || MiIsBalancerThread())
{
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
- Page = MmAllocPage(Consumer, 0);
+ Page = MmAllocPage(Consumer);
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
if (Page == 0)
{
{
KeBugCheck(NO_PAGES_AVAILABLE);
}
- /* Update the Consumer */
- MiGetPfnEntry(Page)->u3.e1.PageLocation = Consumer;
+ /* Update the Consumer and make the page active */
+ MiSetConsumer(Page, Consumer);
if(Consumer == MC_USER) MmInsertLRULastUserPage(Page);
*AllocatedPage = Page;
(void)InterlockedDecrementUL(&MiPagesRequired);
* Actually allocate the page.
*/
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
- Page = MmAllocPage(Consumer, 0);
+ Page = MmAllocPage(Consumer);
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
if (Page == 0)
{