[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <D2DCB5A2-2F19-42EB-A4BF-36F7999E8F7E@fb.com>
Date: Wed, 11 Dec 2019 18:50:32 +0000
From: Song Liu <songliubraving@...com>
To: open list <linux-kernel@...r.kernel.org>
CC: Kernel Team <Kernel-team@...com>,
Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Jiri Olsa <jolsa@...nel.org>,
Alexey Budankov <alexey.budankov@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>, Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH v8] perf: Sharing PMU counters across compatible events
Hi Peter and Jiri,
> On Dec 6, 2019, at 4:24 PM, Song Liu <songliubraving@...com> wrote:
>
> This patch tries to enable PMU sharing. When multiple perf_events are
> counting the same metric, they can share the hardware PMU counter. We
> call these events as "compatible events".
>
> The PMU sharing are limited to events within the same perf_event_context
> (ctx). When a event is installed or enabled, search the ctx for compatible
> events. This is implemented in perf_event_setup_dup(). One of these
> compatible events are picked as the master (stored in event->dup_master).
> Similarly, when the event is removed or disabled, perf_event_remove_dup()
> is used to clean up sharing.
>
> A new state PERF_EVENT_STATE_ENABLED is introduced for the master event.
> This state is used when the slave event is ACTIVE, but the master event
> is not.
>
> On the critical paths (add, del read), sharing PMU counters doesn't
> increase the complexity. Helper functions event_pmu_[add|del|read]() are
> introduced to cover these cases. All these functions have O(1) time
> complexity.
>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Alexey Budankov <alexey.budankov@...ux.intel.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Tejun Heo <tj@...nel.org>
> Signed-off-by: Song Liu <songliubraving@...com>
>
> ---
> Changes in v8:
> Fix issues with task event (Jiri).
> Fix issues with event inherit.
> Fix mmap'ed events, i.e. perf test 4 (kernel test bot).
>
> Changes in v7:
> Major rewrite to avoid allocating extra master event.
Could you please share your feedbacks on this version?
Thanks,
Song
Powered by blists - more mailing lists