Index: balance.c =================================================================== --- balance.c (revision 54527) +++ balance.c (working copy) @@ -131,7 +131,6 @@ else { KeReleaseSpinLock(&AllocationListLock, OldIrql); - if(Consumer == MC_USER) MmRemoveLRUUserPage(Page); OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock); MmDereferencePage(Page); KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql); @@ -164,16 +163,13 @@ MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages) { PFN_NUMBER CurrentPage; - PFN_NUMBER NextPage; NTSTATUS Status; (*NrFreedPages) = 0; CurrentPage = MmGetLRUFirstUserPage(); - while (CurrentPage != 0 && Target > 0) + while (CurrentPage && Target) { - NextPage = MmGetLRUNextUserPage(CurrentPage); - Status = MmPageOutPhysicalAddress(CurrentPage); if (NT_SUCCESS(Status)) { @@ -181,8 +177,9 @@ Target--; (*NrFreedPages)++; } - - CurrentPage = NextPage; + if (!Target) + break; + CurrentPage = MmGetLRUNextUserPage(CurrentPage); } return(STATUS_SUCCESS); } @@ -217,7 +214,7 @@ MiIsBalancerThread(VOID) { return MiBalancerThreadHandle != NULL && - PsGetCurrentThread() == MiBalancerThreadId.UniqueThread; + PsGetCurrentThreadId() == MiBalancerThreadId.UniqueThread; } NTSTATUS