- Status = KeWaitForSingleObject(&PagerThreadEvent,
- 0,
- KernelMode,
- FALSE,
- NULL);
- if (!NT_SUCCESS(Status))
- {
- DbgPrint("PagerThread: Wait failed\n");
- KeBugCheck(0);
- }
- if (PagerThreadShouldTerminate)
- {
- DbgPrint("PagerThread: Terminating\n");
- return(STATUS_SUCCESS);
- }
+ /* Wake for a low memory situation or a terminate request. */
+ Status = KeWaitForSingleObject(&PagerThreadEvent,
+ 0,
+ KernelMode,
+ FALSE,
+ NULL);
+ if (!NT_SUCCESS(Status))
+ {
+ DbgPrint("PagerThread: Wait failed\n");
+ KEBUGCHECK(0);
+ }
+ if (PagerThreadShouldTerminate)
+ {
+ DbgPrint("PagerThread: Terminating\n");
+ return(STATUS_SUCCESS);
+ }
+ do
+ {
+ /* Try and make some memory available to the system. */
+ MmRebalanceMemoryConsumers();
+ } while(PagerThreadWorkCount > 0);