[NTOSKRNL] Define the throttling limits for Cc in Mm: MmThrottleTop, MmThrottleBottom.

Modified !defwrites to reflect that change
This commit is contained in:
Pierre Schweitzer 2018-02-09 14:21:14 +01:00
parent 945ff8ea2e
commit 6b0cb54fe5
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
3 changed files with 32 additions and 0 deletions

View file

@ -1437,6 +1437,12 @@ ExpKdbgExtDefWrites(ULONG Argc, PCHAR Argv[])
(CcDirtyPageThreshold * PAGE_SIZE) / 1024); (CcDirtyPageThreshold * PAGE_SIZE) / 1024);
KdbpPrint("MmAvailablePages:\t%lu (%lu Kb)\n", MmAvailablePages, KdbpPrint("MmAvailablePages:\t%lu (%lu Kb)\n", MmAvailablePages,
(MmAvailablePages * PAGE_SIZE) / 1024); (MmAvailablePages * PAGE_SIZE) / 1024);
KdbpPrint("MmThrottleTop:\t\t%lu (%lu Kb)\n", MmThrottleTop,
(MmThrottleTop * PAGE_SIZE) / 1024);
KdbpPrint("MmThrottleBottom:\t%lu (%lu Kb)\n", MmThrottleBottom,
(MmThrottleBottom * PAGE_SIZE) / 1024);
KdbpPrint("MmModifiedPageListHead.Total:\t%lu (%lu Kb)\n", MmModifiedPageListHead.Total,
(MmModifiedPageListHead.Total * PAGE_SIZE) / 1024);
if (CcTotalDirtyPages >= CcDirtyPageThreshold) if (CcTotalDirtyPages >= CcDirtyPageThreshold)
{ {

View file

@ -15,6 +15,8 @@ extern PFN_NUMBER MmLowestPhysicalPage;
extern PFN_NUMBER MmHighestPhysicalPage; extern PFN_NUMBER MmHighestPhysicalPage;
extern PFN_NUMBER MmAvailablePages; extern PFN_NUMBER MmAvailablePages;
extern PFN_NUMBER MmResidentAvailablePages; extern PFN_NUMBER MmResidentAvailablePages;
extern ULONG MmThrottleTop;
extern ULONG MmThrottleBottom;
extern LIST_ENTRY MmLoadedUserImageList; extern LIST_ENTRY MmLoadedUserImageList;

View file

@ -387,6 +387,15 @@ PFN_NUMBER MiNumberOfFreePages = 0;
ULONG MmCritsectTimeoutSeconds = 150; // NT value: 720 * 60 * 60; (30 days) ULONG MmCritsectTimeoutSeconds = 150; // NT value: 720 * 60 * 60; (30 days)
LARGE_INTEGER MmCriticalSectionTimeout; LARGE_INTEGER MmCriticalSectionTimeout;
//
// Throttling limits for Cc (in pages)
// Above top, we don't throttle
// Above bottom, we throttle depending on the amount of modified pages
// Otherwise, we throttle!
//
ULONG MmThrottleTop;
ULONG MmThrottleBottom;
/* PRIVATE FUNCTIONS **********************************************************/ /* PRIVATE FUNCTIONS **********************************************************/
VOID VOID
@ -2074,6 +2083,13 @@ MmArmInitSystem(IN ULONG Phase,
MiLowNonPagedPoolEvent = &MiTempEvent; MiLowNonPagedPoolEvent = &MiTempEvent;
MiHighNonPagedPoolEvent = &MiTempEvent; MiHighNonPagedPoolEvent = &MiTempEvent;
//
// Default throttling limits for Cc
// May be ajusted later on depending on system type
//
MmThrottleTop = 450;
MmThrottleBottom = 127;
// //
// Define the basic user vs. kernel address space separation // Define the basic user vs. kernel address space separation
// //
@ -2461,6 +2477,10 @@ MmArmInitSystem(IN ULONG Phase,
/* Set Windows NT Workstation product type */ /* Set Windows NT Workstation product type */
SharedUserData->NtProductType = NtProductWinNt; SharedUserData->NtProductType = NtProductWinNt;
MmProductType = 0; MmProductType = 0;
/* For this product, we wait till the last moment to throttle */
MmThrottleTop = 250;
MmThrottleBottom = 30;
} }
else else
{ {
@ -2479,6 +2499,10 @@ MmArmInitSystem(IN ULONG Phase,
/* Set the product type, and make the system more aggressive with low memory */ /* Set the product type, and make the system more aggressive with low memory */
MmProductType = 1; MmProductType = 1;
MmMinimumFreePages = 81; MmMinimumFreePages = 81;
/* We will throttle earlier to preserve memory */
MmThrottleTop = 450;
MmThrottleBottom = 80;
} }
/* Update working set tuning parameters */ /* Update working set tuning parameters */