lkml.org 
[lkml]   [2010]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [RFC][PATCH 2/9] perf: core, remove hw_perf_event_init
    From
    Date
    On Mon, 2010-05-10 at 18:19 +0800, 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.

    Thanks for the idea, I'll do that.



    \
     
     \ /
      Last update: 2010-05-10 12:25    [W:0.028 / U:397.948 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site