3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/mm/wset.c
6 * PURPOSE: Manages working sets
8 * PROGRAMMERS: David Welch (welch@cwcom.net)
11 /* INCLUDES *****************************************************************/
15 #include <internal/debug.h>
17 /* FUNCTIONS *****************************************************************/
20 MmTrimUserMemory(ULONG Target
, ULONG Priority
, PULONG NrFreedPages
)
28 CurrentPage
= MmGetLRUFirstUserPage();
29 while (CurrentPage
!= 0 && Target
> 0)
31 NextPage
= MmGetLRUNextUserPage(CurrentPage
);
33 Status
= MmPageOutPhysicalAddress(CurrentPage
);
34 if (NT_SUCCESS(Status
))
36 DPRINT("Succeeded\n");
40 else if (Status
== STATUS_PAGEFILE_QUOTA
)
42 MmSetLRULastPage(CurrentPage
);
45 CurrentPage
= NextPage
;
47 return(STATUS_SUCCESS
);
55 MmTrimAllSystemPagableMemory (
56 IN ULONG PurgeTransitionList