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

commit 676dc4b44131d67265fe896dc2a70071db28f192
Author:     Jérôme Gardou <[email protected]>
AuthorDate: Wed Aug 4 23:57:39 2021 +0200
Commit:     Jérôme Gardou <[email protected]>
CommitDate: Wed Aug 4 23:57:39 2021 +0200

    Revert "[NTOS:MM] Do proper checks & acquire proper locks when sweeping 
user pages"
    
    This reverts commit 7c006df7e0ea1fe3215137199bca7f4a0215a351.
    Note to self: This is what happens when you have too many branch and push 
the wrong one.
---
 ntoskrnl/mm/balance.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/ntoskrnl/mm/balance.c b/ntoskrnl/mm/balance.c
index fe882aff6c4..0eec51fbb88 100644
--- a/ntoskrnl/mm/balance.c
+++ b/ntoskrnl/mm/balance.c
@@ -213,22 +213,15 @@ MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG 
NrFreedPages)
 
                 MmLockAddressSpace(&Process->Vm);
 
-                if (!Process->VmDeleted)
+                /* Be sure this is still valid. */
+                PMMPTE Pte = MiAddressToPte(Address);
+                if (Pte->u.Hard.Valid)
                 {
-                    MiLockProcessWorkingSetUnsafe(Process, 
PsGetCurrentThread());
+                    Accessed = Accessed || Pte->u.Hard.Accessed;
+                    Pte->u.Hard.Accessed = 0;
 
-                    /* Be sure this is still valid. */
-                    if (MmIsAddressValid(Address))
-                    {
-                        PMMPTE Pte = MiAddressToPte(Address);
-                        Accessed = Accessed || Pte->u.Hard.Accessed;
-                        Pte->u.Hard.Accessed = 0;
-
-                        /* There is no need to invalidate, the balancer thread 
is never on a user process */
-                        //KeInvalidateTlbEntry(Address);
-                    }
-
-                    MiUnlockProcessWorkingSet(Process, PsGetCurrentThread());
+                    /* There is no need to invalidate, the balancer thread is 
never on a user process */
+                    //KeInvalidateTlbEntry(Address);
                 }
 
                 MmUnlockAddressSpace(&Process->Vm);

Reply via email to