mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
To: Alexey Budankov <alexey.budankov@linux.intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: 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>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH]: perf/core: addressing 4x slowdown during per-process profiling of STREAM benchmark on Intel Xeon Phi
Date: Tue, 30 May 2017 11:29:00 +0300	[thread overview]
Message-ID: <87h902zr1v.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <47dc6d8d-77db-70f5-9aa6-2aca38590e60@linux.intel.com>

Alexey Budankov <alexey.budankov@linux.intel.com> writes:

> On 29.05.2017 15:03, Alexander Shishkin wrote:
>> Alexey Budankov <alexey.budankov@linux.intel.com> writes:
>> 
>> Here (above the function) you could include a comment describing what
>> happens when this is called, locking considerations, etc.
>
> I can put the short description from the initial thread message here. 
> Would it be sufficient?

Sure, this is where API descriptions fit better than in commit messages.

>
>> 
>>> +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.
>
> As you might notice already, currently return codes of the tree API are 
> not checked all other the implementation. I suggest replacing that int 
> error code by void and simplify the stuff.

Your call. But I'd still either drop the redundant checks or wrap them
in WARN_ON_ONCE().

>
>> 
>>> +
>>> +	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?
>
> Please ask more.

Side note: between commit message, comments and the actual code, in an
ideal situation one doesn't have to 'ask' anything, because everything
is already clear. Not the case here.

> node is the leaf node and parent is the parent of the 
> node at the end of cycle. We need the both to insert a new node into a 
> tree.

Not sure I understand. You'd still have both.

>
>> 
>>> +		} 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?
>
> Good question. Choice of data structure and layout depends on the 
> operations applied to the data so keeping groups as a tree simplifies 
> and improves the implementation in terms of scalability and performance. 
> Please ask more if any.

Please be more specific on how scalability and performance are
improved. In general, try to avoid vagues statements like "this is
better for performance".

Thanks,
--
Alex

  parent reply	other threads:[~2017-05-30  8:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 22:13 Alexey Budankov
2017-05-27 11:19 ` [PATCH v2]: perf/core: addressing 4x slowdown during per-process, " Alexey Budankov
2017-05-29  7:45   ` Peter Zijlstra
2017-05-29  9:24     ` Alexey Budankov
2017-05-29 10:33       ` Peter Zijlstra
2017-05-29 10:46         ` Alexey Budankov
2017-05-29  7:46   ` Peter Zijlstra
2017-05-29  9:15     ` Alexey Budankov
2017-05-29 10:43       ` Peter Zijlstra
2017-05-29 10:56         ` Alexey Budankov
2017-05-29 11:23           ` Peter Zijlstra
2017-05-29 11:45             ` Alexey Budankov
2017-06-15 17:42               ` Alexey Budankov
2017-06-21 15:39                 ` Alexey Budankov
2017-06-30 10:22                   ` Alexey Budankov
2017-05-31 21:33   ` David Carrillo-Cisneros
2017-06-14 11:27     ` Alexey Budankov
2017-05-29 12:03 ` [PATCH]: perf/core: addressing 4x slowdown during per-process " Alexander Shishkin
2017-05-29 13:43   ` Alexey Budankov
2017-05-29 15:22     ` Peter Zijlstra
2017-05-29 15:29       ` Peter Zijlstra
2017-05-29 16:41         ` Alexey Budankov
2017-05-30  8:29     ` Alexander Shishkin [this message]
2017-06-14 10:07       ` Alexey Budankov
2017-06-15 17:44         ` 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=87h902zr1v.fsf@ashishki-desk.ger.corp.intel.com \
    --to=alexander.shishkin@linux.intel.com \
    --cc=Dmitry.Prohorov@intel.com \
    --cc=acme@kernel.org \
    --cc=ak@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=mark.rutland@arm.com \
    --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

all inboxes | Powered by JetHome®