Author: cgutman Date: Tue Nov 29 17:05:56 2011 New Revision: 54537
URL: http://svn.reactos.org/svn/reactos?rev=54537&view=rev Log: [NTOSKRNL] - Don't signal the balancer from within the balancer - Optimize usage of the balancer a bit so we don't have to wait on it as much
Modified: trunk/reactos/ntoskrnl/mm/balance.c
Modified: trunk/reactos/ntoskrnl/mm/balance.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/balance.c?rev=5... ============================================================================== --- trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] Tue Nov 29 17:05:56 2011 @@ -262,7 +262,8 @@ if (Consumer == MC_USER) MmInsertLRULastUserPage(Page); *AllocatedPage = Page; if (MmAvailablePages <= MiMinimumAvailablePages && - MiBalancerThreadHandle != NULL) + MiBalancerThreadHandle != NULL && + !MiIsBalancerThread()) { KeSetEvent(&MiBalancerEvent, IO_NO_INCREMENT, FALSE); } @@ -311,6 +312,13 @@
*AllocatedPage = Page; (void)InterlockedDecrementUL(&MiPagesRequired); + + if (MmAvailablePages <= MiMinimumAvailablePages && + MiBalancerThreadHandle != NULL && + !MiIsBalancerThread()) + { + KeSetEvent(&MiBalancerEvent, IO_NO_INCREMENT, FALSE); + }
return(STATUS_SUCCESS); } @@ -327,6 +335,13 @@ } if(Consumer == MC_USER) MmInsertLRULastUserPage(Page); *AllocatedPage = Page; + + if (MmAvailablePages <= MiMinimumAvailablePages && + MiBalancerThreadHandle != NULL && + !MiIsBalancerThread()) + { + KeSetEvent(&MiBalancerEvent, IO_NO_INCREMENT, FALSE); + }
return(STATUS_SUCCESS); }