Author: cgutman
Date: Tue Nov 29 08:13:56 2011
New Revision: 54534
URL:
http://svn.reactos.org/svn/reactos?rev=54534&view=rev
Log:
[NTOSKRNL]
- Fix a potential infinite loop in MmTrimUserMemory if we can't page out enough pages
to meet the balancer's target
Modified:
trunk/reactos/ntoskrnl/mm/balance.c
Modified: trunk/reactos/ntoskrnl/mm/balance.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/mm/balance.c?rev=…
==============================================================================
--- trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/mm/balance.c [iso-8859-1] Tue Nov 29 08:13:56 2011
@@ -164,14 +164,12 @@
PFN_NUMBER CurrentPage;
PFN_NUMBER NextPage;
NTSTATUS Status;
-
+
(*NrFreedPages) = 0;
-
+
CurrentPage = MmGetLRUFirstUserPage();
while (CurrentPage != 0 && Target > 0)
{
- NextPage = MmGetLRUNextUserPage(CurrentPage);
-
Status = MmPageOutPhysicalAddress(CurrentPage);
if (NT_SUCCESS(Status))
{
@@ -179,10 +177,17 @@
Target--;
(*NrFreedPages)++;
}
-
+
+ NextPage = MmGetLRUNextUserPage(CurrentPage);
+ if (NextPage <= CurrentPage)
+ {
+ /* We wrapped around, so we're done */
+ break;
+ }
CurrentPage = NextPage;
}
- return(STATUS_SUCCESS);
+
+ return STATUS_SUCCESS;
}
VOID