mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
[NTOS:MM] Do proper checks & acquire proper locks when sweeping user pages
CORE-17595
This commit is contained in:
parent
789d7a7741
commit
7c006df7e0
1 changed files with 14 additions and 7 deletions
|
@ -213,15 +213,22 @@ MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
|
|||
|
||||
MmLockAddressSpace(&Process->Vm);
|
||||
|
||||
/* Be sure this is still valid. */
|
||||
PMMPTE Pte = MiAddressToPte(Address);
|
||||
if (Pte->u.Hard.Valid)
|
||||
if (!Process->VmDeleted)
|
||||
{
|
||||
Accessed = Accessed || Pte->u.Hard.Accessed;
|
||||
Pte->u.Hard.Accessed = 0;
|
||||
MiLockProcessWorkingSetUnsafe(Process, PsGetCurrentThread());
|
||||
|
||||
/* There is no need to invalidate, the balancer thread is never on a user process */
|
||||
//KeInvalidateTlbEntry(Address);
|
||||
/* 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());
|
||||
}
|
||||
|
||||
MmUnlockAddressSpace(&Process->Vm);
|
||||
|
|
Loading…
Reference in a new issue