From: Wu Fengguang <fengguang.wu@intel.com>
To: Andi Kleen <ak@linux.intel.com>
Cc: "greg@kroah.com" <greg@kroah.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 2/3] DEBUGFS: Add per cpu counters
Date: Fri, 9 Dec 2011 11:00:25 +0800 [thread overview]
Message-ID: <20111209030025.GA17149@localhost> (raw)
In-Reply-To: <20111206171751.GA15062@alboin.jf.intel.com>
On Wed, Dec 07, 2011 at 01:17:51AM +0800, Andi Kleen wrote:
> On Tue, Dec 06, 2011 at 07:44:38PM +0800, Wu Fengguang wrote:
> > > +#include <linux/seq_file.h>
> > > +#include <linux/percpu.h>
> > > +#include <linux/kernel.h>
> > > +
> > > +/* OPEN: implement module support */
> >
> > Yeah, I think the module support would benefit my case as well.
> >
> > To support module users, init_counters() will be exported with the
> > __start___debugfs/__stop___debugfs hard coding removed. Then I'll be
> > call it from the readahead initilization code:
>
> No, the module loader should take care of this: look for the magic
> section, register it. This is already done for other magic
> sections and not too difficult, i just didn't write the code
> so far.
>
> Then the DEFINE_* macros would work seamlessly in modules too.
OK.
> Do you really need it for the readahead code? I thought that
> was builtin.
Yeah because in the current form I'm initializing an array of counters
at runtime in the readahead call site.
> > DEFINE_PER_CPU(unsigned long[RA_PATTERN_MAX][RA_ACCOUNT_MAX], ra_counter);
> > struct debugfs_counter ra_pcpu_counter[RA_PATTERN_MAX][RA_ACCOUNT_MAX];
> >
> > // init ra_pcpu_counter in a loop
> > for each pattern
> > init_counters(ra_pcpu_counter[pattern], ra_pcpu_counter[pattern+1]);
>
> Ok so you need arrays.
>
> The idea is to not call some init function, but just put it into section
> and let the init code walk it.
>
> Should probably have a macro that handles arrays nicely.
That would be nice!
> > > +static int show_debugfs_counter(struct seq_file *m, void *arg)
> > > +{
> > > + int n;
> > > + n = dump_counters(m, __start___debugfs, __stop___debugfs, m->private);
> >
> > That hard coded __start___debugfs/__stop___debugfs is OK for POC, and
> > will need to be improved to work with multiple users in kernel.
>
> For Modules it obviously has to walk a list. It's a straight forward extension.
>
> I don't think it should allow everyone to register their own lists,
> that doesn't make sense because they could as well create the debug
> files themselves.
OK. It just looks a bit inefficient when (this becomes so popular that)
the list grows large.
Thanks,
Fengguang
next prev parent reply other threads:[~2011-12-09 3:10 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-02 18:43 Add simple way to add statistic counters to debugfs Andi Kleen
2011-12-02 18:43 ` [PATCH 1/3] DEBUGFS: Automatically create parents for debugfs files Andi Kleen
2011-12-02 19:17 ` Greg KH
2011-12-02 19:42 ` Andi Kleen
2011-12-02 19:58 ` Greg KH
2011-12-02 18:43 ` [PATCH 2/3] DEBUGFS: Add per cpu counters Andi Kleen
2011-12-06 11:44 ` Wu Fengguang
2011-12-06 17:17 ` Andi Kleen
2011-12-09 3:00 ` Wu Fengguang [this message]
2011-12-02 18:43 ` [PATCH 3/3] VFS: Add event counting to dcache Andi Kleen
2011-12-02 19:18 ` Add simple way to add statistic counters to debugfs Greg KH
-- strict thread matches above, loose matches on Subject: below --
2011-12-02 20:02 [PATCH 1/3] DEBUGFS: Automatically create parents for debugfs files v2 Andi Kleen
2011-12-02 20:02 ` [PATCH 2/3] DEBUGFS: Add per cpu counters Andi Kleen
2011-12-12 22:20 ` Greg KH
2011-12-13 21:45 [PATCH 1/3] DEBUGFS: Automatically create parents for debugfs files v2 Andi Kleen
2011-12-13 21:45 ` [PATCH 2/3] DEBUGFS: Add per cpu counters Andi Kleen
2011-12-13 22:43 ` Thomas Gleixner
2011-12-13 22:56 ` Andi Kleen
2011-12-13 23:08 ` Steven Rostedt
2011-12-13 23:15 ` Mathieu Desnoyers
2011-12-13 23:16 ` Steven Rostedt
2011-12-13 23:17 ` Thomas Gleixner
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=20111209030025.GA17149@localhost \
--to=fengguang.wu@intel.com \
--cc=ak@linux.intel.com \
--cc=greg@kroah.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.