Commit in reactos/ntoskrnl/mm on MAIN
rmap.c+32-11.30 -> 1.31
- Updated the workingset size in the rmap functions.

reactos/ntoskrnl/mm
rmap.c 1.30 -> 1.31
diff -u -r1.30 -r1.31
--- rmap.c	15 Aug 2004 16:39:08 -0000	1.30
+++ rmap.c	2 Oct 2004 10:16:10 -0000	1.31
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: rmap.c,v 1.30 2004/08/15 16:39:08 chorns Exp $
+/* $Id: rmap.c,v 1.31 2004/10/02 10:16:10 hbirr Exp $
  *
  * COPYRIGHT:   See COPYING in the top directory
  * PROJECT:     ReactOS kernel 
@@ -391,6 +391,7 @@
 {
    PMM_RMAP_ENTRY current_entry;
    PMM_RMAP_ENTRY new_entry;
+   ULONG PrevSize;
 
    Address = (PVOID)PAGE_ROUND_DOWN(Address);
 
@@ -416,6 +417,18 @@
    new_entry->Next = current_entry;
    MmSetRmapListHeadPage(Page, new_entry);
    ExReleaseFastMutex(&RmapListLock);
+   if (Process == NULL)
+   {
+      Process = PsInitialSystemProcess;
+   }
+   if (Process)
+   {
+      PrevSize = InterlockedExchangeAdd(&Process->Vm.WorkingSetSize, PAGE_SIZE);
+      if (PrevSize >= Process->Vm.PeakWorkingSetSize)
+      {
+         Process->Vm.PeakWorkingSetSize = PrevSize + PAGE_SIZE;
+      }
+   }
 }
 
 VOID
@@ -425,6 +438,7 @@
 {
    PMM_RMAP_ENTRY current_entry;
    PMM_RMAP_ENTRY previous_entry;
+   PEPROCESS Process;
 
    ExAcquireFastMutex(&RmapListLock);
    current_entry = MmGetRmapListHeadPage(Page);
@@ -443,7 +457,16 @@
          DeleteMapping(Context, previous_entry->Process,
                        previous_entry->Address);
       }
+      Process = previous_entry->Process;
       ExFreeToNPagedLookasideList(&RmapLookasideList, previous_entry);
+      if (Process == NULL)
+      {
+         Process = PsInitialSystemProcess;
+      }
+      if (Process)
+      {
+         InterlockedExchangeAdd(&Process->Vm.WorkingSetSize, -PAGE_SIZE);
+      }
    }
    ExReleaseFastMutex(&RmapListLock);
 }
@@ -472,6 +495,14 @@
          }
          ExReleaseFastMutex(&RmapListLock);
          ExFreeToNPagedLookasideList(&RmapLookasideList, current_entry);
+	 if (Process == NULL)
+	 {
+	    Process = PsInitialSystemProcess;
+	 }
+	 if (Process)
+	 {
+            InterlockedExchangeAdd(&Process->Vm.WorkingSetSize, -PAGE_SIZE);
+	 }
          return;
       }
       previous_entry = current_entry;
CVSspam 0.2.8