lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <3E1CA84B-3670-4887-ADA1-055E8A5DE806@konsulko.se>
Date: Sat, 28 Jun 2025 00:14:57 +0200
From: Vitaly Wool <vitaly.wool@...sulko.se>
To: Uladzislau Rezki <urezki@...il.com>
Cc: Danilo Krummrich <dakr@...nel.org>,
 linux-mm@...ck.org,
 akpm@...ux-foundation.org,
 linux-kernel@...r.kernel.org,
 Alice Ryhl <aliceryhl@...gle.com>,
 rust-for-linux@...r.kernel.org
Subject: Re: [PATCH 2/4] mm/slub: allow to set node and align in k[v]realloc



> On Jun 27, 2025, at 7:54 PM, Uladzislau Rezki <urezki@...il.com> wrote:
> 
> On Fri, Jun 27, 2025 at 02:01:23PM +0200, Vitaly Wool wrote:
>> 
>> 
>>> On Jun 27, 2025, at 1:42 PM, Uladzislau Rezki <urezki@...il.com> wrote:
>>> 
>>> Hello, Vitaly, Danilo.
>>> 
>>>> 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(),
>>>> 
>>> I am probably missing something. Could you please clarify why do you
>>> need the vrealloc_node_align() and other friends? Do you have users
>>> which require vrealloc() or kvrealloc() to support nid and align from
>>> Rust API point of view? 
>>> 
>>> 
>> 
>> Alignment for Rust allocators should generally be supported, it’s been listed as TODO for a while.
>> Node awareness is very desirable for e.g. KVBox and for the coming zpool mapping.
>> 
> Thank you for clarification. The comment about TODO i saw. Initially i
> thought that there is a real demand in having it for some users. But
> this is just for future potential ones. So, maybe the comment should
> be removed instead? But i do not have a strong opinion here.

Well, the zpool Rust mapping is in fact ready and will follow shortly after we sort out the issues with this patchset.

~Vitaly

> 
> vrealloc_node_align() sounds indeed better for that purpose.
> 
> --
> Uladzislau Rezki



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ