mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:33:10 +00:00
[NTOS:Mm] Implement MmRebalanceMemoryConsumersAndWait
This commit is contained in:
parent
7c6e4d38c7
commit
047dc9729f
1 changed files with 16 additions and 0 deletions
|
@ -33,6 +33,7 @@ static ULONG MiMinimumPagesPerRun;
|
||||||
static CLIENT_ID MiBalancerThreadId;
|
static CLIENT_ID MiBalancerThreadId;
|
||||||
static HANDLE MiBalancerThreadHandle = NULL;
|
static HANDLE MiBalancerThreadHandle = NULL;
|
||||||
static KEVENT MiBalancerEvent;
|
static KEVENT MiBalancerEvent;
|
||||||
|
static KEVENT MiBalancerDoneEvent;
|
||||||
static KTIMER MiBalancerTimer;
|
static KTIMER MiBalancerTimer;
|
||||||
|
|
||||||
static LONG PageOutThreadActive;
|
static LONG PageOutThreadActive;
|
||||||
|
@ -296,6 +297,19 @@ MmRebalanceMemoryConsumers(VOID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
MmRebalanceMemoryConsumersAndWait(VOID)
|
||||||
|
{
|
||||||
|
ASSERT(PsGetCurrentProcess()->AddressCreationLock.Owner != KeGetCurrentThread());
|
||||||
|
ASSERT(!MM_ANY_WS_LOCK_HELD(PsGetCurrentThread()));
|
||||||
|
ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL);
|
||||||
|
|
||||||
|
KeResetEvent(&MiBalancerDoneEvent);
|
||||||
|
MmRebalanceMemoryConsumers();
|
||||||
|
KeWaitForSingleObject(&MiBalancerDoneEvent, Executive, KernelMode, FALSE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
MmRequestPageMemoryConsumer(ULONG Consumer, BOOLEAN CanWait,
|
||||||
|
@ -334,6 +348,7 @@ MiBalancerThread(PVOID Unused)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
KeSetEvent(&MiBalancerDoneEvent, IO_NO_INCREMENT, FALSE);
|
||||||
Status = KeWaitForMultipleObjects(2,
|
Status = KeWaitForMultipleObjects(2,
|
||||||
WaitObjects,
|
WaitObjects,
|
||||||
WaitAny,
|
WaitAny,
|
||||||
|
@ -388,6 +403,7 @@ MiInitBalancerThread(VOID)
|
||||||
LARGE_INTEGER Timeout;
|
LARGE_INTEGER Timeout;
|
||||||
|
|
||||||
KeInitializeEvent(&MiBalancerEvent, SynchronizationEvent, FALSE);
|
KeInitializeEvent(&MiBalancerEvent, SynchronizationEvent, FALSE);
|
||||||
|
KeInitializeEvent(&MiBalancerDoneEvent, SynchronizationEvent, FALSE);
|
||||||
KeInitializeTimerEx(&MiBalancerTimer, SynchronizationTimer);
|
KeInitializeTimerEx(&MiBalancerTimer, SynchronizationTimer);
|
||||||
|
|
||||||
Timeout.QuadPart = -20000000; /* 2 sec */
|
Timeout.QuadPart = -20000000; /* 2 sec */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue