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