summaryrefslogtreecommitdiffstats
path: root/man5/proc_pid_clear_refs.5
diff options
context:
space:
mode:
Diffstat (limited to 'man5/proc_pid_clear_refs.5')
-rw-r--r--man5/proc_pid_clear_refs.587
1 files changed, 87 insertions, 0 deletions
diff --git a/man5/proc_pid_clear_refs.5 b/man5/proc_pid_clear_refs.5
new file mode 100644
index 0000000..134a3b9
--- /dev/null
+++ b/man5/proc_pid_clear_refs.5
@@ -0,0 +1,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 2023-09-07 "Linux man-pages 6.7"
+.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)