[NTOSKRNL]

- 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
This commit is contained in:
Cameron Gutman 2011-11-29 08:13:56 +00:00
parent f6817e04bc
commit 62e97bd800

View file

@ -170,8 +170,6 @@ MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
CurrentPage = MmGetLRUFirstUserPage(); CurrentPage = MmGetLRUFirstUserPage();
while (CurrentPage != 0 && Target > 0) while (CurrentPage != 0 && Target > 0)
{ {
NextPage = MmGetLRUNextUserPage(CurrentPage);
Status = MmPageOutPhysicalAddress(CurrentPage); Status = MmPageOutPhysicalAddress(CurrentPage);
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
@ -180,9 +178,16 @@ MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
(*NrFreedPages)++; (*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;
} }
VOID VOID