[ros-diffs] [cgutman] 54537: [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

cgutman at svn.reactos.org cgutman at svn.reactos.org
Tue Nov 29 17:05:56 UTC 2011


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=54537&r1=54536&r2=54537&view=diff
==============================================================================
--- 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);
 }




More information about the Ros-diffs mailing list