Author: sginsberg
Date: Sun Oct 18 15:55:44 2009
New Revision: 43550
URL:
http://svn.reactos.org/svn/reactos?rev=43550&view=rev
Log:
Get rid of MmStats -- most of the fields weren't used anymore and we have duplicates
for most of the ones that are still in use;
NrTotalPages -> MmNumberOfPhysicalPages
NrFreePages -> MmAvailablePages (new)
Get rid of NrSystemPages. Its value was only respected in MmInitializePageList at boot,
even though it got updated later. Use a local variable in MmInitializePageList instead.
Fix SystemBasicInformation to use the correct variables for physical page information.
Also, don't set ResidentSystemCodePage in the SystemPerformanceInformation query to
some random incorrect Mm value. We don't depend this value anywhere in ReactOS
currently, so just set it to 0.
Modified:
trunk/reactos/ntoskrnl/ex/sysinfo.c
trunk/reactos/ntoskrnl/include/internal/mm.h
trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
trunk/reactos/ntoskrnl/mm/balance.c
trunk/reactos/ntoskrnl/mm/freelist.c
trunk/reactos/ntoskrnl/mm/mminit.c
trunk/reactos/ntoskrnl/mm/pool.c
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/sysinfo.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c [iso-8859-1] Sun Oct 18 15:55:44 2009
@@ -488,9 +488,9 @@
Sbi->Reserved = 0;
Sbi->TimerResolution = KeMaximumIncrement;
Sbi->PageSize = PAGE_SIZE;
- Sbi->NumberOfPhysicalPages = MmStats.NrTotalPages;
- Sbi->LowestPhysicalPageNumber = 0; /* FIXME */
- Sbi->HighestPhysicalPageNumber = MmStats.NrTotalPages; /* FIXME */
+ Sbi->NumberOfPhysicalPages = MmNumberOfPhysicalPages;
+ Sbi->LowestPhysicalPageNumber = MmLowestPhysicalPage;
+ Sbi->HighestPhysicalPageNumber = MmHighestPhysicalPage;
Sbi->AllocationGranularity = MM_VIRTMEM_GRANULARITY; /* hard coded on Intel? */
Sbi->MinimumUserModeAddress = 0x10000; /* Top of 64k */
Sbi->MaximumUserModeAddress = (ULONG_PTR)MmHighestUserAddress;
@@ -555,7 +555,7 @@
Spi->IoWriteOperationCount = IoWriteOperationCount;
Spi->IoOtherOperationCount = IoOtherOperationCount;
- Spi->AvailablePages = MmStats.NrFreePages;
+ Spi->AvailablePages = MmAvailablePages;
/*
* Add up all the used "Committed" memory + pagefile.
* Not sure this is right. 8^\
@@ -570,7 +570,7 @@
* All this make Taskmgr happy but not sure it is the right numbers.
* This too, fixes some of GlobalMemoryStatusEx numbers.
*/
- Spi->CommitLimit = MmStats.NrTotalPages + MiFreeSwapPages + MiUsedSwapPages;
+ Spi->CommitLimit = MmNumberOfPhysicalPages + MiFreeSwapPages + MiUsedSwapPages;
Spi->PeakCommitment = 0; /* FIXME */
Spi->PageFaultCount = 0; /* FIXME */
@@ -596,7 +596,7 @@
Spi->FreeSystemPtes = 0; /* FIXME */
- Spi->ResidentSystemCodePage = MmStats.NrSystemPages; /* FIXME */
+ Spi->ResidentSystemCodePage = 0; /* FIXME */
Spi->TotalSystemDriverPages = 0; /* FIXME */
Spi->TotalSystemCodePages = 0; /* FIXME */
Modified: trunk/reactos/ntoskrnl/include/internal/mm.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/mm.h [iso-8859-1] Sun Oct 18 15:55:44 2009
@@ -16,6 +16,7 @@
extern ULONG MmNumberOfPhysicalPages;
extern ULONG MmLowestPhysicalPage;
extern ULONG MmHighestPhysicalPage;
+extern ULONG MmAvailablePages;
extern PVOID MmPagedPoolBase;
extern ULONG MmPagedPoolSize;
@@ -295,19 +296,6 @@
} VirtualMemoryData;
} Data;
} MEMORY_AREA, *PMEMORY_AREA;
-
-typedef struct
-{
- ULONG NrTotalPages;
- ULONG NrSystemPages;
- ULONG NrUserPages;
- ULONG NrFreePages;
- ULONG NrDirtyPages;
- ULONG NrLockedPages;
- ULONG PagingRequestsInLastMinute;
- ULONG PagingRequestsInLastFiveMinutes;
- ULONG PagingRequestsInLastFifteenMinutes;
-} MM_STATS;
//
// These two mappings are actually used by Windows itself, based on the ASSERTS
@@ -379,7 +367,6 @@
} MMPFN, *PMMPFN;
extern PMMPFN MmPfnDatabase;
-extern MM_STATS MmStats;
typedef struct _MM_PAGEOP
{
Modified: trunk/reactos/ntoskrnl/mm/ARM3/procsup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/ARM3/procsup.c…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/ARM3/procsup.c [iso-8859-1] Sun Oct 18 15:55:44 2009
@@ -296,7 +296,7 @@
// Check if we have less then 16MB of Physical Memory
//
if ((MmSystemSize == MmSmallSystem) &&
- (MmStats.NrTotalPages < ((15 * 1024 * 1024) / PAGE_SIZE)))
+ (MmNumberOfPhysicalPages < ((15 * 1024 * 1024) / PAGE_SIZE)))
{
//
// Always use background priority
Modified: trunk/reactos/ntoskrnl/mm/balance.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/balance.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] Sun Oct 18 15:55:44 2009
@@ -49,10 +49,10 @@
VOID MmPrintMemoryStatistic(VOID)
{
- DbgPrint("MC_CACHE %d, MC_USER %d, MC_PPOOL %d, MC_NPPOOL %d, MmStats.NrFreePages
%d\n",
+ DbgPrint("MC_CACHE %d, MC_USER %d, MC_PPOOL %d, MC_NPPOOL %d, MmAvailablePages
%d\n",
MiMemoryConsumers[MC_CACHE].PagesUsed, MiMemoryConsumers[MC_USER].PagesUsed,
MiMemoryConsumers[MC_PPOOL].PagesUsed,
MiMemoryConsumers[MC_NPPOOL].PagesUsed,
- MmStats.NrFreePages);
+ MmAvailablePages);
}
VOID
@@ -117,7 +117,7 @@
if (MmGetReferenceCountPage(Page) == 1)
{
(void)InterlockedDecrementUL(&MiMemoryConsumers[Consumer].PagesUsed);
- if (IsListEmpty(&AllocationListHead) || MmStats.NrFreePages <
MiMinimumAvailablePages)
+ if (IsListEmpty(&AllocationListHead) || MmAvailablePages <
MiMinimumAvailablePages)
{
KeReleaseSpinLock(&AllocationListLock, OldIrql);
OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
@@ -208,7 +208,7 @@
ULONG NrFreedPages;
NTSTATUS Status;
- Target = (MiMinimumAvailablePages - MmStats.NrFreePages) + MiPagesRequired;
+ Target = (MiMinimumAvailablePages - MmAvailablePages) + MiPagesRequired;
Target = max(Target, (LONG) MiMinimumPagesPerRun);
for (i = 0; i < MC_MAXIMUM && Target > 0; i++)
@@ -269,7 +269,7 @@
KeBugCheck(NO_PAGES_AVAILABLE);
}
*AllocatedPage = Page;
- if (MmStats.NrFreePages <= MiMinimumAvailablePages &&
+ if (MmAvailablePages <= MiMinimumAvailablePages &&
MiBalancerThreadHandle != NULL)
{
KeSetEvent(&MiBalancerEvent, IO_NO_INCREMENT, FALSE);
@@ -280,7 +280,7 @@
/*
* Make sure we don't exceed global targets.
*/
- if (MmStats.NrFreePages <= MiMinimumAvailablePages)
+ if (MmAvailablePages <= MiMinimumAvailablePages)
{
MM_ALLOCATION_REQUEST Request;
@@ -369,7 +369,7 @@
if (Status == STATUS_SUCCESS)
{
/* MiBalancerEvent */
- while (MmStats.NrFreePages < MiMinimumAvailablePages + 5)
+ while (MmAvailablePages < MiMinimumAvailablePages + 5)
{
for (i = 0; i < MC_MAXIMUM; i++)
{
@@ -389,7 +389,7 @@
else if (Status == STATUS_SUCCESS + 1)
{
/* MiBalancerTimer */
- ShouldRun = MmStats.NrFreePages < MiMinimumAvailablePages + 5 ? TRUE :
FALSE;
+ ShouldRun = MmAvailablePages < MiMinimumAvailablePages + 5 ? TRUE : FALSE;
for (i = 0; i < MC_MAXIMUM; i++)
{
if (MiMemoryConsumers[i].Trim != NULL)
Modified: trunk/reactos/ntoskrnl/mm/freelist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/freelist.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/freelist.c [iso-8859-1] Sun Oct 18 15:55:44 2009
@@ -49,6 +49,8 @@
#define PPHYSICAL_PAGE PMMPFN
PPHYSICAL_PAGE MmPfnDatabase;
+
+ULONG MmAvailablePages;
/* List of pages allocated to the MC_USER Consumer */
static LIST_ENTRY UserPageListHead;
@@ -249,10 +251,9 @@
if (Pfn1->Flags.Zero == 0) UnzeroedPageCount--;
//
- // One less free page, one more system page
+ // One less free page
//
- MmStats.NrFreePages--;
- MmStats.NrSystemPages++;
+ MmAvailablePages--;
//
// This PFN is now a used page, set it up
@@ -465,8 +466,7 @@
//
// Decrease available pages
//
- MmStats.NrSystemPages++;
- MmStats.NrFreePages--;
+ MmAvailablePages--;
//
// Save it into the MDL
@@ -523,8 +523,7 @@
//
// Decrease available pages
//
- MmStats.NrSystemPages++;
- MmStats.NrFreePages--;
+ MmAvailablePages--;
//
// Save this page into the MDL
@@ -698,6 +697,7 @@
PHYSICAL_PAGE UsedPage;
PMEMORY_ALLOCATION_DESCRIPTOR Md;
PLIST_ENTRY NextEntry;
+ ULONG NrSystemPages = 0;
/* Initialize the page lists */
InitializeListHead(&UserPageListHead);
@@ -746,7 +746,7 @@
InsertTailList(&FreeUnzeroedPageListHead,
&MmPfnDatabase[Md->BasePage + i].ListEntry);
UnzeroedPageCount++;
- MmStats.NrFreePages++;
+ MmAvailablePages++;
}
}
else
@@ -756,7 +756,7 @@
{
/* Everything else is used memory */
MmPfnDatabase[Md->BasePage + i] = UsedPage;
- MmStats.NrSystemPages++;
+ NrSystemPages++;
}
}
}
@@ -769,13 +769,12 @@
/* Mark it as used kernel memory */
MmPfnDatabase[i] = UsedPage;
- MmStats.NrSystemPages++;
+ NrSystemPages++;
}
KeInitializeEvent(&ZeroPageThreadEvent, NotificationEvent, TRUE);
- DPRINT("Pages: %x %x\n", MmStats.NrFreePages, MmStats.NrSystemPages);
- MmStats.NrTotalPages = MmStats.NrFreePages + MmStats.NrSystemPages +
MmStats.NrUserPages;
- MmInitializeBalancer(MmStats.NrFreePages, MmStats.NrSystemPages);
+ DPRINT("Pages: %x %x\n", MmAvailablePages, NrSystemPages);
+ MmInitializeBalancer(MmAvailablePages, NrSystemPages);
}
VOID
@@ -912,8 +911,7 @@
Page->ReferenceCount--;
if (Page->ReferenceCount == 0)
{
- MmStats.NrFreePages++;
- MmStats.NrSystemPages--;
+ MmAvailablePages++;
if (Page->Flags.Consumer == MC_USER) RemoveEntryList(&Page->ListEntry);
if (Page->RmapListHead != (LONG)NULL)
{
@@ -1028,7 +1026,7 @@
if (IsListEmpty(&FreeUnzeroedPageListHead))
{
/* Check if this allocation is for the PFN DB itself */
- if (MmStats.NrTotalPages == 0)
+ if (MmNumberOfPhysicalPages == 0)
{
ASSERT(FALSE);
}
@@ -1066,8 +1064,7 @@
PageDescriptor->LockCount = 0;
PageDescriptor->SavedSwapEntry = SwapEntry;
- MmStats.NrSystemPages++;
- MmStats.NrFreePages--;
+ MmAvailablePages--;
PfnOffset = PageDescriptor - MmPfnDatabase;
if ((NeedClear) && (Consumer != MC_SYSTEM))
Modified: trunk/reactos/ntoskrnl/mm/mminit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/mminit.c?rev=4…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/mminit.c [iso-8859-1] Sun Oct 18 15:55:44 2009
@@ -50,7 +50,6 @@
PBOOLEAN Mm64BitPhysicalAddress = FALSE;
ULONG MmReadClusterSize;
-MM_STATS MmStats;
PMMPTE MmSharedUserDataPte;
PMMSUPPORT MmKernelAddressSpace;
extern KMUTANT MmSystemLoadLock;
@@ -432,7 +431,7 @@
/* Setup shared user data settings that NT does as well */
ASSERT(SharedUserData->NumberOfPhysicalPages == 0);
- SharedUserData->NumberOfPhysicalPages = MmStats.NrTotalPages;
+ SharedUserData->NumberOfPhysicalPages = MmNumberOfPhysicalPages;
SharedUserData->LargePageMinimum = 0;
/* For now, we assume that we're always Server */
Modified: trunk/reactos/ntoskrnl/mm/pool.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/pool.c?rev=435…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/pool.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/pool.c [iso-8859-1] Sun Oct 18 15:55:44 2009
@@ -23,7 +23,6 @@
extern ULONG MiNonPagedPoolLength;
extern ULONG MmTotalPagedPoolQuota;
extern ULONG MmTotalNonPagedPoolQuota;
-extern MM_STATS MmStats;
/* FUNCTIONS ***************************************************************/