From: Andrew Morton <akpm@osdl.org>
To: Martin Peschke <mp3@de.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [Patch 5/6] statistics infrastructure
Date: Mon, 29 May 2006 18:17:01 -0700 [thread overview]
Message-ID: <20060529181701.05981487.akpm@osdl.org> (raw)
In-Reply-To: <1148941028.3005.72.camel@dyn-9-152-230-71.boeblingen.de.ibm.com>
On Tue, 30 May 2006 00:17:08 +0200
Martin Peschke <mp3@de.ibm.com> wrote:
> > > +static void statistic_set_sparse(struct statistic *stat, s64 value, u64 total)
> > > +{
> > > + struct statistic_sparse_list *slist = (struct statistic_sparse_list *)
> > > + stat->pdata;
> >
> > Hang on, what's happening here? statistic.pdata is `struct percpu_data *'.
> > That's
> >
> > struct percpu_data {
> > void *ptrs[NR_CPUS];
> > };
> >
> > How can we cast that to a statistic_sparse_list* and then start playing
> > with it? We're supposed to use per_cpu_ptr() to get at the actual data.
>
> With regard to the data that a statistic feeds on, there are are two
> types of statistics: statistics that accumulate incremental updates
> (pushed - probably frequently - through statistic_add() or
> statistic_inc()), and statistics that accept total numbers (pulled
> through statistic_set() only when read by user). We use per-cpu data for
> the former. As to the latter, per-cpu data would be way to heavy.
> That is why, my code is capable of dealing with both per-cpu data and
> non-per-cpu data. Since a particular statistic is either per-cpu or
> non-per-cpu, I use the same data pointer for both cases in order to keep
> struct statistic as small as possible.
>
> I admit the cast looks a bit fishy. But lines above are correct.
<head spins>
Perhaps a suitable comment somewhere so people don't fall out of their
chairs when they see this like I did?
next prev parent reply other threads:[~2006-05-30 1:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-24 12:33 Martin Peschke
2006-05-24 22:57 ` Andrew Morton
2006-05-29 22:17 ` Martin Peschke
2006-05-30 1:17 ` Andrew Morton [this message]
2006-05-29 22:17 ` [Patch] statistics infrastructure - update 1 Martin Peschke
2006-05-30 8:07 ` Heiko Carstens
2006-05-30 11:22 ` Martin Peschke
2006-05-30 17:17 ` [Patch 5/6] statistics infrastructure Martin Peschke
2006-05-30 19:19 ` Andrew Morton
2006-05-25 8:05 ` Nikita Danilov
2006-05-30 11:35 ` Martin Peschke
-- strict thread matches above, loose matches on Subject: below --
2006-05-19 16:13 Martin Peschke
2005-12-16 12:27 [patch " Martin Peschke
2005-12-14 16:46 Martin Peschke
2005-12-14 18:38 ` Andi Kleen
2005-12-16 1:00 ` Martin Peschke
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=20060529181701.05981487.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mp3@de.ibm.com \
/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
all inboxes | Powered by JetHome®