https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5d93941d31c714579ff3b…
commit 5d93941d31c714579ff3b3bedb766c6448aeaccb
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Fri Feb 9 14:22:00 2018 +0100
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Fri Feb 9 14:22:00 2018 +0100
[NTOSKRNL] Modified CcCanIWrite to handle Mm throttling limits
---
ntoskrnl/cc/copy.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c
index 40897028fc..a3b1f887aa 100644
--- a/ntoskrnl/cc/copy.c
+++ b/ntoskrnl/cc/copy.c
@@ -697,10 +697,16 @@ CcCanIWrite (
/* So, now allow write if:
* - Not the first try or we have no throttling yet
* AND:
- * - We don't execeed threshold!
+ * - We don't exceed threshold!
+ * - We don't exceed what Mm can allow us to use
+ * + If we're above top, that's fine
+ * + If we're above bottom with limited modified pages, that's fine
+ * + Otherwise, throttle!
*/
if ((TryContext != FirstTry || IsListEmpty(&CcDeferredWrites)) &&
CcTotalDirtyPages + Pages < CcDirtyPageThreshold &&
+ (MmAvailablePages > MmThrottleTop ||
+ (MmModifiedPageListHead.Total < 1000 && MmAvailablePages >
MmThrottleBottom)) &&
!PerFileDefer)
{
return TRUE;