https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a93e065ebce692289cec49af0e686122be479fbf

commit a93e065ebce692289cec49af0e686122be479fbf
Author:     Jérôme Gardou <jerome.gar...@reactos.org>
AuthorDate: Tue Feb 23 11:07:35 2021 +0100
Commit:     Jérôme Gardou <jerome.gar...@reactos.org>
CommitDate: Fri Feb 26 08:46:53 2021 +0100

    [NTOS:MM] Do not chunk-read file when we are the modified-page-writer thread
---
 ntoskrnl/mm/section.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c
index ea56635b72f..b3e300a58cc 100644
--- a/ntoskrnl/mm/section.c
+++ b/ntoskrnl/mm/section.c
@@ -1200,8 +1200,10 @@ MmMakeSegmentResident(
     if (!NT_SUCCESS(Status))
         return Status;
 
-    /* If the file is not random access, read a 64K Chunk. */
-    if (!FlagOn(FileObject->Flags, FO_RANDOM_ACCESS))
+    /* If the file is not random access and we are not the page out thread
+     * read a 64K Chunk. */
+    if (((ULONG_PTR)IoGetTopLevelIrp() != FSRTL_MOD_WRITE_TOP_LEVEL_IRP)
+        && !FlagOn(FileObject->Flags, FO_RANDOM_ACCESS))
     {
         RangeStart = Offset - (Offset % _64K);
         if (RangeEnd % _64K)

Reply via email to