mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:23:34 +00:00
[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:
parent
f6817e04bc
commit
62e97bd800
1 changed files with 11 additions and 6 deletions
|
@ -164,14 +164,12 @@ MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
|
||||||
PFN_NUMBER CurrentPage;
|
PFN_NUMBER CurrentPage;
|
||||||
PFN_NUMBER NextPage;
|
PFN_NUMBER NextPage;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
(*NrFreedPages) = 0;
|
(*NrFreedPages) = 0;
|
||||||
|
|
||||||
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))
|
||||||
{
|
{
|
||||||
|
@ -179,10 +177,17 @@ MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
|
||||||
Target--;
|
Target--;
|
||||||
(*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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue