From: Danilo Krummrich <dakr@kernel.org>
To: Vitaly Wool <vitaly.wool@konsulko.se>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
linux-kernel@vger.kernel.org, Uladzislau Rezki <urezki@gmail.com>,
Alice Ryhl <aliceryhl@google.com>,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 2/4] mm/slub: allow to set node and align in k[v]realloc
Date: Fri, 27 Jun 2025 12:41:01 +0200 [thread overview]
Message-ID: <aF51PTZh0gRVFuYu@pollux> (raw)
In-Reply-To: <20250627093714.402989-1-vitaly.wool@konsulko.se>
On Fri, Jun 27, 2025 at 11:37:14AM +0200, Vitaly Wool wrote:
> Reimplement k[v]realloc_node() to be able to set node and
> alignment should a user need to do so. In order to do that while
> retaining the maximal backward compatibility, the following rules
> are honored:
> * kmalloc/kzalloc/krealloc remain unchanged
> * kvmalloc/kvrealloc/kvcalloc remain unchanged
> * kvrealloc remains unchanged
> * kvrealloc_node is implemented as a new function taking align and
> NUMA id as extra parameters compared to kvrealloc.
> * krealloc_node is implemented as a new function taking NUMA id
> as an extra parameter compared to krealloc
> * kvmalloc_node/kvzalloc_node/kvcalloc_node get an extra parameter
> (alignment)
I see what you're doing here:
You created vrealloc_node_noprof() in the previous patch, taking the following
arguments:
vrealloc_node_noprof(const void *p, size_t size,
unsigned long align,
gfp_t flags, int nid)
And now you're aligning the newly introduced krealloc_node() and
kvrealloc_node() with that.
The idea for having an align argument on krealloc_node() simply is that it
fails if the alignment requirement can't be fulfilled by the corresponding
kmalloc bucket, such that we can fall back to vrealloc_node() in
kvrealloc_node().
Generally, this makes sense to me.
However, now you consequently have to add the align argument to kvmalloc_node(),
kvzalloc_node(), kvcalloc_node() as well.
This is what creates this huge diffstat changing all the users.
IMHO, the problem here was introduced already with vrealloc_node_noprof() taking
an align argument in your previous patch, since now you have to adjust
everything else to logically follow the same naming scheme.
Instead, I think you should introduce vrealloc_node_align(),
kvrealloc_node_align(), etc. This way no existing function signatures, such as
kvmalloc_node() have to be changed and no users have to be adjusted.
- Danilo
next prev parent reply other threads:[~2025-06-27 10:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-27 9:29 [PATCH v5 0/4] support large align and nid in Rust allocators Vitaly Wool
2025-06-27 9:35 ` [PATCH v5 1/4] mm/vmalloc: allow to set node and align in vrealloc Vitaly Wool
2025-06-27 9:37 ` [PATCH 2/4] mm/slub: allow to set node and align in k[v]realloc Vitaly Wool
2025-06-27 10:41 ` Danilo Krummrich [this message]
2025-06-27 11:42 ` Uladzislau Rezki
2025-06-27 12:01 ` Vitaly Wool
2025-06-27 17:54 ` Uladzislau Rezki
2025-06-27 22:14 ` Vitaly Wool
2025-06-27 11:57 ` Vitaly Wool
2025-06-27 9:38 ` [PATCH v5 3/4] rust: add support for NUMA ids in allocations Vitaly Wool
2025-06-27 11:20 ` Danilo Krummrich
2025-06-27 9:39 ` [PATCH v5 4/4] rust: support large alignments " Vitaly Wool
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=aF51PTZh0gRVFuYu@pollux \
--to=dakr@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=aliceryhl@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=urezki@gmail.com \
--cc=vitaly.wool@konsulko.se \
/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