- Updated the workingset size in the rmap functions.

svn path=/trunk/; revision=11148
This commit is contained in:
Hartmut Birr 2004-10-02 10:16:10 +00:00
parent 9495493fde
commit c8641fc2a3

View file

@ -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 @@ MmInsertRmap(PFN_TYPE Page, PEPROCESS Process,
{
PMM_RMAP_ENTRY current_entry;
PMM_RMAP_ENTRY new_entry;
ULONG PrevSize;
Address = (PVOID)PAGE_ROUND_DOWN(Address);
@ -416,6 +417,18 @@ MmInsertRmap(PFN_TYPE Page, PEPROCESS Process,
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 @@ MmDeleteAllRmaps(PFN_TYPE Page, PVOID Context,
{
PMM_RMAP_ENTRY current_entry;
PMM_RMAP_ENTRY previous_entry;
PEPROCESS Process;
ExAcquireFastMutex(&RmapListLock);
current_entry = MmGetRmapListHeadPage(Page);
@ -443,7 +457,16 @@ MmDeleteAllRmaps(PFN_TYPE Page, PVOID Context,
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 @@ MmDeleteRmap(PFN_TYPE Page, PEPROCESS Process,
}
ExReleaseFastMutex(&RmapListLock);
ExFreeToNPagedLookasideList(&RmapLookasideList, current_entry);
if (Process == NULL)
{
Process = PsInitialSystemProcess;
}
if (Process)
{
InterlockedExchangeAdd(&Process->Vm.WorkingSetSize, -PAGE_SIZE);
}
return;
}
previous_entry = current_entry;