Re: [PATCH v13 1/4] :mm/vmalloc: allow to set node and align in vrealloc

Vitaly Wool <[email protected]>
Newsgroups org.kernel.vger.linux-bcachefs,org.kernel.vger.bpf,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux,org.kvack.linux-mm
Message-ID <[email protected]>

> On Jul 15, 2025, at 4:37 PM, Matthew Wilcox <[email protected]> wrote:
> 
> On Tue, Jul 15, 2025 at 03:57:24PM +0200, Vitaly Wool wrote:
>> +void *__must_check vrealloc_node_align_noprof(const void *p, size_t size,
>> + unsigned long align, gfp_t flags, int nid) __realloc_size(2);
>> +#define vrealloc_node_noprof(_p, _s, _f, _nid) \
>> + vrealloc_node_align_noprof(_p, _s, 1, _f, _nid)
>> +#define vrealloc_noprof(_p, _s, _f) \
>> + vrealloc_node_align_noprof(_p, _s, 1, _f, NUMA_NO_NODE)
>> +#define vrealloc_node_align(...) alloc_hooks(vrealloc_node_align_noprof(__VA_ARGS__))
>> +#define vrealloc_node(...) alloc_hooks(vrealloc_node_noprof(__VA_ARGS__))
>> +#define vrealloc(...) alloc_hooks(vrealloc_noprof(__VA_ARGS__))
> 
> I think we can simplify all of this.
> 
> void *__must_check vrealloc_noprof(const void *p, size_t size,
> unsigned long align, gfp_t flags, int nid) __realloc_size(2);
> #define vrealloc_node_align(...) \
> alloc_hooks(vrealloc_noprof(__VA_ARGS__))
> #define vrealloc_node(p, s, f, nid) \
> alloc_hooks(vrealloc_noprof(p, s, 1, f, nid))
> #define vrealloc(p, s, f) \
> alloc_hooks(vrealloc_noprof(p, s, 1, f, NUMA_NO_NODE))
> 
> 

In this case, to keep things buildable an each step we will need to modify slub.c in this patch. Since we change slub.c in the next patch in the series I would suggest that we keep things simple (== as they are now, even if it means some redundant macros have to stay). I can come up with a macro simplification like yours when this series is accepted.

Thanks,
Vitaly
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.