mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 08:25:48 +00:00
[NTOS:MM] Implement turning working set shared lock to exclusive
This commit is contained in:
parent
cd085ac12f
commit
6b2f05f9dd
1 changed files with 40 additions and 0 deletions
|
@ -1398,6 +1398,46 @@ MiUnlockWorkingSetShared(
|
||||||
KeLeaveGuardedRegion();
|
KeLeaveGuardedRegion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FORCEINLINE
|
||||||
|
BOOLEAN
|
||||||
|
MiConvertSharedWorkingSetLockToExclusive(
|
||||||
|
_In_ PETHREAD Thread,
|
||||||
|
_In_ PMMSUPPORT Vm)
|
||||||
|
{
|
||||||
|
/* Sanity check: No exclusive lock. */
|
||||||
|
ASSERT(!Thread->OwnsProcessWorkingSetExclusive);
|
||||||
|
ASSERT(!Thread->OwnsSessionWorkingSetExclusive);
|
||||||
|
ASSERT(!Thread->OwnsSystemWorkingSetExclusive);
|
||||||
|
|
||||||
|
/* And it should have one and only one shared lock */
|
||||||
|
ASSERT((Thread->OwnsProcessWorkingSetShared + Thread->OwnsSessionWorkingSetShared + Thread->OwnsSystemWorkingSetShared) == 1);
|
||||||
|
|
||||||
|
/* Try. */
|
||||||
|
if (!ExConvertPushLockSharedToExclusive(&Vm->WorkingSetMutex))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (Vm == &MmSystemCacheWs)
|
||||||
|
{
|
||||||
|
ASSERT(Thread->OwnsSystemWorkingSetShared);
|
||||||
|
Thread->OwnsSystemWorkingSetShared = FALSE;
|
||||||
|
Thread->OwnsSystemWorkingSetExclusive = TRUE;
|
||||||
|
}
|
||||||
|
else if (Vm->Flags.SessionSpace)
|
||||||
|
{
|
||||||
|
ASSERT(Thread->OwnsSessionWorkingSetShared);
|
||||||
|
Thread->OwnsSessionWorkingSetShared = FALSE;
|
||||||
|
Thread->OwnsSessionWorkingSetExclusive = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ASSERT(Thread->OwnsProcessWorkingSetShared);
|
||||||
|
Thread->OwnsProcessWorkingSetShared = FALSE;
|
||||||
|
Thread->OwnsProcessWorkingSetExclusive = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
VOID
|
VOID
|
||||||
MiUnlockProcessWorkingSetForFault(IN PEPROCESS Process,
|
MiUnlockProcessWorkingSetForFault(IN PEPROCESS Process,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue