From: Matt Mackall <mpm@selenic.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, Dave Hansen <haveblue@us.ibm.com>,
Rusty Russell <rusty@rustcorp.com.au>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Fengguang Wu <wfg@mail.ustc.edu.cn>
Subject: Re: [PATCH 1/11] maps3: add proportional set size accounting in smaps
Date: Mon, 15 Oct 2007 19:18:50 -0500 [thread overview]
Message-ID: <20071016001850.GA19691@waste.org> (raw)
In-Reply-To: <alpine.DEB.0.9999.0710151633150.16611@chino.kir.corp.google.com>
On Mon, Oct 15, 2007 at 04:36:38PM -0700, David Rientjes wrote:
> On Mon, 15 Oct 2007, Matt Mackall wrote:
>
> > Index: l/fs/proc/task_mmu.c
> > ===================================================================
> > --- l.orig/fs/proc/task_mmu.c 2007-10-14 13:35:31.000000000 -0500
> > +++ l/fs/proc/task_mmu.c 2007-10-14 13:36:56.000000000 -0500
> > @@ -122,6 +122,27 @@ struct mem_size_stats
> > unsigned long private_clean;
> > unsigned long private_dirty;
> > unsigned long referenced;
> > +
> > + /*
> > + * Proportional Set Size(PSS): my share of RSS.
> > + *
> > + * PSS of a process is the count of pages it has in memory, where each
> > + * page is divided by the number of processes sharing it. So if a
> > + * process has 1000 pages all to itself, and 1000 shared with one other
> > + * process, its PSS will be 1500. - Matt Mackall, lwn.net
> > + */
> > + u64 pss;
> > + /*
> > + * To keep (accumulated) division errors low, we adopt 64bit pss and
> > + * use some low bits for division errors. So (pss >> PSS_DIV_BITS)
> > + * would be the real byte count.
> > + *
> > + * A shift of 12 before division means(assuming 4K page size):
> > + * - 1M 3-user-pages add up to 8KB errors;
> > + * - supports mapcount up to 2^24, or 16M;
> > + * - supports PSS up to 2^52 bytes, or 4PB.
> > + */
> > +#define PSS_DIV_BITS 12
> > };
> >
>
> I know this gets moved again in the eighth patch of the series, but the
> #define still has no place inside the struct definition.
Agreed.
> The pss is going to need accessor functions, preferably inlined, and the
> comment adjusted stating that all accesses should be through those
> functions and not directly to the mem_size_stats struct.
>
> static inline u64 pss_up(unsigned long pss)
> {
> return pss << PSS_DIV_BITS;
> }
>
> static inline unsigned long pss_down(u64 pss)
> {
> return pss >> PSS_DIV_BITS;
> }
I think that's overkill for something that has exactly one use of each.
--
Mathematics is the supreme nostalgia of our time.
next prev parent reply other threads:[~2007-10-16 0:20 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-15 22:25 [PATCH 0/11] maps3: pagemap monitoring v3 Matt Mackall
2007-10-15 22:25 ` [PATCH 1/11] maps3: add proportional set size accounting in smaps Matt Mackall
2007-10-15 23:36 ` David Rientjes
2007-10-16 0:18 ` Matt Mackall [this message]
2007-10-16 2:24 ` David Rientjes
2007-10-15 22:25 ` [PATCH 2/11] maps3: introduce task_size_of for all arches Matt Mackall
2007-10-15 23:45 ` David Rientjes
2007-10-16 0:36 ` Dave Hansen
2007-10-16 2:26 ` David Rientjes
2007-10-16 17:18 ` maps3: introduce task_size_of for all arches (updated v4) Dave Hansen
2007-10-16 17:25 ` David Rientjes
2007-10-15 22:26 ` [PATCH 3/11] maps3: move is_swap_pte Matt Mackall
2007-10-15 22:26 ` [PATCH 4/11] maps3: introduce a generic page walker Matt Mackall
2007-10-15 22:40 ` Jeremy Fitzhardinge
2007-10-15 23:05 ` Dave Hansen
2007-10-15 23:20 ` Jeremy Fitzhardinge
2007-10-15 23:30 ` Matt Mackall
2007-10-16 4:58 ` David Rientjes
2007-10-15 22:26 ` [PATCH 5/11] maps3: use pagewalker in clear_refs and smaps Matt Mackall
2007-10-16 5:03 ` David Rientjes
2007-10-15 22:26 ` [PATCH 6/11] maps3: simplify interdependence of maps " Matt Mackall
2007-10-15 22:26 ` [PATCH 7/11] maps3: move clear_refs code to task_mmu.c Matt Mackall
2007-10-16 5:11 ` David Rientjes
2007-10-15 22:26 ` [PATCH 8/11] maps3: regroup task_mmu by interface Matt Mackall
2007-10-15 22:26 ` [PATCH 9/11] maps3: add /proc/pid/pagemap interface Matt Mackall
2007-10-15 22:26 ` [PATCH 10/11] maps3: add /proc/kpagecount and /proc/kpageflags interfaces Matt Mackall
2007-10-15 22:48 ` Dave Hansen
2007-10-15 23:11 ` Matt Mackall
2007-10-15 23:34 ` Dave Hansen
2007-10-16 0:35 ` Matt Mackall
2007-10-16 0:49 ` Dave Hansen
2007-10-16 0:58 ` Matt Mackall
2007-10-16 1:07 ` Dave Hansen
2007-10-15 22:26 ` [PATCH 11/11] maps3: make page monitoring /proc file optional Matt Mackall
2007-10-15 22:49 ` Dave Hansen
2007-10-15 22:51 ` Jeremy Fitzhardinge
2007-10-16 0:03 ` Rusty Russell
2007-10-16 0:20 ` Matt Mackall
2007-10-16 5:25 ` David Rientjes
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=20071016001850.GA19691@waste.org \
--to=mpm@selenic.com \
--cc=akpm@linux-foundation.org \
--cc=haveblue@us.ibm.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rientjes@google.com \
--cc=rusty@rustcorp.com.au \
--cc=wfg@mail.ustc.edu.cn \
/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