linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, linux-doc@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,
	David Hildenbrand <david@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jonathan Corbet <corbet@lwn.net>
Subject: [PATCH v1 6/6] Documentation/admin-guide/mm/pagemap.rst: drop "Using pagemap to do something useful"
Date: Fri,  7 Jun 2024 14:23:57 +0200	[thread overview]
Message-ID: <20240607122357.115423-7-david@redhat.com> (raw)
In-Reply-To: <20240607122357.115423-1-david@redhat.com>

That example was added in 2008. In 2015, we restricted access to the
PFNs in the pagemap to CAP_SYS_ADMIN, making that approach quite less
usable.

It's 2024 now, and using that racy and low-lewel mechanism to calculate the
USS should not be considered a good example anymore. /proc/$pid/smaps
and /proc/$pid/smaps_rollup can do a much better job without any of
that low-level handling.

Let's just drop that example.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 Documentation/admin-guide/mm/pagemap.rst | 21 ---------------------
 1 file changed, 21 deletions(-)

diff --git a/Documentation/admin-guide/mm/pagemap.rst b/Documentation/admin-guide/mm/pagemap.rst
index f5f065c67615d..f2817a8015962 100644
--- a/Documentation/admin-guide/mm/pagemap.rst
+++ b/Documentation/admin-guide/mm/pagemap.rst
@@ -173,27 +173,6 @@ LRU related page flags
 The page-types tool in the tools/mm directory can be used to query the
 above flags.
 
-Using pagemap to do something useful
-====================================
-
-The general procedure for using pagemap to find out about a process' memory
-usage goes like this:
-
- 1. Read ``/proc/pid/maps`` to determine which parts of the memory space are
-    mapped to what.
- 2. Select the maps you are interested in -- all of them, or a particular
-    library, or the stack or the heap, etc.
- 3. Open ``/proc/pid/pagemap`` and seek to the pages you would like to examine.
- 4. Read a u64 for each page from pagemap.
- 5. Open ``/proc/kpagecount`` and/or ``/proc/kpageflags``.  For each PFN you
-    just read, seek to that entry in the file, and read the data you want.
-
-For example, to find the "unique set size" (USS), which is the amount of
-memory that a process is using that is not shared with any other process,
-you can go through every map in the process, find the PFNs, look those up
-in kpagecount, and tally up the number of pages that are only referenced
-once.
-
 Exceptions for Shared Memory
 ============================
 
-- 
2.45.2


  parent reply	other threads:[~2024-06-07 12:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 12:23 [PATCH v1 0/6] fs/proc: move page_mapcount() to fs/proc/internal.h David Hildenbrand
2024-06-07 12:23 ` [PATCH v1 1/6] fs/proc/task_mmu: indicate PM_FILE for PMD-mapped file THP David Hildenbrand
2024-06-07 13:21   ` Kirill A . Shutemov
2024-06-07 13:36   ` Lance Yang
2024-06-10  4:32   ` Oscar Salvador
2024-06-07 12:23 ` [PATCH v1 2/6] fs/proc/task_mmu: don't indicate PM_MMAP_EXCLUSIVE without PM_PRESENT David Hildenbrand
2024-06-10  4:38   ` Oscar Salvador
2024-06-11  7:13     ` Oscar Salvador
2024-06-11 10:51       ` David Hildenbrand
2024-06-11 10:45     ` David Hildenbrand
2024-06-10  4:49   ` Oscar Salvador
2024-06-11 10:50     ` David Hildenbrand
2024-06-11 11:15       ` Oscar Salvador
2024-06-07 12:23 ` [PATCH v1 3/6] fs/proc/task_mmu: properly detect PM_MMAP_EXCLUSIVE per page of PMD-mapped THPs David Hildenbrand
2024-06-10  4:51   ` Oscar Salvador
2024-06-07 12:23 ` [PATCH v1 4/6] fs/proc/task_mmu: account non-present entries as "maybe shared, but no idea how often" David Hildenbrand
2024-06-07 12:23 ` [PATCH v1 5/6] fs/proc: move page_mapcount() to fs/proc/internal.h David Hildenbrand
2024-06-07 12:23 ` David Hildenbrand [this message]
2024-06-07 13:18 ` [PATCH v1 0/6] " Oscar Salvador

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240607122357.115423-7-david@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).