[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a2JasKXtXYoV7KsSZt4TwkffsBjrf=LK1HZJx0KFKCcow@mail.gmail.com>
Date: Fri, 31 Aug 2018 16:09:34 +0200
From: Arnd Bergmann <arnd@...db.de>
To: igor.stoppa@...il.com
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
igor.stoppa@...wei.com, Aaro Koskinen <aaro.koskinen@....fi>,
Alasdair Kergon <agk@...hat.com>,
Al Viro <viro@...iv.linux.org.uk>,
Andrew Jeffery <andrew@...id.au>,
Archit Taneja <architt@...eaurora.org>, asolokha@...kras.ru,
bvanassche@....org,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
chien.tin.tung@...el.com, chunkeey@...glemail.com,
Christoph Lameter <cl@...ux.com>,
David Airlie <airlied@...ux.ie>,
David Daney <ddaney@...iumnetworks.com>,
Dennis Zhou <dennisszhou@...il.com>, dima@...sta.com,
Doug Ledford <dledford@...hat.com>,
"Latif, Faisal" <faisal.latif@...el.com>,
gregkh <gregkh@...uxfoundation.org>,
Daode Huang <huangdaode@...ilicon.com>,
Inaky Perez-Gonzalez <inaky.perez-gonzalez@...el.com>,
"James E.J. Bottomley" <jejb@...ux.vnet.ibm.com>,
James Hogan <jhogan@...nel.org>,
Jason Gunthorpe <jgg@...pe.ca>, ejt@...hat.com,
Kalle Valo <kvalo@...eaurora.org>,
Kees Cook <keescook@...omium.org>,
Larry Finger <Larry.Finger@...inger.net>,
Linus Walleij <linus.walleij@...aro.org>,
Madalin-Cristian Bucur <madalin.bucur@....com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Michael Ellerman <mpe@...erman.id.au>,
"Michael S. Tsirkin" <mst@...hat.com>, michal.kazior@...to.com,
Mike Snitzer <snitzer@...hat.com>,
Paul Burton <paul.burton@...s.com>,
Paul Mackerras <paulus@...ba.org>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Ralf Baechle <ralf@...ux-mips.org>,
Rob Clark <robdclark@...il.com>, rolandd@...co.com,
Salil Mehta <salil.mehta@...wei.com>,
Shuah Khan <shuah@...nel.org>,
srivatsa.bhat@...ux.vnet.ibm.com, sviau@...eaurora.org,
Tejun Heo <tj@...nel.org>, yisen.zhuang@...wei.com,
zijun_hu@....com
Subject: Re: [PATCH 00/23] Make use of unlikely() more consistently.
On Fri, Aug 31, 2018 at 12:35 AM Igor Stoppa <igor.stoppa@...il.com> wrote:
>
> In some cases, checks that are expected to not fail, do not take advantage
> of specifying that the condition being tested is unlikely().
>
> Ex:
>
> #define assert(condition)
> ...
> if (!(condition))
> error_action()
> ...
>
> should be
>
> #define assert(condition)
> ...
> if (unlikely(!(condition)))
> error_action()
> ...
There is a potential that this introduces false-postive -Wmaybe-uninitialized
warnings when CONFIG_PROFILE_ANNOTATED_BRANCHES is
set, since that turns unlikely() into a complex operation that in turn
confuses the compiler so it no longer keeps track of which variables
are initialized or not.
It's possible that none of your patches do that, but one needs to be aware
of the problem, and possibly revert some of your patches if it does cause
warning regressions in drivers that don't actually benefit from the
micro-optimization.
> In other cases, the hint is given twice: once explicitly and once inside
> whatever test is being performed: assert(), BUG_ON(), WARN_ON(), etc.
>
> Ex:
>
> if (unlikely(WARN_ON(condition, message)))
> ...
Removing those is definitely fine.
Arnd
Powered by blists - more mailing lists