[RSHELL]
[reactos.git] / ntoskrnl / mm / balance.c
index b325e42..804c674 100644 (file)
@@ -172,7 +172,7 @@ MiTrimMemoryConsumer(ULONG Consumer, ULONG InitialTarget)
         /* Now swap the pages out */
         Status = MiMemoryConsumers[Consumer].Trim(Target, 0, &NrFreedPages);
 
-        DPRINT("Trimming consumer %d: Freed %d pages with a target of %d pages\n", Consumer, NrFreedPages, Target);
+        DPRINT("Trimming consumer %lu: Freed %lu pages with a target of %lu pages\n", Consumer, NrFreedPages, Target);
 
         if (!NT_SUCCESS(Status))
         {
@@ -381,7 +381,7 @@ MiBalancerThread(PVOID Unused)
         ULONG InitialTarget = 0;
 
 #if (_MI_PAGING_LEVELS == 2)
-        if(!MiIsBalancerThread())
+        if (!MiIsBalancerThread())
         {
             /* Clean up the unused PDEs */
             ULONG_PTR Address;
@@ -390,14 +390,14 @@ MiBalancerThread(PVOID Unused)
             /* Acquire PFN lock */
             KIRQL OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
             PMMPDE pointerPde;
-            for(Address = (ULONG_PTR)MI_LOWEST_VAD_ADDRESS;
-                Address < (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS;
-                Address += (PAGE_SIZE * PTE_COUNT))
+            for (Address = (ULONG_PTR)MI_LOWEST_VAD_ADDRESS;
+                 Address < (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS;
+                 Address += (PAGE_SIZE * PTE_COUNT))
             {
-                if(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] == 0)
+                if (MiQueryPageTableReferences((PVOID)Address) == 0)
                 {
                     pointerPde = MiAddressToPde(Address);
-                    if(pointerPde->u.Hard.Valid)
+                    if (pointerPde->u.Hard.Valid)
                         MiDeletePte(pointerPde, MiPdeToPte(pointerPde), Process, NULL);
                     ASSERT(pointerPde->u.Hard.Valid == 0);
                 }
@@ -464,7 +464,7 @@ MiInitBalancerThread(VOID)
                                  NULL,
                                  NULL,
                                  &MiBalancerThreadId,
-                                 (PKSTART_ROUTINE) MiBalancerThread,
+                                 MiBalancerThread,
                                  NULL);
    if (!NT_SUCCESS(Status))
    {