proc_pid_clear_refs(5)
๐ proc_pid_clear_refs(5) โ the girlies' guide ๐
ok so this is a page from the File Formats Manual, bestie, and it's all about one very specific little file. let's get into it ๐ซถ
โจ NAME โจ
/proc/pid/clear_refs โ reset the PG_Referenced and ACCESSED/YOUNG bits
๐ธ DESCRIPTION ๐ธ
/proc/pid/clear_refs (since Linux 2.6.22)
okay so first thing, the vibe check: this is a write-only file. you can't read it, no ma'am. and it's writable only by the owner of the process โ so like, it's giving exclusive, invite-only energy. ๐
here's what you can write to it:
1(since Linux 2.6.22) โ reset thePG_ReferencedandACCESSED/YOUNGbits for all the pages associated with the process. ๐ซถ
๐จ lore drop: before Linux 2.6.32, writing any nonzero value to this file had this exact effect. so like, back then, 7 and 1 were the same thing, no cap.
2(since Linux 2.6.32) โ reset thePG_ReferencedandACCESSED/YOUNGbits for all the anonymous pages associated with the process.3(since Linux 2.6.32) โ reset thePG_ReferencedandACCESSED/YOUNGbits for all the file-mapped pages associated with the process.
๐ฆ why would you even do that tho ๐ฆ
clearing the PG_Referenced and ACCESSED/YOUNG bits gives you a method to measure approximately how much memory a process is using. it's a whole little ritual and honestly it slays:
- first, you go inspect the values in the
"Referenced"fields for the VMAs shown in/proc/pid/smapsโ that gives you an idea of the memory footprint of the process. โจ - then you clear the
PG_ReferencedandACCESSED/YOUNGbits, and after some measured time interval, you go inspect those"Referenced"fields again โ that gives you an idea of the change in memory footprint of the process during the measured interval. ๐ซ
and if you're only interested in inspecting the selected mapping types? then you can use the value 2 or 3 instead of 1. periodt. ๐
๐ further values (yes, there's more) ๐
4(since Linux 3.11) โ clear the soft-dirty bit for all the pages associated with the process. this one is used, in conjunction with/proc/pid/pagemap, by the check-point restore system to discover which pages of a process have been dirtied since the file/proc/pid/clear_refswas written to. iykyk ๐ง5(since Linux 4.0) โ reset the peak resident set size (the "high water mark", iconic name tbh) to the process's current resident set size value. ๐
๐ the fine print (important, bestie, don't skip) ๐
writing any value to /proc/pid/clear_refs other than those listed above has no effect. literally nothing happens. the file is not gagged, it's just unbothered. ๐
alsoooo: the/proc/pid/clear_refsfile is present only if theCONFIG_PROC_PAGE_MONITORkernel configuration option is enabled. no config option, no file, no ~vibes~. ๐
๐ SEE ALSO ๐
proc(5)โ the mothership, the main character, go read her ๐ซถ
written up in Linux man-pages 6.20, dated 2026-02-08, for all my proc_pid_clear_refs(5) girlies โ stay hydrated, clear your bits, and remember: write-only means write-only ๐โจ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: GPL-3.0-or-later
- Copyright 1994-1995, Daniel Quinlan <Daniel.Quinlan@linux.org>
- Copyright 2002-2017, Michael Kerrisk <mtk.manpages@gmail.com>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms