[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250911204246.GA69679@ax162>
Date: Thu, 11 Sep 2025 13:42:46 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Heiko Carstens <hca@...ux.ibm.com>, Miguel Ojeda <ojeda@...nel.org>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Juergen Christ <jchrist@...ux.ibm.com>,
linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
Sven Schnelle <svens@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>
Subject: Re: [PATCH 1/3] Compiler Attributes: Add __assume macro
On Thu, Sep 11, 2025 at 09:04:36PM +0200, Miguel Ojeda wrote:
> On Thu, Sep 11, 2025 at 8:44 PM Nathan Chancellor <nathan@...nel.org> wrote:
> >
> > I do not think anyone really owns compiler_types.h so unless Miguel has
> > any objections from the compiler attributes perspective, I think you can
> > just take this via the s390 tree with the other two changes.
>
> No objections from me, and thanks for spotting the OpenMP thing above.
>
> I would say, though, that this is a fairly general and subtle tool to
> have around, so it would be nice to have others chime in. In other
> words, do we want to start using `assume`s? Should we constrain its
> use a bit, e.g. say its use should really be justified etc.? (In the
> Rust side, a tool like this would require a SAFETY comment on top with
> a justification, which may give a developer pause).
I do think justification at the source level (i.e., a comment) would be
a good baseline. I thought I remember a similar discussion around
likely() / unlikely() annotations since those should have some evidence
of benefit behind it. Applying the same policy to __assume() usage would
help ensure there is sufficient justification for adding and maintaining
such annotations, especially if they turn out to cause problems later.
Not sure if there should be a format standard like exists for SAFETY
comments but something is better than nothing.
Cheers,
Nathan
Powered by blists - more mailing lists