Re: [PATCH net-next] net: Drop unlikely before IS_ERR(_OR_NULL)

From: Enrico Weigelt, metux IT consult
Date: Thu Jun 06 2019 - 16:46:52 EST


On 06.06.19 03:39, Kefeng Wang wrote:

Hi folks,

> There is no different in assembly output (only check the x86/arm64), and
> the Enrico Weigelt have finished a cocci script to do this cleanup.

I haven't compared the assembly output, just logically deduced from the
macro. If I understand it correctly, the likely()/unlikely() macros
just add a hint to the compiler, which branch it should optimize harder.

No idea what the compiler's actually doing, but I believe its things
like optimized shortcut evaluation and avoiding jumps to likely
branches.

>> I'm not sure in the end that the change is worth it, so would like you
>> to prove it is, unless davem overrides me. :-)

Depends on what you count as worthy ;-)

This patch just makes a source a bit more compact / easier to read.
But shouldn't have any actual consequence on the generated binary.


--mtx

--
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@xxxxxxxxx -- +49-151-27565287