[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ikclsipf.fsf@t14s.mail-host-address-is-not-set>
Date: Wed, 28 Jan 2026 19:19:56 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, Gary Guo <gary@...yguo.net>
Cc: Alexandre Courbot <acourbot@...dia.com>, Miguel Ojeda
<ojeda@...nel.org>, Boqun Feng <boqun.feng@...il.com>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, Benno Lossin <lossin@...nel.org>, Alice
Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, Danilo
Krummrich <dakr@...nel.org>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH] rust: add `CacheAligned` for easy cache line alignment
of values
"Miguel Ojeda" <miguel.ojeda.sandonis@...il.com> writes:
> On Wed, Jan 28, 2026 at 3:41 PM Gary Guo <gary@...yguo.net> wrote:
>>
>> Unfortunately `repr(align())` does not accept expression or macro invocations.
>> It's still possible with code-generation, but it'll be more tricky.
>>
>> On all archs that we do support today, I think the value is always 64. However
>> it'd worth putting a FIXME or TODO (or assertion, maybe?) in case new archs gets
>> addded where this isn't true.
>
> The docs need to also avoid mentioning 64 themselves; otherwise,
> someone may use this and rely on it being 64, i.e. not just cache
> aligned, but actually 64.
>
> If Andreas really wants a fixed 64 one, then perhaps we want several
> types like `Aligned64` etc.
I was considering all the options that are mentioned here, and I decided
to go with least effort and hear you all out. I agree that `Aligned64`
is better than `CacheAligned` when the alignment is fixed and the type
is available on all architectures.
How about we gate the module on architectures that use 64 byte cache
line? Then we can add a proc macro to generate later if we need to, or
we can gate in another module implementation.
Regarding generating the code, how would a proc macro for this work? Do
we have environment variable access in proc macros?
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists