https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6b0cb54fe578e81205ffc3...
commit 6b0cb54fe578e81205ffc3be6e53b246ce040d01 Author: Pierre Schweitzer pierre@reactos.org AuthorDate: Fri Feb 9 14:21:14 2018 +0100 Commit: Pierre Schweitzer pierre@reactos.org CommitDate: Fri Feb 9 14:21:14 2018 +0100
[NTOSKRNL] Define the throttling limits for Cc in Mm: MmThrottleTop, MmThrottleBottom. Modified !defwrites to reflect that change --- ntoskrnl/cc/view.c | 6 ++++++ ntoskrnl/include/internal/mm.h | 2 ++ ntoskrnl/mm/ARM3/mminit.c | 24 ++++++++++++++++++++++++ 3 files changed, 32 insertions(+)
diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index cf2645591c..d69b195c10 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -1437,6 +1437,12 @@ ExpKdbgExtDefWrites(ULONG Argc, PCHAR Argv[]) (CcDirtyPageThreshold * PAGE_SIZE) / 1024); KdbpPrint("MmAvailablePages:\t%lu (%lu Kb)\n", MmAvailablePages, (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) { diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h index 4489530ee2..d5094e0915 100644 --- a/ntoskrnl/include/internal/mm.h +++ b/ntoskrnl/include/internal/mm.h @@ -15,6 +15,8 @@ extern PFN_NUMBER MmLowestPhysicalPage; extern PFN_NUMBER MmHighestPhysicalPage; extern PFN_NUMBER MmAvailablePages; extern PFN_NUMBER MmResidentAvailablePages; +extern ULONG MmThrottleTop; +extern ULONG MmThrottleBottom;
extern LIST_ENTRY MmLoadedUserImageList;
diff --git a/ntoskrnl/mm/ARM3/mminit.c b/ntoskrnl/mm/ARM3/mminit.c index eb625fcecb..9b57931cbc 100644 --- a/ntoskrnl/mm/ARM3/mminit.c +++ b/ntoskrnl/mm/ARM3/mminit.c @@ -387,6 +387,15 @@ PFN_NUMBER MiNumberOfFreePages = 0; ULONG MmCritsectTimeoutSeconds = 150; // NT value: 720 * 60 * 60; (30 days) 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 **********************************************************/
VOID @@ -2074,6 +2083,13 @@ MmArmInitSystem(IN ULONG Phase, MiLowNonPagedPoolEvent = &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 // @@ -2461,6 +2477,10 @@ MmArmInitSystem(IN ULONG Phase, /* Set Windows NT Workstation product type */ SharedUserData->NtProductType = NtProductWinNt; MmProductType = 0; + + /* For this product, we wait till the last moment to throttle */ + MmThrottleTop = 250; + MmThrottleBottom = 30; } else { @@ -2479,6 +2499,10 @@ MmArmInitSystem(IN ULONG Phase, /* Set the product type, and make the system more aggressive with low memory */ MmProductType = 1; MmMinimumFreePages = 81; + + /* We will throttle earlier to preserve memory */ + MmThrottleTop = 450; + MmThrottleBottom = 80; }
/* Update working set tuning parameters */