- Fix a potential infinite loop in MmTrimUserMemory if we can't page out enough pages to meet the balancer's target
svn path=/trunk/; revision=54534
PFN_NUMBER CurrentPage;
PFN_NUMBER NextPage;
NTSTATUS Status;
PFN_NUMBER CurrentPage;
PFN_NUMBER NextPage;
NTSTATUS Status;
CurrentPage = MmGetLRUFirstUserPage();
while (CurrentPage != 0 && Target > 0)
{
CurrentPage = MmGetLRUFirstUserPage();
while (CurrentPage != 0 && Target > 0)
{
- NextPage = MmGetLRUNextUserPage(CurrentPage);
-
Status = MmPageOutPhysicalAddress(CurrentPage);
if (NT_SUCCESS(Status))
{
Status = MmPageOutPhysicalAddress(CurrentPage);
if (NT_SUCCESS(Status))
{
Target--;
(*NrFreedPages)++;
}
Target--;
(*NrFreedPages)++;
}
+
+ NextPage = MmGetLRUNextUserPage(CurrentPage);
+ if (NextPage <= CurrentPage)
+ {
+ /* We wrapped around, so we're done */
+ break;
+ }
CurrentPage = NextPage;
}
CurrentPage = NextPage;
}
- return(STATUS_SUCCESS);
+
+ return STATUS_SUCCESS;