[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87k24zzx7s.fsf@ashishki-desk.ger.corp.intel.com>
Date: Mon, 29 May 2017 15:03:35 +0300
From: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
To: Alexey Budankov <alexey.budankov@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Andi Kleen <ak@...ux.intel.com>, Kan Liang <kan.liang@...el.com>,
Dmitri Prokhorov <Dmitry.Prohorov@...el.com>,
Valery Cherepennikov <valery.cherepennikov@...el.com>,
David Carrillo-Cisneros <davidcc@...gle.com>,
Stephane Eranian <eranian@...gle.com>,
Mark Rutland <mark.rutland@....com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH]: perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi
Alexey Budankov <alexey.budankov@...ux.intel.com> writes:
Here (above the function) you could include a comment describing what
happens when this is called, locking considerations, etc.
> +static int
> +perf_cpu_tree_insert(struct rb_root *tree, struct perf_event *event)
> +{
> + struct rb_node **node;
> + struct rb_node *parent;
> +
> + if (!tree || !event)
> + return 0;
I don't think this should be happening, should it? And either way you
probably don't want to return 0 here, unless you're using !0 for
success.
> +
> + node = &tree->rb_node;
> + parent = *node;
> +
> + while (*node) {
> + struct perf_event *node_event = container_of(*node,
> + struct perf_event, group_node);
> +
> + parent = *node;
> +
> + if (event->cpu < node_event->cpu) {
> + node = &((*node)->rb_left);
this would be the same as node = &parent->rb_left, right?
> + } else if (event->cpu > node_event->cpu) {
> + node = &((*node)->rb_right);
> + } else {
> + list_add_tail(&event->group_list_entry,
> + &node_event->group_list);
So why is this better than simply having per-cpu event lists plus one
for per-thread events?
Also,
> + return 2;
2?
> + }
> + }
> +
> + list_add_tail(&event->group_list_entry, &event->group_list);
> +
> + rb_link_node(&event->group_node, parent, node);
> + rb_insert_color(&event->group_node, tree);
> +
> + return 1;
Oh, you are using !0 for success. I guess it's a good thing you're not
actually checking its return code at the call site.
Regards,
--
Alex
Powered by blists - more mailing lists