]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man5/proc_pid_clear_refs.5
proc_sys.5, proc_sys_dev.5: Split /proc/sys/dev/ from proc_sys(5)
[thirdparty/man-pages.git] / man5 / proc_pid_clear_refs.5
1 .\" Copyright (C) 1994, 1995, Daniel Quinlan <quinlan@yggdrasil.com>
2 .\" Copyright (C) 2002-2008, 2017, Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" Copyright (C) 2023, Alejandro Colomar <alx@kernel.org>
4 .\"
5 .\" SPDX-License-Identifier: GPL-3.0-or-later
6 .\"
7 .TH proc_pid_clear_refs 5 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 /proc/pid/clear_refs \- reset the PG_Referenced and ACCESSED/YOUNG bits
10 .SH DESCRIPTION
11 .TP
12 .IR /proc/ pid /clear_refs " (since Linux 2.6.22)"
13 .\" commit b813e931b4c8235bb42e301096ea97dbdee3e8fe (2.6.22)
14 .\" commit 398499d5f3613c47f2143b8c54a04efb5d7a6da9 (2.6.32)
15 .\" commit 040fa02077de01c7e08fa75be6125e4ca5636011 (3.11)
16 .\"
17 .\" "Clears page referenced bits shown in smaps output"
18 .\" write-only, writable only by the owner of the process
19 .IP
20 This is a write-only file, writable only by owner of the process.
21 .IP
22 The following values may be written to the file:
23 .RS
24 .TP
25 1 (since Linux 2.6.22)
26 .\" Internally: CLEAR_REFS_ALL
27 Reset the PG_Referenced and ACCESSED/YOUNG
28 bits for all the pages associated with the process.
29 (Before Linux 2.6.32, writing any nonzero value to this file
30 had this effect.)
31 .TP
32 2 (since Linux 2.6.32)
33 .\" Internally: CLEAR_REFS_ANON
34 Reset the PG_Referenced and ACCESSED/YOUNG
35 bits for all anonymous pages associated with the process.
36 .TP
37 3 (since Linux 2.6.32)
38 .\" Internally: CLEAR_REFS_MAPPED
39 Reset the PG_Referenced and ACCESSED/YOUNG
40 bits for all file-mapped pages associated with the process.
41 .RE
42 .IP
43 Clearing the PG_Referenced and ACCESSED/YOUNG bits provides a method
44 to measure approximately how much memory a process is using.
45 One first inspects the values in the "Referenced" fields
46 for the VMAs shown in
47 .IR /proc/ pid /smaps
48 to get an idea of the memory footprint of the
49 process.
50 One then clears the PG_Referenced and ACCESSED/YOUNG bits
51 and, after some measured time interval,
52 once again inspects the values in the "Referenced" fields
53 to get an idea of the change in memory footprint of the
54 process during the measured interval.
55 If one is interested only in inspecting the selected mapping types,
56 then the value 2 or 3 can be used instead of 1.
57 .IP
58 Further values can be written to affect different properties:
59 .RS
60 .TP
61 4 (since Linux 3.11)
62 Clear the soft-dirty bit for all the pages associated with the process.
63 .\" Internally: CLEAR_REFS_SOFT_DIRTY
64 This is used (in conjunction with
65 .IR /proc/ pid /pagemap )
66 by the check-point restore system to discover which pages of a process
67 have been dirtied since the file
68 .IR /proc/ pid /clear_refs
69 was written to.
70 .TP
71 5 (since Linux 4.0)
72 .\" Internally: CLEAR_REFS_MM_HIWATER_RSS
73 Reset the peak resident set size ("high water mark") to the process's
74 current resident set size value.
75 .RE
76 .IP
77 Writing any value to
78 .IR /proc/ pid /clear_refs
79 other than those listed above has no effect.
80 .IP
81 The
82 .IR /proc/ pid /clear_refs
83 file is present only if the
84 .B CONFIG_PROC_PAGE_MONITOR
85 kernel configuration option is enabled.
86 .SH SEE ALSO
87 .BR proc (5)