From: Vlastimil Babka <vbabka@suse.cz>
To: Danilo Krummrich <dakr@kernel.org>,
Vitaly Wool <vitaly.wool@konsulko.se>,
Linus Torvalds <torvalds@linux-foundation.org>
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,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
linux-bcachefs@vger.kernel.org, bpf@vger.kernel.org,
Herbert Xu <herbert@gondor.apana.org.au>,
Jann Horn <jannh@google.com>, Pedro Falcato <pfalcato@suse.de>,
Kent Overstreet <kent.overstreet@linux.dev>
Subject: Re: [PATCH v13 2/4] mm/slub: allow to set node and align in k[v]realloc
Date: Tue, 15 Jul 2025 17:34:20 +0200 [thread overview]
Message-ID: <07d3689c-185e-496e-a0b8-53bb3194f0da@suse.cz> (raw)
In-Reply-To: <DBCPB0BHKNTQ.K0NWNXIFKCT0@kernel.org>
On 7/15/25 16:33, Danilo Krummrich wrote:
> On Tue Jul 15, 2025 at 3:58 PM CEST, Vitaly Wool wrote:
>> diff --git a/fs/bcachefs/darray.c b/fs/bcachefs/darray.c
>> index e86d36d23e9e..928e83a1ce42 100644
>> --- a/fs/bcachefs/darray.c
>> +++ b/fs/bcachefs/darray.c
>> @@ -21,7 +21,7 @@ int __bch2_darray_resize_noprof(darray_char *d, size_t element_size, size_t new_
>> return -ENOMEM;
>>
>> void *data = likely(bytes < INT_MAX)
>> - ? kvmalloc_noprof(bytes, gfp)
>> + ? kvmalloc_node_align_noprof(bytes, 1, gfp, NUMA_NO_NODE)
>> : vmalloc_noprof(bytes);
>> if (!data)
>> return -ENOMEM;
>> diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h
>> index 0a4b1d433621..2d6d4b547db8 100644
>> --- a/fs/bcachefs/util.h
>> +++ b/fs/bcachefs/util.h
>> @@ -61,7 +61,7 @@ static inline void *bch2_kvmalloc_noprof(size_t n, gfp_t flags)
>> {
>> void *p = unlikely(n >= INT_MAX)
>> ? vmalloc_noprof(n)
>> - : kvmalloc_noprof(n, flags & ~__GFP_ZERO);
>> + : kvmalloc_node_align_noprof(n, 1, flags & ~__GFP_ZERO, NUMA_NO_NODE);
>> if (p && (flags & __GFP_ZERO))
>> memset(p, 0, n);
>> return p;
>
> I assume this is because kvmalloc(), and hence kvrealloc(), does this:
>
> /* Don't even allow crazy sizes */
> if (unlikely(size > INT_MAX)) {
> WARN_ON_ONCE(!(flags & __GFP_NOWARN));
> return NULL;
> }
>
> Do we still consider this a "crazy size"? :)
Yeah, with "we" including Linus:
https://lore.kernel.org/all/CAHk-=wi=PrbZnwnvhKEF6UUQNCZdNsUbr+hk-jOWGr-q4Mmz=Q@mail.gmail.com/
next prev parent reply other threads:[~2025-07-15 15:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-15 13:56 [PATCH v13 0/4] support large align and nid in Rust allocators Vitaly Wool
2025-07-15 13:57 ` [PATCH v13 1/4] :mm/vmalloc: allow to set node and align in vrealloc Vitaly Wool
2025-07-15 14:37 ` Matthew Wilcox
2025-07-30 17:25 ` Vitaly Wool
2025-07-15 13:58 ` [PATCH v13 1/4] mm/vmalloc: " Vitaly Wool
2025-07-15 14:25 ` Liam R. Howlett
2025-07-15 13:58 ` [PATCH v13 2/4] mm/slub: allow to set node and align in k[v]realloc Vitaly Wool
2025-07-15 14:33 ` Danilo Krummrich
2025-07-15 15:34 ` Vlastimil Babka [this message]
2025-07-15 15:48 ` Danilo Krummrich
2025-07-15 16:12 ` Danilo Krummrich
2025-07-25 8:47 ` Vlastimil Babka
2025-07-15 13:58 ` [PATCH v13 3/4] rust: add support for NUMA ids in allocations Vitaly Wool
2025-07-24 9:27 ` Alice Ryhl
2025-07-29 8:25 ` Danilo Krummrich
2025-07-15 13:58 ` [PATCH v13 4/4] rust: support large alignments " Vitaly Wool
2025-07-24 9:27 ` Alice Ryhl
2025-07-24 20:54 ` [PATCH v13 0/4] support large align and nid in Rust allocators Andrew Morton
2025-07-25 7:14 ` Alice Ryhl
2025-07-25 8:26 ` Vlastimil Babka
2025-07-25 10:00 ` 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=07d3689c-185e-496e-a0b8-53bb3194f0da@suse.cz \
--to=vbabka@suse.cz \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=aliceryhl@google.com \
--cc=bpf@vger.kernel.org \
--cc=dakr@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=jannh@google.com \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=pfalcato@suse.de \
--cc=rust-for-linux@vger.kernel.org \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).