public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Lin Ming <ming.m.lin@intel.com>, Ingo Molnar <mingo@elte.hu>,
	"eranian@gmail.com" <eranian@gmail.com>,
	"Gary.Mohr@Bull.com" <Gary.Mohr@bull.com>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	"arjan@linux.intel.com" <arjan@linux.intel.com>,
	"Zhang, Yanmin" <yanmin_zhang@linux.intel.com>,
	Paul Mackerras <paulus@samba.org>,
	"David S. Miller" <davem@davemloft.net>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Paul Mundt <lethal@linux-sh.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 2/9] perf: core, remove hw_perf_event_init
Date: Mon, 10 May 2010 14:27:30 +0200	[thread overview]
Message-ID: <20100510122728.GB5563@nowhere> (raw)
In-Reply-To: <1273486769.5605.3343.camel@twins>

On Mon, May 10, 2010 at 12:19:29PM +0200, Peter Zijlstra wrote:
> On Mon, 2010-05-10 at 18:17 +0800, Lin Ming wrote:
> > On Mon, 2010-05-10 at 17:40 +0800, Peter Zijlstra wrote:
> > > On Mon, 2010-05-10 at 17:26 +0800, Lin Ming wrote:
> > > > +static struct pmu *perf_event_lookup_pmu(struct perf_event *event)
> > > > +{
> > > > +       struct pmu *pmu;
> > > > +       int pmu_id = event->attr.pmu_id;
> > > > +
> > > > +       list_for_each_entry(pmu, &pmus, entry) {
> > > > +               if (pmu->id == pmu_id)
> > > > +                       return pmu;
> > > > +       }
> > > > +
> > > > +       return NULL;
> > > > +}
> > > 
> > > > +void perf_event_register_pmu(struct pmu *pmu)
> > > > +{
> > > > +       pmu->id = pmu_id_curr++;
> > > > +       list_add_tail(&pmu->entry, &pmus);
> > > > +} 
> > > 
> > > That will be wanting some sort of synchronization
> > 
> > Will add a mutex to protect the list of pmus.
> 
> I'm thinking RCU might be better suited, a mutex for lookup doesn't
> sound ideal.


Is it really needed? I expect this function to be called on boot
only.

In fact I would even suggest to tag it as __init.


  parent reply	other threads:[~2010-05-10 12:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-10  9:26 [RFC][PATCH 2/9] perf: core, remove hw_perf_event_init Lin Ming
2010-05-10  9:40 ` Peter Zijlstra
2010-05-10 10:17   ` Lin Ming
2010-05-10 10:19     ` Peter Zijlstra
2010-05-10 10:22       ` Lin Ming
2010-05-10 12:27       ` Frederic Weisbecker [this message]
2010-05-10 12:54         ` Peter Zijlstra
2010-05-10 23:09           ` Frederic Weisbecker
2010-05-11  6:38             ` Peter Zijlstra
2010-05-11  6:44               ` Lin Ming
2010-05-11  6:51                 ` Ingo Molnar
2010-05-11  7:00                   ` Lin Ming
2010-05-11  9:18                 ` Peter Zijlstra
2010-05-11  6:50               ` Frederic Weisbecker
2010-05-10  9:42 ` Peter Zijlstra
2010-05-10 10:15   ` Lin Ming
2010-05-10 12:24 ` Frederic Weisbecker
2010-05-12  2:11   ` Lin Ming

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=20100510122728.GB5563@nowhere \
    --to=fweisbec@gmail.com \
    --cc=Gary.Mohr@bull.com \
    --cc=arjan@linux.intel.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=yanmin_zhang@linux.intel.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