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>
6 .\" SPDX-License-Identifier: GPL-3.0-or-later
8 .TH proc_pid_clear_refs 5 (date) "Linux man-pages (unreleased)"
10 /proc/pid/clear_refs \- reset the PG_Referenced and ACCESSED/YOUNG bits
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)
18 .\" "Clears page referenced bits shown in smaps output"
19 .\" write-only, writable only by the owner of the process
21 This is a write-only file, writable only by owner of the process.
23 The following values may be written to the file:
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
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.
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.
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
49 to get an idea of the memory footprint of the
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.
59 Further values can be written to affect different properties:
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
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.
79 .IR /proc/ pid /clear_refs
80 other than those listed above has no effect.
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.