From: Pierre Schweitzer Date: Wed, 7 Feb 2018 16:52:51 +0000 (+0100) Subject: [NTOSKRNL] On Cc init, also define CcNumberWorkerThreads which will be used later on X-Git-Tag: 0.4.9-dev~74 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=3b147adafb8eaf3568e0fbfbb69350d4947d0a00 [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. --- diff --git a/ntoskrnl/cc/view.c b/ntoskrnl/cc/view.c index 9344a97c8d7..99e7b1c6126 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 */