Re: [PATCH 1/2] perf/core: Make cgroup switch visit only cpuctxs with cgroup events

From: David Carrillo-Cisneros
Date: Wed Jan 18 2017 - 14:26:36 EST


On Wed, Jan 18, 2017 at 4:11 AM, Mark Rutland <mark.rutland@xxxxxxx> wrote:
> On Tue, Jan 17, 2017 at 09:38:39AM -0800, David Carrillo-Cisneros wrote:
>> This is a low-hanging fruit optimization. It replaces the iteration over
>> the "pmus" list in cgroup switch by an iteration over a new list that
>> contains only cpuctxs with at least one cgroup event.
>>
>> This is necessary because the number of pmus have increased over the years
>> e.g modern x86 server systems have well above 50 pmus.
>> The iteration over the full pmu list is unneccessary and can be costly in
>> heavy cache contention scenarios.
>
> While I haven't done any measurement of the overhead, this looks like a
> nice rework/cleanup.
>
> Since this is only changing the management of cpu contexts, this
> shouldn't adversely affect systems with heterogeneous CPUs. I've also
> given this a spin on such a system, to no ill effect.
>
> I have one (very minor) comment below, but either way:
>
> Acked-by: Mark Rutland <mark.rutland@xxxxxxx>
> Tested-by: Mark Rutland <mark.rutland@xxxxxxx>

Thanks for reviewing it. I made the lil' change you proposed and added your Ack.

>
>> @@ -889,6 +876,7 @@ list_update_cgroup_event(struct perf_event *event,
>> struct perf_event_context *ctx, bool add)
>> {
>> struct perf_cpu_context *cpuctx;
>> + struct list_head *lentry;
>
> It might be worth calling this cpuctx_entry, so that it's clear which
> list element it refers to. I can imagine we'll add more list
> manipulation in this path in future.
>
> Thanks,
> Mark.