mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
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. svn path=/trunk/; revision=43550
This commit is contained in:
parent
144f1bc166
commit
253122a239
7 changed files with 32 additions and 50 deletions
|
@ -488,9 +488,9 @@ QSI_DEF(SystemBasicInformation)
|
|||
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 @@ QSI_DEF(SystemPerformanceInformation)
|
|||
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 @@ QSI_DEF(SystemPerformanceInformation)
|
|||
* 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 @@ QSI_DEF(SystemPerformanceInformation)
|
|||
|
||||
Spi->FreeSystemPtes = 0; /* FIXME */
|
||||
|
||||
Spi->ResidentSystemCodePage = MmStats.NrSystemPages; /* FIXME */
|
||||
Spi->ResidentSystemCodePage = 0; /* FIXME */
|
||||
|
||||
Spi->TotalSystemDriverPages = 0; /* FIXME */
|
||||
Spi->TotalSystemCodePages = 0; /* FIXME */
|
||||
|
|
|
@ -16,6 +16,7 @@ extern PHYSICAL_ADDRESS MmSharedDataPagePhysicalAddress;
|
|||
extern ULONG MmNumberOfPhysicalPages;
|
||||
extern ULONG MmLowestPhysicalPage;
|
||||
extern ULONG MmHighestPhysicalPage;
|
||||
extern ULONG MmAvailablePages;
|
||||
|
||||
extern PVOID MmPagedPoolBase;
|
||||
extern ULONG MmPagedPoolSize;
|
||||
|
@ -296,19 +297,6 @@ typedef struct _MEMORY_AREA
|
|||
} 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 @@ typedef struct _MMPFN
|
|||
} MMPFN, *PMMPFN;
|
||||
|
||||
extern PMMPFN MmPfnDatabase;
|
||||
extern MM_STATS MmStats;
|
||||
|
||||
typedef struct _MM_PAGEOP
|
||||
{
|
||||
|
|
|
@ -296,7 +296,7 @@ MmSetMemoryPriorityProcess(IN PEPROCESS Process,
|
|||
// 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
|
||||
|
|
|
@ -49,10 +49,10 @@ static LONG MiBalancerWork = 0;
|
|||
|
||||
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 @@ MmReleasePageMemoryConsumer(ULONG Consumer, PFN_TYPE Page)
|
|||
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 @@ MmRebalanceMemoryConsumers(VOID)
|
|||
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 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
|||
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 @@ MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
|||
/*
|
||||
* Make sure we don't exceed global targets.
|
||||
*/
|
||||
if (MmStats.NrFreePages <= MiMinimumAvailablePages)
|
||||
if (MmAvailablePages <= MiMinimumAvailablePages)
|
||||
{
|
||||
MM_ALLOCATION_REQUEST Request;
|
||||
|
||||
|
@ -369,7 +369,7 @@ MiBalancerThread(PVOID Unused)
|
|||
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 @@ MiBalancerThread(PVOID Unused)
|
|||
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)
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
|
||||
PPHYSICAL_PAGE MmPfnDatabase;
|
||||
|
||||
ULONG MmAvailablePages;
|
||||
|
||||
/* List of pages allocated to the MC_USER Consumer */
|
||||
static LIST_ENTRY UserPageListHead;
|
||||
/* List of pages zeroed by the ZPW (MmZeroPageThreadMain) */
|
||||
|
@ -249,10 +251,9 @@ MiFindContiguousPages(IN PFN_NUMBER LowestPfn,
|
|||
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 @@ MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress,
|
|||
//
|
||||
// Decrease available pages
|
||||
//
|
||||
MmStats.NrSystemPages++;
|
||||
MmStats.NrFreePages--;
|
||||
MmAvailablePages--;
|
||||
|
||||
//
|
||||
// Save it into the MDL
|
||||
|
@ -523,8 +523,7 @@ MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress,
|
|||
//
|
||||
// Decrease available pages
|
||||
//
|
||||
MmStats.NrSystemPages++;
|
||||
MmStats.NrFreePages--;
|
||||
MmAvailablePages--;
|
||||
|
||||
//
|
||||
// Save this page into the MDL
|
||||
|
@ -698,6 +697,7 @@ MmInitializePageList(VOID)
|
|||
PHYSICAL_PAGE UsedPage;
|
||||
PMEMORY_ALLOCATION_DESCRIPTOR Md;
|
||||
PLIST_ENTRY NextEntry;
|
||||
ULONG NrSystemPages = 0;
|
||||
|
||||
/* Initialize the page lists */
|
||||
InitializeListHead(&UserPageListHead);
|
||||
|
@ -746,7 +746,7 @@ MmInitializePageList(VOID)
|
|||
InsertTailList(&FreeUnzeroedPageListHead,
|
||||
&MmPfnDatabase[Md->BasePage + i].ListEntry);
|
||||
UnzeroedPageCount++;
|
||||
MmStats.NrFreePages++;
|
||||
MmAvailablePages++;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -756,7 +756,7 @@ MmInitializePageList(VOID)
|
|||
{
|
||||
/* Everything else is used memory */
|
||||
MmPfnDatabase[Md->BasePage + i] = UsedPage;
|
||||
MmStats.NrSystemPages++;
|
||||
NrSystemPages++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -769,13 +769,12 @@ MmInitializePageList(VOID)
|
|||
|
||||
/* 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 @@ MmDereferencePage(PFN_TYPE Pfn)
|
|||
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 @@ MmAllocPage(ULONG Consumer, SWAPENTRY SwapEntry)
|
|||
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 @@ MmAllocPage(ULONG Consumer, SWAPENTRY SwapEntry)
|
|||
PageDescriptor->LockCount = 0;
|
||||
PageDescriptor->SavedSwapEntry = SwapEntry;
|
||||
|
||||
MmStats.NrSystemPages++;
|
||||
MmStats.NrFreePages--;
|
||||
MmAvailablePages--;
|
||||
|
||||
PfnOffset = PageDescriptor - MmPfnDatabase;
|
||||
if ((NeedClear) && (Consumer != MC_SYSTEM))
|
||||
|
|
|
@ -50,7 +50,6 @@ MemType[] =
|
|||
|
||||
PBOOLEAN Mm64BitPhysicalAddress = FALSE;
|
||||
ULONG MmReadClusterSize;
|
||||
MM_STATS MmStats;
|
||||
PMMPTE MmSharedUserDataPte;
|
||||
PMMSUPPORT MmKernelAddressSpace;
|
||||
extern KMUTANT MmSystemLoadLock;
|
||||
|
@ -432,7 +431,7 @@ MmInitSystem(IN ULONG Phase,
|
|||
|
||||
/* 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 */
|
||||
|
|
|
@ -23,7 +23,6 @@ extern PVOID MiNonPagedPoolStart;
|
|||
extern ULONG MiNonPagedPoolLength;
|
||||
extern ULONG MmTotalPagedPoolQuota;
|
||||
extern ULONG MmTotalNonPagedPoolQuota;
|
||||
extern MM_STATS MmStats;
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
|
|
Loading…
Reference in a new issue