From: Eric Dumazet on
Le jeudi 08 avril 2010 à 21:39 +0200, Frederic Weisbecker a écrit :

....

> @@ -5401,6 +5507,16 @@ static void __cpuinit perf_event_init_cpu(int cpu)
> spin_lock(&perf_resource_lock);
> cpuctx->max_pertask = perf_max_events - perf_reserved_percpu;
> spin_unlock(&perf_resource_lock);
> +
> + mutex_lock(&cpuctx->hlist_mutex);
> + if (&cpuctx->hlist_refcount > 0) {


if (cpuctx->hlist_refcount > 0)

> + struct swevent_hlist *hlist;
> +
> + hlist = kzalloc(sizeof(*hlist), GFP_KERNEL);
> + WARN_ON_ONCE(!hlist);
> + rcu_assign_pointer(cpuctx->swevent_hlist, hlist);
> + }
> + mutex_unlock(&cpuctx->hlist_mutex);
> }



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Frederic Weisbecker on
On Thu, Apr 08, 2010 at 10:04:41PM +0200, Eric Dumazet wrote:
> Le jeudi 08 avril 2010 � 21:39 +0200, Frederic Weisbecker a �crit :
>
> ...
>
> > @@ -5401,6 +5507,16 @@ static void __cpuinit perf_event_init_cpu(int cpu)
> > spin_lock(&perf_resource_lock);
> > cpuctx->max_pertask = perf_max_events - perf_reserved_percpu;
> > spin_unlock(&perf_resource_lock);
> > +
> > + mutex_lock(&cpuctx->hlist_mutex);
> > + if (&cpuctx->hlist_refcount > 0) {
>
>
> if (cpuctx->hlist_refcount > 0)


Doh! Thanks, will fix.


>
> > + struct swevent_hlist *hlist;
> > +
> > + hlist = kzalloc(sizeof(*hlist), GFP_KERNEL);
> > + WARN_ON_ONCE(!hlist);
> > + rcu_assign_pointer(cpuctx->swevent_hlist, hlist);
> > + }
> > + mutex_unlock(&cpuctx->hlist_mutex);
> > }
>
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on
On Wed, 2010-04-14 at 02:53 +0200, Frederic Weisbecker wrote:
>
> Each time a software event triggers, we need to walk through
> the entire list of events from the current cpu and task contexts
> to retrieve a running perf event that matches.
> We also need to check a matching perf event is actually counting.
>
> This walk is wasteful and makes the event fast path scaling
> down with a growing number of events running on the same
> contexts.
>
> To solve this, we store the running perf events in a hashlist to
> get an immediate access to them against their type:event_id when
> they trigger.

Looks good, thanks Frederic!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/