From: Mark Rutland <mark.rutland@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will.deacon@arm.com>
Subject: Re: [PATCH] perf: fix pmu::filter_match for SW-led groups
Date: Tue, 5 Jul 2016 13:52:27 +0100 [thread overview]
Message-ID: <20160705125226.GE20478@leverpostej> (raw)
In-Reply-To: <20160705120426.GA30921@twins.programming.kicks-ass.net>
On Tue, Jul 05, 2016 at 02:04:26PM +0200, Peter Zijlstra wrote:
> On Tue, Jul 05, 2016 at 10:44:48AM +0100, Mark Rutland wrote:
> > My bad; I assumed that for both PMUs we'd start at the root, and thus
> > would need to re-sort in order to get the current CPU's PMU ordered
> > first, much like currently with rotation.
> >
> > I guess I'm having difficulty figuring out the structure of that tree.
> > If we can easily/cheaply find the relevant sub-tree then the above isn't
> > an issue.
>
> struct event {
> struct rb_node node;
> int pmu_id;
> s64 lag;
> ...
> };
>
> bool event_less(struct rb_node *a, struct rb_node *b)
> {
> struct event *left = rb_entry(a, struct event, node);
> struct event *right = rb_entry(b, struct event, node);
>
> if (a->pmu_id < b->pmu_id)
> return true;
>
> if (b->pmu_id > a->pmu_id)
> return false;
>
> /* a->pmu_id == b->pmu_id */
> if (a->lag < b->lag)
> return true;
>
> return false;
> }
>
> Will give you a tree with primary order @pmu_id and secondary order
> @lag.
>
> Which you'd iterate like:
>
> for (event = event_find(pmu_id); event->pmu_id == pmu_id; event = event_next(event)) {
> }
>
> And get only the events matching @pmu_id in @lag order.
Cheers! Sorry for being thick; I think I understand now.
I'll have a tinker with the idea.
Thanks,
Mark.
next prev parent reply other threads:[~2016-07-05 12:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-14 15:10 [PATCH] perf: fix pmu::filter_match for SW-led groups Mark Rutland
2016-07-02 16:40 ` Peter Zijlstra
2016-07-04 18:05 ` Mark Rutland
2016-07-05 8:35 ` Peter Zijlstra
2016-07-05 9:44 ` Mark Rutland
2016-07-05 12:04 ` Peter Zijlstra
2016-07-05 12:52 ` Mark Rutland [this message]
2016-07-07 8:31 ` [tip:perf/core] perf/core: Fix " tip-bot for Mark Rutland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160705125226.GE20478@leverpostej \
--to=mark.rutland@arm.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.