linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Alice Ryhl" <aliceryhl@google.com>
Cc: <lorenzo.stoakes@oracle.com>, <vbabka@suse.cz>,
	<Liam.Howlett@oracle.com>, <urezki@gmail.com>, <ojeda@kernel.org>,
	<alex.gaynor@gmail.com>, <boqun.feng@gmail.com>,
	<gary@garyguo.net>, <bjorn3_gh@protonmail.com>,
	<lossin@kernel.org>, <a.hindborg@kernel.org>, <tmgross@umich.edu>,
	<rust-for-linux@vger.kernel.org>, <linux-mm@kvack.org>,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>
Subject: Re: [PATCH] rust: alloc: add missing trait item MIN_ALIGN to Cmalloc
Date: Sun, 24 Aug 2025 15:04:58 +0200	[thread overview]
Message-ID: <DCAOH44U57K3.2CVDYWF8MJBWL@kernel.org> (raw)
In-Reply-To: <CAH5fLgjkqcyzoZD7PP2i4g4r2uqpdbDKVW5hLfm6c9ysbxkPuw@mail.gmail.com>

On Sun Aug 24, 2025 at 2:36 PM CEST, Alice Ryhl wrote:
> On Sun, Aug 24, 2025 at 2:07 PM Danilo Krummrich <dakr@kernel.org> wrote:
>> +    const MIN_ALIGN: usize = bindings::ARCH_KMALLOC_MINALIGN;
>
> Is this the right value for normal malloc?

Heh! ARCH_KMALLOC_MINALIGN should be correct, because the Cmalloc implementation
should (ideally) enforce a minimum alignment of ARCH_KMALLOC_MINALIGN for
compatibility reasons.

However, double checking the existing code, it doesn't. Hence, the correct value
must either be

	const MIN_ALIGN: usize = align_of::<crate::ffi::c_ulonglong>();

instead. Or, we have to actually enforce ARCH_KMALLOC_MINALIGN.

Given that this fix is only for within the -rc cycles, i.e. we will remove
allocator_test.rs before the MIN_ALIGN stuff ever hits an actual release, just
using align_of::<crate::ffi::c_ulonglong>() should be fine.


  reply	other threads:[~2025-08-24 13:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-24 12:06 Danilo Krummrich
2025-08-24 12:36 ` Alice Ryhl
2025-08-24 13:04   ` Danilo Krummrich [this message]
2025-08-24 13:18     ` Danilo Krummrich
2025-08-24 13:29       ` Danilo Krummrich
2025-08-24 14:07         ` Miguel Ojeda
2025-08-24 14:41           ` Danilo Krummrich

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=DCAOH44U57K3.2CVDYWF8MJBWL@kernel.org \
    --to=dakr@kernel.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=lossin@kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=urezki@gmail.com \
    --cc=vbabka@suse.cz \
    /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