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>,
Mark Rutland <mark.rutland@arm.com>,
David Carrillo-Cisneros <davidcc@google.com>,
Stephane Eranian <eranian@google.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups
Date: Wed, 19 Jul 2017 09:36:53 +0300 [thread overview]
Message-ID: <87h8y9ue4a.fsf@ashishki-desk.ger.corp.intel.com> (raw)
In-Reply-To: <00247f4a-1637-b7fe-2408-07330fcb3171@linux.intel.com>
Alexey Budankov <alexey.budankov@linux.intel.com> writes:
>>> +static void
>>> +perf_event_groups_insert(struct perf_event_groups *groups,
>>> + struct perf_event *event)
>>> +{
>>> + struct rb_node **node;
>>> + struct rb_node *parent;
>>> + struct perf_event *node_event;
>>> +
>>> + WARN_ON_ONCE(!groups || !event);
>>
>> I'm pretty sure neither of these is plausible.
>
> Used that for debugging.
It's a bad practice to keep leftovers of debugging code in the
patches. In this particular case, as with most WARN*s that I've seen in
this patchset, it is completely useless, because the code goes ahead and
dereferences the pointers right after the assert, so there'd be an oops
and we'd see it anyway.
Normally, you'd use these assertions if you're actually handling the
undesired scenario, like
/* Can't happen because XXX */
if (WARN_ON_ONCE(!groups))
return -EINVAL;
Also a comment justifying the WARN* is a good thing to have.
> Does it affect performance somehow?
It doesn't matter. Generally, we don't need an reason to remove code, we
need a reason to add code.
Regards,
--
Alex
prev parent reply other threads:[~2017-07-19 6:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-10 13:03 Alexey Budankov
2017-07-18 12:02 ` Alexander Shishkin
2017-07-18 13:38 ` Alexey Budankov
2017-07-18 12:29 ` Alexander Shishkin
2017-07-18 13:39 ` Alexey Budankov
2017-07-19 6:36 ` Alexander Shishkin [this message]
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=87h8y9ue4a.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®