Re: fix text reporting in O(1) proc_pid_statm()

From: Albert Cahalan
Date: Tue Aug 24 2004 - 21:55:42 EST


On Tue, 2004-08-24 at 19:12, William Lee Irwin III wrote:
> At some point in the past, I wrote:
> >> - *text = mm->exec_vm - ((mm->end_code - mm->start_code) >> PAGE_SHIFT);
> >> - *data = mm->total_vm - mm->shared_vm;
> >> + *text = (mm->end_code - mm->start_code) >> PAGE_SHIFT;
> >> + *data = mm->total_vm - mm->shared_vm - *text;
>
> On Tue, Aug 24, 2004 at 07:06:56PM -0400, Albert Cahalan wrote:
> > It's actually still wrong. This has been broken for
> > a very long time. It you can fix it, great. Otherwise
> > this is a useless value, since /proc/*/stat provides
> > start_code and end_code already.
> > The statm file is supposed to contain a field known
> > as "trs" or "trss". This is like rss, but text-only.
> > Likewise, statm also contains "drs" or "drss" for data.
> > When you subtract start_code from end_code, you're
> > generating a value known as "tsiz" (the text size).
> > The statm file is supposed to supply trs, not tsiz.
>
> The current 2.6 semantics are purely virtual, so this merely
> reimplements those semantics more efficiently. The scheme you
> describe would require accounting at the time of pte modification
> to implement in a like fashion, which has been rejected.

Hmmm, why not reject RSS too then? It's the same thing.

If trs and drs and so on were kept, then rss would
just be the sum of them. Per-permission tracking
seems about right:

rss[perms] += change;

(where "perms" is rwx plus shared/private and dirty/clean)

At some point, it would be good to have per-vma rss.
This would be displayed by the pmap command's -x option.
(added to /proc/*/maps right before the filename)


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/