I just had another idea on how you could do this.  It's actually not
    all that complex.

    All you do is collect statistics on each VM object individually
    (whether shadow or top level or whatever).  e.g. Resident page count,
    swap usage.

    Then you collect a list of VM objects associated with a process,
    regardless of HOW they are associated.  Recurse through the
    vm_map_entry's and the shadow chains to get the list.

    Then you simply group all the processes which share VM
    objects together and report statistics on a group-by-group basis
    rather then on a process-by-process basis.  You won't know what an
    individual process uses but you know exactly what the group of
    processes use in aggregate.

    Groups of processes will tend to form due to fork()ing, processes
    sharing memory via SysV shared memory, and processes that happen
    to be mapping the same file (vnode).  You will get accurate memory
    use for each group.

                                                -Matt


:   Actually, that's just the sort of thing I'm looking for.  The shared case
:may be relatively rare, but it tends to be extreme: the processes that use
:the most memory seem to be the ones that fork the most - database servers,
:java, etc.  The point of this whole thing is an attempt to limit the memory
:use of a user (instead of a process), but I don't want to penalize such
:sharing.
:
:..
:   That's OK - resident count is what I'm interested in.  That, and the swap
:approximation (which should suffice) you mentioned for non-vnode objects.
:
:- Jamie

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to