From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Arnd Bergmann <arnd@arndb.de>, Arnd Bergmann <arnd@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
<linux-kbuild@vger.kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>, <linux-s390@vger.kernel.org>,
Heiko Carstens <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
"Bjorn Andersson" <andersson@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Christian Marangi <ansuelsmth@gmail.com>,
<linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH] err.h: use __always_inline on all error pointer helpers
Date: Wed, 27 May 2026 16:06:19 +0200 [thread overview]
Message-ID: <9398ee4c-3b51-4a00-a0d5-3674ce1b1081@intel.com> (raw)
In-Reply-To: <8e50449f-66f0-4e85-aefa-7016697fe722@app.fastmail.com>
From: Arnd Bergmann <arnd@arndb.de>
Date: Tue, 26 May 2026 23:03:50 +0200
> On Tue, May 26, 2026, at 17:01, Alexander Lobakin wrote:
>> From: Arnd Bergmann <arnd@kernel.org>
>> Date: Tue, 26 May 2026 12:18:41 +0200
>>
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> While testing randconfig builds on s390, I came across a
>>> link failure with CONFIG_DMA_SHARED_BUFFER disabled:
>>>
>>> ERROR: modpost: "dma_buf_put" [drivers/iommu/iommufd/iommufd.ko] undefined!
>>>
>>> The problem here is that IS_ERR() is not inlined and dead code elimination
>>> fails as a consequence.
>>>
>>> The err.h helpers all turn into a trivial assignment ot a bit mask
>>> and should never result in a function call, so force them to always be
>>> inline. This should generally result in better object code aside from
>>> avoiding the link failure above.
>>
>> bloat-o-meter would be nice to see but optional, it's obvious to me that
>> these helpers should always get inlined.
>>
>> Not sure why compilers sometimes decide to uninline a couple
>> instructions (feels like there's sorta dumb logic "oh it's used more
>> than X times -- uninline no matter what").
>
> I've run bloat-o-meter on the vmlinux.o file now and indeed it shows
> what is going on: the configuration that triggered this has
> CONFIG_PROFILE_ANNOTATED_BRANCHES, which turns the unlikely()
> bit in IS_ERR() into two extra function calls, so my patch does
> end up adding a bit of bloat (see output below):
>
> text data bss dec hex filename
> 20159943 5630468 16199728 41990139 280b7fb build/s390/0xCED6EE04_defconfig/vmlinux-old.o
> 20217607 5630404 16199728 42047739 28198fb build/s390/0xCED6EE04_defconfig/vmlinux-new.o
>
> Without CONFIG_PROFILE_ANNOTATED_BRANCHES, the changes are
> very small, with around 100 functions growing or shrinking
> by a few bytes.
>
> I don't think we care much about the size increase when that
> option is enabled, but I do wonder what behavior makes more
Yup, and even without this option, __always_inline is better here
regardless of how it affects the size. Such oneliners must be
transparent to the compiler
> sense regarding the annotation for every single IS_ERR().
> Does it make sense to have every instance get its own counter,
> or would it make sense to actually try to reduce these
> when profiling the annotations?
I'm not familiar with branch annotations, but from the stats above, it
really looks like it adds a lot of code bloat. Plenty of branches in
the kernel are sorta pointless to track (the ones which trigger once
in a thousand years, the unlikely() ones etc.), I guess.
>
> Arnd
Thanks,
Olek
next prev parent reply other threads:[~2026-05-27 14:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-26 10:18 Arnd Bergmann
2026-05-26 15:01 ` Alexander Lobakin
2026-05-26 21:03 ` Arnd Bergmann
2026-05-27 14:06 ` Alexander Lobakin [this message]
2026-05-27 14:25 ` Arnd Bergmann
2026-05-27 14:30 ` Alexander Lobakin
2026-05-27 22:13 ` David Laight
2026-05-26 19:37 ` Nathan Chancellor
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=9398ee4c-3b51-4a00-a0d5-3674ce1b1081@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=andersson@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=ansuelsmth@gmail.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=rostedt@goodmis.org \
/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®