Skip to content

Commit

Permalink
perf/cor: Use RB trees for pinned/flexible groups
Browse files Browse the repository at this point in the history
Change event groups into RB trees sorted by CPU and then by a 64bit
index, so that multiplexing hrtimer interrupt handler would be able
skipping to the current CPU's list and ignore groups allocated for the
other CPUs.

New API for manipulating event groups in the trees is implemented as well
as adoption on the API in the current implementation.

pinned_group_sched_in() and flexible_group_sched_in() API are
introduced to consolidate code enabling the whole group from pinned
and flexible groups appropriately.

Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: David Carrillo-Cisneros <davidcc@google.com>
Cc: Dmitri Prokhorov <Dmitry.Prohorov@intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Valery Cherepennikov <valery.cherepennikov@intel.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/372f9c8b-0cfe-4240-e44d-83d863d40813@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Alexey Budankov authored and Ingo Molnar committed Mar 12, 2018
1 parent 9e5b127 commit 8e1a203
Show file tree
Hide file tree
Showing 2 changed files with 267 additions and 56 deletions.
16 changes: 13 additions & 3 deletions include/linux/perf_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,11 @@ struct perf_event {
*/
struct list_head group_entry;
struct list_head sibling_list;

/*
* Node on the pinned or flexible tree located at the event context;
*/
struct rb_node group_node;
u64 group_index;
/*
* We need storage to track the entries in perf_pmu_migrate_context; we
* cannot use the event_entry because of RCU and we want to keep the
Expand Down Expand Up @@ -690,6 +694,12 @@ struct perf_event {
#endif /* CONFIG_PERF_EVENTS */
};


struct perf_event_groups {
struct rb_root tree;
u64 index;
};

/**
* struct perf_event_context - event context structure
*
Expand All @@ -710,8 +720,8 @@ struct perf_event_context {
struct mutex mutex;

struct list_head active_ctx_list;
struct list_head pinned_groups;
struct list_head flexible_groups;
struct perf_event_groups pinned_groups;
struct perf_event_groups flexible_groups;
struct list_head event_list;
int nr_events;
int nr_active;
Expand Down
Loading

0 comments on commit 8e1a203

Please sign in to comment.