mirror of
https://github.com/reactos/reactos.git
synced 2025-06-03 16:30:26 +00:00
[NTOSKRNL]
- Fix incorrect placement of the PDE freeing code which caused a deadlock to occur if a low memory condition was indicated by ARM3 svn path=/trunk/; revision=56050
This commit is contained in:
parent
9973fe86bf
commit
d78bbd2aab
1 changed files with 27 additions and 28 deletions
|
@ -245,33 +245,6 @@ VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
MmRebalanceMemoryConsumers(VOID)
|
MmRebalanceMemoryConsumers(VOID)
|
||||||
{
|
{
|
||||||
#if (_MI_PAGING_LEVELS == 2)
|
|
||||||
if(!MiIsBalancerThread())
|
|
||||||
{
|
|
||||||
/* Clean up the unused PDEs */
|
|
||||||
ULONG_PTR Address;
|
|
||||||
PEPROCESS Process = PsGetCurrentProcess();
|
|
||||||
|
|
||||||
/* Acquire PFN lock */
|
|
||||||
KIRQL OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
|
||||||
PMMPDE pointerPde;
|
|
||||||
for(Address = (ULONG_PTR)MI_LOWEST_VAD_ADDRESS;
|
|
||||||
Address < (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS;
|
|
||||||
Address += (PAGE_SIZE * PTE_COUNT))
|
|
||||||
{
|
|
||||||
if(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] == 0)
|
|
||||||
{
|
|
||||||
pointerPde = MiAddressToPde(Address);
|
|
||||||
if(pointerPde->u.Hard.Valid)
|
|
||||||
MiDeletePte(pointerPde, MiPdeToPte(pointerPde), Process, NULL);
|
|
||||||
ASSERT(pointerPde->u.Hard.Valid == 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Release lock */
|
|
||||||
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (MiBalancerThreadHandle != NULL &&
|
if (MiBalancerThreadHandle != NULL &&
|
||||||
!MiIsBalancerThread())
|
!MiIsBalancerThread())
|
||||||
{
|
{
|
||||||
|
@ -407,6 +380,32 @@ MiBalancerThread(PVOID Unused)
|
||||||
{
|
{
|
||||||
ULONG InitialTarget = 0;
|
ULONG InitialTarget = 0;
|
||||||
|
|
||||||
|
#if (_MI_PAGING_LEVELS == 2)
|
||||||
|
if(!MiIsBalancerThread())
|
||||||
|
{
|
||||||
|
/* Clean up the unused PDEs */
|
||||||
|
ULONG_PTR Address;
|
||||||
|
PEPROCESS Process = PsGetCurrentProcess();
|
||||||
|
|
||||||
|
/* Acquire PFN lock */
|
||||||
|
KIRQL OldIrql = KeAcquireQueuedSpinLock(LockQueuePfnLock);
|
||||||
|
PMMPDE pointerPde;
|
||||||
|
for(Address = (ULONG_PTR)MI_LOWEST_VAD_ADDRESS;
|
||||||
|
Address < (ULONG_PTR)MM_HIGHEST_VAD_ADDRESS;
|
||||||
|
Address += (PAGE_SIZE * PTE_COUNT))
|
||||||
|
{
|
||||||
|
if(MmWorkingSetList->UsedPageTableEntries[MiGetPdeOffset(Address)] == 0)
|
||||||
|
{
|
||||||
|
pointerPde = MiAddressToPde(Address);
|
||||||
|
if(pointerPde->u.Hard.Valid)
|
||||||
|
MiDeletePte(pointerPde, MiPdeToPte(pointerPde), Process, NULL);
|
||||||
|
ASSERT(pointerPde->u.Hard.Valid == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Release lock */
|
||||||
|
KeReleaseQueuedSpinLock(LockQueuePfnLock, OldIrql);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ULONG OldTarget = InitialTarget;
|
ULONG OldTarget = InitialTarget;
|
||||||
|
|
Loading…
Reference in a new issue