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

From: William Lee Irwin III
Date: Tue Aug 24 2004 - 18:18:15 EST


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.


On Tue, Aug 24, 2004 at 07:06:56PM -0400, Albert Cahalan wrote:
> Back in the days of a.out, statm also contained lrs
> for libraries. ELF broke this.
> The statm VM size is supposed to count IO mappings.
> So if your X server maps 64 MB of video RAM, then
> the statm file should have a value 64 MB larger than
> the status file has.

This would not be difficult to perform additional accounting for.
I'll follow up with that shortly.


-- wli
-
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/