Re: /proc/*/statm, exactly what does "shared" mean?

From: Richard F. Rebel
Date: Thu Feb 17 2005 - 11:35:41 EST


Hello Hugh,

On Wed, 2005-02-16 at 16:10 +0000, Hugh Dickins wrote:
> On Wed, 16 Feb 2005, Richard F. Rebel wrote:
> >
> > I have heard that this particular information, while very important to
> > userland developers like me, is probably too expensive to keep track of
> > for most users.
> >
> > Perhaps a way to enable it for developers, whom are willing to spend the
> > cpu cycles, and disable it for regular use would be a solution.
> >
> > Would it be possible develop a solution allowing us to enable/disable
> > this tracking via a sysctl call?
>
> Possible, but I don't think a sysctl would make much sense here.
>
> The most important thing is that any heavyweight information gathering
> should not be happening by default, as a side-effect of something
> frequently run.

Okay and agreed.

> So a lot of people would oppose putting back any such heavyweight
> work into any of the /proc/<pid>/statm fields. But if it goes into
> a separate /proc/<pid>/whatever, not read by current tools, then
> it's much less of a problem.
>
> I'm still resistant, because I think if the information you're
> interested in (how many private pages shared across forks) really
> were of interest to many people, then someone would soon write a
> top-like tool which kept sampling these values, and we'd be back to
> the original situation. Or if it's not of interest to many people,
> then isn't it better off as an out-of-tree patch?

Well, let's put it this way. In general, would you agree that the bulk
of Linux servers on the internet run apache? It's also not hard to
assume that many of these also run apache+php or apache+mod_perl.

Apache has lots of modules and code that can easily be shared between
processes. Especially when you use mod_perl or php. This sharing
significantly effects the memory footprint and saves us all from having
gigabytes of memory that we don't really need. My apache2 processes
have a VSS of around 120MB!

The capacity of a web serving machine is some combination of CPU,
Memory, and IO bandwidth. Being able to measure the copy-on-write pages
for processes is a key variable to determining a machine capacity. This
figure changes over the life of the process as well, and can be used to
tell children to exit once they reach a certain point.

Now, about keeping it in the vanilla kernel: AFAIK, the only way to
acquire this information is from the kernel. It's useful to developers,
and available on most other platforms. Copy on write pages make sense,
why waste tons of RAM when there is no real need? It makes sense to be
able to observe this behavior, and the information can guide developers
to make their applications more efficient.

In many organizations developers do not have the ability/skill to make
custom kernels. They are given development platforms, told to write
their applications, and so on and so on. Patching the kernel for
keeping track of cow's and subsequently maintaining that patch really
doesn't help them much. I could go on but this is getting a bit off
topic.

Best,

Richard Rebel

> But I don't have a dogmatic position on it,
> and trust others' judgement better than my own.
>
> Hugh
> -
> 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/
--
Richard F. Rebel

cat /dev/null > `tty`

Attachment: signature.asc
Description: This is a digitally signed message part