public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Albert Cahalan <albert@users.sf.net>
Cc: Andrea Arcangeli <andrea@novell.com>,
	Hugh Dickins <hugh@veritas.com>,
	linux-kernel mailing list <linux-kernel@vger.kernel.org>,
	Andrew Morton OSDL <akpm@osdl.org>,
	Albert Cahalan <albert@users.sourceforge.net>
Subject: Re: per-process shared information
Date: Fri, 15 Oct 2004 10:10:47 -0700	[thread overview]
Message-ID: <20041015171047.GM5607@holomorphy.com> (raw)
In-Reply-To: <1097857912.2669.13548.camel@cube>

On Fri, Oct 15, 2004 at 12:31:52PM -0400, Albert Cahalan wrote:
> Currently, ps uses /proc/*/stat for that. The /proc/*/statm
> file is read to determine TRS and DRS, which are broken now.
> That it, unless you count "ps -o OL_m" format.
> The top program uses /proc/*/statm for many more fields:

And here I refute every last field with a description of what 2.4.x
actually implemented and how its implementation renders the field
gibberish.


On Fri, Oct 15, 2004 at 12:31:52PM -0400, Albert Cahalan wrote:
> %MEM  Memory usage (RES)
> RES   Resident size (kb)

These would be the valid pages installed into pagetable entries,
which differs from RSS by racing with pagetable updates while counting
up pages one-by-one, where it could otherwise just use the RSS count in
the mm.


On Fri, Oct 15, 2004 at 12:31:52PM -0400, Albert Cahalan wrote:
> VIRT  Virtual Image (kb)

This one isn't even close to VSZ in 2.4. This is the number of
allocated non-pte_none() ptes under vmas, which has no bearing on
any meaningful statistics, as not even pagetable space consumption
may be inferred from it due to alignment issues.


On Fri, Oct 15, 2004 at 12:31:52PM -0400, Albert Cahalan wrote:
> SWAP  Swapped size (kb)

This isn't actually calculated by 2.4, and can't be inferred from it
either, as swapped pages are indistinguishable from reserved pages
according to /proc/, most prominently the zero page.


On Fri, Oct 15, 2004 at 12:31:52PM -0400, Albert Cahalan wrote:
> CODE  Code size (kb)

This is the subset of the miscalculated RSS under VM_EXECUTABLE vmas,
hence it's a miscalculated subset of the RSS.


On Fri, Oct 15, 2004 at 12:31:52PM -0400, Albert Cahalan wrote:
> DATA  Data+Stack size (kb)

This is the subset of the miscalculated RSS under VM_GROWSDOWN
vmas, which is incorrect for stack-grows-upward architectures,
or are entirely below 0x60000000, which is pure gibberish.


On Fri, Oct 15, 2004 at 12:31:52PM -0400, Albert Cahalan wrote:
> SHR   Shared Mem size (kb)

page_count(pte_page(pte)) > 1; this is gibberish on numerous levels,
which Hugh pointed out, that is, owing to the references held by
pagecache, swapcache, and the like.


On Fri, Oct 15, 2004 at 12:31:52PM -0400, Albert Cahalan wrote:
> nDRT  Dirty Pages count

A count of dirty ptes, not dirty pages. This is meaningless for
most purposes except perhaps mmap() IO, and it's rather dubious
even then. These are not the dirty physical pages, or anything else
remotely meaningful to common scenarios. For instance, when userspace
uses a single buffer page for numerous write(2) calls, it actually
dirties large amounts of pagecache, but only dirties 1 page according
to this metric. When read/write sharing occurs, there is no trace of
other processes' having dirtied the page. Furthermore, ptes are dirtied
in numerous cases when the page has not been modified. For instance,
when the region has been mapped read/write but only a read fault was
taken. So our last field is meaningless.

Thus we are left with exactly zero fields which are not gibberish in 2.4,
and 2.4.x semantics have no leg left to stand upon.


-- wli

  reply	other threads:[~2004-10-15 17:18 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-13 23:10 per-process shared information Andrea Arcangeli
2004-10-14 21:47 ` Marcelo Tosatti
2004-10-14 23:58   ` Andrea Arcangeli
2004-10-14 23:17     ` Marcelo Tosatti
2004-10-15 10:45     ` William Lee Irwin III
2004-10-14 21:49 ` Hugh Dickins
2004-10-14 22:11   ` William Lee Irwin III
2004-10-14 22:37   ` Andrea Arcangeli
2004-10-15 10:51     ` William Lee Irwin III
2004-10-15 11:56     ` Hugh Dickins
2004-10-15 13:19       ` Albert Cahalan
2004-10-15 14:28         ` William Lee Irwin III
2004-10-15 14:40           ` Albert Cahalan
2004-10-15 14:52             ` William Lee Irwin III
2004-10-15 17:02             ` Andrea Arcangeli
2004-10-15 16:20         ` Andrea Arcangeli
2004-10-15 16:31           ` Albert Cahalan
2004-10-15 17:10             ` William Lee Irwin III [this message]
2004-10-15 19:29               ` Albert Cahalan
2004-10-15 17:13             ` Andrea Arcangeli
2004-10-15 17:51               ` Albert Cahalan
2004-10-15 18:14                 ` Andrea Arcangeli
2004-10-15 18:30                   ` William Lee Irwin III
2004-10-15 18:40                     ` Andrea Arcangeli
2004-10-15 18:47                       ` William Lee Irwin III
2004-10-15 19:23                         ` Andrea Arcangeli
2004-10-15 20:41                           ` William Lee Irwin III
2004-10-15 20:52                             ` Andrea Arcangeli
2004-10-15 21:16                         ` William Lee Irwin III
2004-10-15 21:28                           ` Andrea Arcangeli
2004-10-15 21:40                             ` William Lee Irwin III
2004-10-15 22:04                               ` Hugh Dickins
2004-10-19 15:09           ` Bill Davidsen
2004-10-15 16:04       ` Andrea Arcangeli
2004-10-19 15:18         ` Bill Davidsen

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=20041015171047.GM5607@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@osdl.org \
    --cc=albert@users.sf.net \
    --cc=albert@users.sourceforge.net \
    --cc=andrea@novell.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.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