[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87lgm2xz0m.fsf@ashishki-desk.ger.corp.intel.com>
Date: Tue, 29 Aug 2017 16:51:53 +0300
From: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To: Alexey Budankov <alexey.budankov@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Kan Liang <kan.liang@...el.com>,
Dmitri Prokhorov <Dmitry.Prohorov@...el.com>,
Valery Cherepennikov <valery.cherepennikov@...el.com>,
Mark Rutland <mark.rutland@....com>,
Stephane Eranian <eranian@...gle.com>,
David Carrillo-Cisneros <davidcc@...gle.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v6 1/3] perf/core: use rb trees for pinned/flexible groups
Alexey Budankov <alexey.budankov@...ux.intel.com> writes:
> Now I figured that not all indexed events are always located under
> the root with the same cpu, and it depends on the order of insertion
> e.g. with insertion order 01,02,03,14,15,16 we get this:
>
> 02
> / \
> 01 14
> / \
> 03 15
> \
> 16
>
> and it is unclear how to iterate cpu==0 part of tree in this case.
Using this example, rb_next() should take you through the nodes in this
order (assuming you start with 01): 01, 02, 03, 14, etc. So you iterate
while event->cpu==cpu using rb_next() and you should be fine.
> Iterating cpu specific subtree like this:
>
> #define for_each_group_event(event, group, cpu, pmu, field) \
> for (event = rb_entry_safe(group_first(group, cpu, pmu), \
> typeof(*event), field); \
> event && event->cpu == cpu && event->pmu == pmu; \
> event = rb_entry_safe(rb_next(&event->field), \
> typeof(*event), field))
Afaict, this assumes that you are also ordering on event->pmu, which
should be reflected in your _less function. And also assuming that
group_first() is doing the right thing. Can we see the code?
Regards,
--
Alex
Powered by blists - more mailing lists