preliminary comment out the self-modifying code for RtlPrefetchMemoryNonTemporal
[reactos.git] / reactos / ntoskrnl / mm / wset.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/mm/wset.c
6 * PURPOSE: Manages working sets
7 *
8 * PROGRAMMERS: David Welch (welch@cwcom.net)
9 */
10
11 /* INCLUDES *****************************************************************/
12
13 #include <ntoskrnl.h>
14 #define NDEBUG
15 #include <internal/debug.h>
16
17 /* FUNCTIONS *****************************************************************/
18
19 NTSTATUS
20 MmTrimUserMemory(ULONG Target, ULONG Priority, PULONG NrFreedPages)
21 {
22 PFN_TYPE CurrentPage;
23 PFN_TYPE NextPage;
24 NTSTATUS Status;
25
26 (*NrFreedPages) = 0;
27
28 CurrentPage = MmGetLRUFirstUserPage();
29 while (CurrentPage != 0 && Target > 0)
30 {
31 NextPage = MmGetLRUNextUserPage(CurrentPage);
32
33 Status = MmPageOutPhysicalAddress(CurrentPage);
34 if (NT_SUCCESS(Status))
35 {
36 DPRINT("Succeeded\n");
37 Target--;
38 (*NrFreedPages)++;
39 }
40 else if (Status == STATUS_PAGEFILE_QUOTA)
41 {
42 MmSetLRULastPage(CurrentPage);
43 }
44
45 CurrentPage = NextPage;
46 }
47 return(STATUS_SUCCESS);
48 }
49
50 /*
51 * @unimplemented
52 */
53 ULONG
54 STDCALL
55 MmTrimAllSystemPagableMemory (
56 IN ULONG PurgeTransitionList
57 )
58 {
59 UNIMPLEMENTED;
60 return 0;
61 }