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