https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3b147adafb8eaf3568e0fb...
commit 3b147adafb8eaf3568e0fbfbb69350d4947d0a00 Author: Pierre Schweitzer pierre@reactos.org AuthorDate: Wed Feb 7 17:52:51 2018 +0100 Commit: Pierre Schweitzer pierre@reactos.org CommitDate: Wed Feb 7 21:37:17 2018 +0100
[NTOSKRNL] On Cc init, also define CcNumberWorkerThreads which will be used later on Also make a "default" case (really limited) in case SystemSize doesn't match. --- ntoskrnl/cc/view.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index 9344a97c8d..99e7b1c612 100644 --- a/ntoskrnl/cc/view.c +++ b/ntoskrnl/cc/view.c @@ -66,6 +66,7 @@ ULONG CcLazyWriteIos = 0; * - List for "clean" shared cache maps * - One second delay for lazy writer * - System size when system started + * - Number of worker threads */ ULONG CcDirtyPageThreshold = 0; ULONG CcTotalDirtyPages = 0; @@ -74,6 +75,7 @@ KSPIN_LOCK CcDeferredWriteSpinLock; LIST_ENTRY CcCleanSharedCacheMapList; LARGE_INTEGER CcIdleDelay = RTL_CONSTANT_LARGE_INTEGER((LONGLONG)-1*1000*1000*10); MM_SYSTEMSIZE CcCapturedSystemSize; +ULONG CcNumberWorkerThreads;
/* Internal vars (ROS): * - Event to notify lazy writer to shutdown @@ -1448,21 +1450,31 @@ CcInitView ( KeInitializeEvent(&iLazyWriterShutdown, SynchronizationEvent, FALSE); KeInitializeEvent(&iLazyWriterNotify, NotificationEvent, FALSE);
- /* Define lazy writer threshold, depending on system type */ + /* Define lazy writer threshold and the amount of workers, + * depending on the system type + */ CcCapturedSystemSize = MmQuerySystemSize(); switch (CcCapturedSystemSize) { case MmSmallSystem: + CcNumberWorkerThreads = ExCriticalWorkerThreads - 1; CcDirtyPageThreshold = MmNumberOfPhysicalPages / 8; break;
case MmMediumSystem: + CcNumberWorkerThreads = ExCriticalWorkerThreads - 1; CcDirtyPageThreshold = MmNumberOfPhysicalPages / 4; break;
case MmLargeSystem: + CcNumberWorkerThreads = ExCriticalWorkerThreads - 2; CcDirtyPageThreshold = MmNumberOfPhysicalPages / 8 + MmNumberOfPhysicalPages / 4; break; + + default: + CcNumberWorkerThreads = 1; + CcDirtyPageThreshold = MmNumberOfPhysicalPages / 8; + break; }
/* Start the lazy writer thread */