[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANiq72k0FSBTB2yOjiAy9PnAuyM=-PHxL3uQQ_Cv+zwswnr_bA@mail.gmail.com>
Date: Sun, 24 Aug 2025 13:38:34 +0200
From: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
To: Danilo Krummrich <dakr@...nel.org>
Cc: Alice Ryhl <aliceryhl@...gle.com>, Andrew Morton <akpm@...ux-foundation.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, "Liam R. Howlett" <Liam.Howlett@...cle.com>,
Matthew Wilcox <willy@...radead.org>, Tamir Duberstein <tamird@...il.com>,
Andreas Hindborg <a.hindborg@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <lossin@...nel.org>, Trevor Gross <tmgross@...ch.edu>, linux-mm@...ck.org,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 0/2] Take ARCH_KMALLOC_MINALIGN into account for
build-time XArray check
On Fri, Aug 15, 2025 at 9:12 PM Danilo Krummrich <dakr@...nel.org> wrote:
>
> diff --cc rust/kernel/alloc.rs
> index b39c279236f5,907301334d8c..000000000000
> --- a/rust/kernel/alloc.rs
> +++ b/rust/kernel/alloc.rs
> @@@ -164,7 -137,15 +164,15 @@@ impl NumaNode
> /// - Implementers must ensure that all trait functions abide by the guarantees documented in the
> /// `# Guarantees` sections.
> pub unsafe trait Allocator {
> + /// The minimum alignment satisfied by all allocations from this allocator.
> + ///
> + /// # Guarantees
> + ///
> + /// Any pointer allocated by this allocator is guaranteed to be aligned to `MIN_ALIGN` even if
> + /// the requested layout has a smaller alignment.
> + const MIN_ALIGN: usize;
> +
> - /// Allocate memory based on `layout` and `flags`.
> + /// Allocate memory based on `layout`, `flags` and `nid`.
> ///
> /// On success, returns a buffer represented as `NonNull<[u8]>` that satisfies the layout
> /// constraints (i.e. minimum size and alignment as specified by `layout`).
`MIN_ALIGN` is missing in `Cmalloc` -- from `rusttest`:
error[E0046]: not all trait items implemented, missing: `MIN_ALIGN`
--> rust/kernel/alloc/allocator_test.rs:48:1
|
48 | unsafe impl Allocator for Cmalloc {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `MIN_ALIGN` in
implementation
|
::: rust/kernel/alloc.rs:173:5
|
173 | const MIN_ALIGN: usize;
| ---------------------- `MIN_ALIGN` from trait
i.e. similar to the other one.
Cheers,
Miguel
Powered by blists - more mailing lists