[lkml]   [2020]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v9] perf: Sharing PMU counters across compatible events
Hi Peter, 

> On Dec 17, 2019, at 9:59 AM, Song Liu <> 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 <>
> Cc: Arnaldo Carvalho de Melo <>
> Cc: Jiri Olsa <>
> Cc: Alexey Budankov <>
> Cc: Namhyung Kim <>
> Cc: Tejun Heo <>
> Signed-off-by: Song Liu <>

Happy New Year! Wish you a great 2020!

Could you please share feedbacks on this version?


 \ /
  Last update: 2020-01-02 19:47    [W:0.344 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site