[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87h8y9ue4a.fsf@ashishki-desk.ger.corp.intel.com>
Date: Wed, 19 Jul 2017 09:36:53 +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>,
Mark Rutland <mark.rutland@....com>,
David Carrillo-Cisneros <davidcc@...gle.com>,
Stephane Eranian <eranian@...gle.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 1/4]: perf/core: use rb trees for pinned/flexible groups
Alexey Budankov <alexey.budankov@...ux.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
Powered by blists - more mailing lists