From nobody Fri Apr 17 19:44:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D9B9C43334 for ; Fri, 22 Jul 2022 16:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235798AbiGVQaO (ORCPT ); Fri, 22 Jul 2022 12:30:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235627AbiGVQaD (ORCPT ); Fri, 22 Jul 2022 12:30:03 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B61692854; Fri, 22 Jul 2022 09:29:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=rSECiOLEGBlvE2WTO5CHndncsAeIAvbvizD2cc+Nr8U=; b=Js2WwYV/jaCg+8Z2sPKjo8aXK5 cwLzycbqzhe83ZRIMU0ipmsYHzorP4S/eQoCPI49kYdW1D4Rbheydx6IfwQ+J2ZaxKazDlT1uvOTQ 6Po64ptbnu8oZB1vlIxcPO3bJIOwiNNKEn5qMN410f2m1DzqT+R1824bgoEKzGbth7hv6Pt2EV4nX rBzs+QA+ljkXb6zL5FdhLT3p2w2A/f8Vtf9wEgPval9K66f9abpdwdfS0ww+V7Eq1yPLhCIJQWBd1 qReELijBf6kyUTEZYkNyrZ1MCyPT7Wc27TRmcfrXznZWXm1idu+Okg48KoXqW2VE9E5Wrl0s1IRmu CCvOGPUA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEvX1-007vOf-As; Fri, 22 Jul 2022 16:29:39 +0000 From: Luis Chamberlain To: ebiederm@xmission.com, corbet@lwn.net, keescook@chromium.org, yzaikin@google.com Cc: songmuchun@bytedance.com, zhangyuchen.lcr@bytedance.com, dhowells@redhat.com, deepa.kernel@gmail.com, hch@lst.de, mcgrof@kernel.org, linux-doc@vger.kernel.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] Documentation/filesystems/proc.rst: remove ancient boiler plate Date: Fri, 22 Jul 2022 09:29:33 -0700 Message-Id: <20220722162934.1888835-2-mcgrof@kernel.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220722162934.1888835-1-mcgrof@kernel.org> References: <20220722162934.1888835-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The proc.rst has some ancient verbiage which dates back to 1999 which is simply just creating noise at this point for documentation. Remove that cruft. Signed-off-by: Luis Chamberlain --- Documentation/filesystems/proc.rst | 55 ------------------------------ 1 file changed, 55 deletions(-) diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems= /proc.rst index 47e95dbc820d..9fd5249f1a5f 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -4,22 +4,8 @@ The /proc Filesystem =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D -/proc/sys Terrehon Bowden , October 7 = 1999 - Bodo Bauer -2.4.x update Jorge Nerin November 14 2= 000 -move /proc/sys Shen Feng April 1 2009 -fixes/update part 1.1 Stefani Seibold June 9 2009 -=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D - - - .. Table of Contents =20 - 0 Preface - 0.1 Introduction/Credits - 0.2 Legal Stuff - 1 Collecting System Information 1.1 Process-Specific Subdirectories 1.2 Kernel data @@ -56,47 +42,6 @@ fixes/update part 1.1 Stefani Seibold June 9 2009 Preface =3D=3D=3D=3D=3D=3D=3D =20 -0.1 Introduction/Credits ------------------------- - -This documentation is part of a soon (or so we hope) to be released boo= k on -the SuSE Linux distribution. As there is no complete documentation for= the -/proc file system and we've used many freely available sources to write t= hese -chapters, it seems only fair to give the work back to the Linux commun= ity. -This work is based on the 2.2.* kernel version and the upcoming 2.4.*. = I'm -afraid it's still far from complete, but we hope it will be useful. As fa= r as -we know, it is the first 'all-in-one' document about the /proc file system= . It -is focused on the Intel x86 hardware, so if you are looking for PPC, = ARM, -SPARC, AXP, etc., features, you probably won't find what you are looking = for. -It also only covers IPv4 networking, not IPv6 nor other protocols - sorry.= But -additions and patches are welcome and will be added to this document if= you -mail them to Bodo. - -We'd like to thank Alan Cox, Rik van Riel, and Alexey Kuznetsov and a lo= t of -other people for help compiling this documentation. We'd also like to exte= nd a -special thank you to Andi Kleen for documentation, which we relied on hea= vily -to create this document, as well as the additional information he provi= ded. -Thanks to everybody else who contributed source or docs to the Linux ke= rnel -and helped create a great piece of software... :) - -If you have any comments, corrections or additions, please don't hesitat= e to -contact Bodo Bauer at bb@ricochet.net. We'll be happy to add them to = this -document. - -The latest version of this document is available online = at -http://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html - -If the above direction does not works for you, you could try the ke= rnel -mailing list at linux-kernel@vger.kernel.org and/or try to reach me= at -comandante@zaralinux.com. - -0.2 Legal Stuff ---------------- - -We don't guarantee the correctness of this document, and if you come t= o us -complaining about how you screwed up your system because of incor= rect -documentation, we won't feel responsible... - Chapter 1: Collecting System Information =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 --=20 2.35.1 From nobody Fri Apr 17 19:44:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6C27C433EF for ; Fri, 22 Jul 2022 16:30:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235622AbiGVQaB (ORCPT ); Fri, 22 Jul 2022 12:30:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbiGVQ3y (ORCPT ); Fri, 22 Jul 2022 12:29:54 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8DE691CD5; Fri, 22 Jul 2022 09:29:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=dfsvCtbqj1aTabifZLD8rO8Jn7E44Br7CNa+F9C5WOo=; b=Eh0R/EMH/rCoU82UJQhON4r0qZ qqmUefp4at7/z2HepFQw3gDMVCE719zc+a/allPpuCx/8Mi5FyLndHi8qs+tkuUJMog80gIvoc/a6 TKzO7Qf23pJPkOncSRAcwZfP6QOs1W28Vr68g8EmOc1RgQO0xuPY1XFE9MNhgCKU57JSzDRyEs9Q1 +65qpuaaWRCVcjTxI4rU/nUdY8ESPq6vi8fgrkw6liUVeh7UTJA9qbYr2bQ6DrpiHoAGh5toS5k3M 5HWKNJOoIo+81NOoC0QqXdZ3RR45Bn+MA1JORBKDGG2e7r9qUVvMx8RzV30FP3wk7Yr9MIN4f3w2j eNfN8liQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEvX1-007vOh-CK; Fri, 22 Jul 2022 16:29:39 +0000 From: Luis Chamberlain To: ebiederm@xmission.com, corbet@lwn.net, keescook@chromium.org, yzaikin@google.com Cc: songmuchun@bytedance.com, zhangyuchen.lcr@bytedance.com, dhowells@redhat.com, deepa.kernel@gmail.com, hch@lst.de, mcgrof@kernel.org, linux-doc@vger.kernel.org, linux-api@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] Documentation/filesystems/proc.rst: document procfs inode timestamps Date: Fri, 22 Jul 2022 09:29:34 -0700 Message-Id: <20220722162934.1888835-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220722162934.1888835-1-mcgrof@kernel.org> References: <20220722162934.1888835-1-mcgrof@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The timestamps for procfs files are not well understood and can confuse users and developers [0] in particular for the timestamp for the start time or a process. Clarify what they mean and that they are a reflection of the ephemeral nature of the filesystem inodes. The procfs inodes are created when you first read them and then stuffed in the page cache. If the page cache and indodes are reclaimed they can be removed, and re-created with a new timestamp after read again. Document this little bit of tribal knowledge. [0] https://lkml.kernel.org/r/20220721081617.36103-1-zhangyuchen.lcr@byteda= nce.com Reported-by: Zhang Yuchen Signed-off-by: Luis Chamberlain --- Documentation/filesystems/proc.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/filesystems/proc.rst b/Documentation/filesystems= /proc.rst index 9fd5249f1a5f..9defe9af683a 100644 --- a/Documentation/filesystems/proc.rst +++ b/Documentation/filesystems/proc.rst @@ -59,6 +59,15 @@ The proc file system acts as an interface to internal = data structures in the kernel. It can be used to obtain information about the system and to ch= ange certain kernel parameters at runtime (sysctl). =20 +The proc files are dynamic in nature and allow for developers to make the +content to be changed each time a file is read. The proc files and directo= ries +inodes are created when someone first reads a respective proc file or dire= ctory, +as such the timestamps of the proc files reflect this time. As with other +filesystems, these proc inodes can be removed through reclaim under memory +pressure and so the timestamps of the proc files can change if the proc fi= les +are destroyed and re-created (echo 3 > /proc/sys/vm/drop_caches forces and +illustrate the reclaim of inodes and page cache). + First, we'll take a look at the read-only parts of /proc. In Chapter 2= , we show you how you can use /proc/sys to change settings. =20 @@ -328,6 +337,13 @@ It's slow but very precise. system call =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D =20 +Note that the start_time inside the stat file is different than the timest= amp +of the stat file itself. The timestamp of the stat file simply reflects the +first time the stat file was read. The proc inode for this file can be rec= laimed +under memory pressure and be recreated after this and so the timestamp can +change. Userspace should rely on the start_time entry in the the stat file= to +get a process start time. + The /proc/PID/maps file contains the currently mapped memory regions and their access permissions. =20 --=20 2.35.1