public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>, Kan Liang <kan.liang@intel.com>,
	Dmitri Prokhorov <Dmitry.Prohorov@intel.com>,
	Valery Cherepennikov <valery.cherepennikov@intel.com>,
	David Carrillo-Cisneros <davidcc@google.com>,
	Stephane Eranian <eranian@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/n] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi
Date: Tue, 20 Jun 2017 14:36:25 +0100	[thread overview]
Message-ID: <20170620133624.GF28157@leverpostej> (raw)
In-Reply-To: <162b1822-06b7-30e0-073c-911ba99b33b7@linux.intel.com>

On Mon, Jun 19, 2017 at 11:31:59PM +0300, Alexey Budankov wrote:
> On 15.06.2017 22:56, Mark Rutland wrote:
> >On Thu, Jun 15, 2017 at 08:41:42PM +0300, Alexey Budankov wrote:
> >>+static int
> >>+perf_cpu_tree_iterate(struct rb_root *tree,
> >>+		perf_cpu_tree_callback_t callback, void *data)
> >>+{
> >>+	int ret = 0;
> >>+	struct rb_node *node;
> >>+	struct perf_event *event;
> >>+
> >>+	WARN_ON_ONCE(!tree);
> >>+
> >>+	for (node = rb_first(tree); node; node = rb_next(node)) {
> >>+		struct perf_event *node_event = container_of(node,
> >>+				struct perf_event, group_node);
> >>+
> >>+		list_for_each_entry(event, &node_event->group_list,
> >>+				group_list_entry) {
> >>+			ret = callback(event, data);
> >>+			if (ret)
> >>+				return ret;
> >>+		}
> >>+	}
> >>+
> >>+	return 0;
> >>  }
> >
> >If you need to iterate over every event, you can use the list that
> >threads the whole tree.
> 
> Could you please explain more on that?

In Peter's original suggestion, we'd use a threaded tree rather than a
tree of lists.

i.e. you'd have something like:

struct threaded_rb_node {
	struct rb_node   node;
	struct list_head head;
};

... with the tree and list covering all nodes, in the same order:

Tree:

     3
    / \
   /   \
  1     5
 / \   / \
0   2 4   6

List:

0 - 1 - 2 - 3 - 4 - 5 - 6

... that way you can search using the tree, and iterate using the list,
even when you wan to iterate over sub-lists.

Thanks,
Mark.

  reply	other threads:[~2017-06-20 13:37 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-15 17:41 [PATCH v3 1/n] perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi Alexey Budankov
2017-06-15 19:56 ` Mark Rutland
2017-06-15 22:10   ` Alexey Budankov
2017-06-16  9:09     ` Mark Rutland
2017-06-16 14:08       ` Alexey Budankov
2017-06-16 14:22         ` Alexey Budankov
2017-06-19 12:46           ` Mark Rutland
2017-06-19 13:38             ` Mark Rutland
2017-06-19 14:09               ` Alexey Budankov
2017-06-19 14:59               ` Andi Kleen
2017-06-19 15:09                 ` Mark Rutland
2017-06-19 15:21                   ` Andi Kleen
2017-06-19 15:24                     ` Mark Rutland
2017-06-19 15:39                       ` Andi Kleen
2017-06-19 15:52                         ` Mark Rutland
2017-06-19 13:08     ` Alexey Budankov
2017-06-19 13:26       ` Mark Rutland
2017-06-19 13:37         ` Alexey Budankov
2017-06-19 15:00           ` Alexey Budankov
2017-06-19 15:24             ` Andi Kleen
2017-06-19 15:34               ` Alexey Budankov
2017-06-30 10:23                 ` Alexey Budankov
2017-06-30 10:21             ` Alexey Budankov
2017-06-19 15:14           ` Mark Rutland
2017-06-19 15:27             ` Alexey Budankov
2017-06-30 10:21           ` Alexey Budankov
2017-06-19 20:31   ` Alexey Budankov
2017-06-20 13:36     ` Mark Rutland [this message]
2017-06-20 15:22       ` Alexey Budankov
2017-06-20 16:37         ` Mark Rutland
2017-06-20 17:10           ` Alexey Budankov

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=20170620133624.GF28157@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=Dmitry.Prohorov@intel.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=davidcc@google.com \
    --cc=eranian@google.com \
    --cc=kan.liang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=valery.cherepennikov@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox