Author: cgutman
Date: Mon Dec 19 08:49:42 2011
New Revision: 54693

URL: http://svn.reactos.org/svn/reactos?rev=54693&view=rev
Log:
[NTOSKRNL]
- Tweak the balancer a bit to favor RosMm allocations in low memory scenarios
- Fix the balancer out of memory warning

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=54693&r1=54692&r2=54693&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] Mon Dec 19 08:49:42 2011
@@ -108,8 +108,7 @@
    {
       if(Consumer == MC_USER) MmRemoveLRUUserPage(Page);
       (void)InterlockedDecrementUL(&MiMemoryConsumers[Consumer].PagesUsed);
-      if (MmAvailablePages < MiMinimumAvailablePages ||
-            (Entry = ExInterlockedRemoveHeadList(&AllocationListHead, 
&AllocationListLock)) == NULL)
+      if ((Entry = ExInterlockedRemoveHeadList(&AllocationListHead, 
&AllocationListLock)) == NULL)
       {
          OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
          MmDereferencePage(Page);
@@ -165,9 +164,6 @@
         Status = MiMemoryConsumers[Consumer].Trim(Target, 0, &NrFreedPages);
 
         DPRINT("Trimming consumer %d: Freed %d pages with a target of %d 
pages\n", Consumer, NrFreedPages, Target);
-
-        if (NrFreedPages == 0)
-            DPRINT1("Ran out of pages to swap!\n");
 
         if (!NT_SUCCESS(Status))
         {
@@ -355,6 +351,12 @@
           for (i = 0; i < MC_MAXIMUM; i++)
           {
               MiTrimMemoryConsumer(i);
+          }
+
+          if (MmAvailablePages < MiMinimumAvailablePages)
+          {
+              /* This is really bad... */
+              DPRINT1("Balancer failed to resolve low memory condition! 
Complete memory exhaustion is imminent!\n");
           }
       }
       else


Reply via email to