Skip to content

support large align and nid in Rust allocators #5582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: bpf-next_base
Choose a base branch
from

Conversation

kernel-patches-daemon-bpf-rc[bot]
Copy link

Pull request for series with
subject: support large align and nid in Rust allocators
version: 12
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=980623

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: ad97cb2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=980623
version: 12

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: ad97cb2
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=980623
version: 12

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: d81526a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=980623
version: 12

Vitaly Wool added 4 commits July 11, 2025 10:53
Reimplement vrealloc() to be able to set node and alignment should
a user need to do so. Rename the function to vrealloc_node_align()
to better match what it actually does now and introduce macros for
vrealloc() and friends for backward compatibility.

With that change we also provide the ability for the Rust part of
the kernel to set node and alignment in its allocations.

Signed-off-by: Vitaly Wool <[email protected]>
Reviewed-by: Uladzislau Rezki (Sony) <[email protected]>
Reviewed-by: Vlastimil Babka <[email protected]>
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, add
k[v]realloc_node_align() functions and redefine the rest of API
using these new ones.

While doing that, we also keep the number of  _noprof variants to a
minimum, which implies some changes to the existing users of older
_noprof functions, that basically being bcachefs.

With that change we also provide the ability for the Rust part of
the kernel to set node and alignment in its K[v]xxx
[re]allocations.

Signed-off-by: Vitaly Wool <[email protected]>
Reviewed-by: Vlastimil Babka <[email protected]>
Add a new type to support specifying NUMA identifiers in Rust
allocators and extend the allocators to have NUMA id as a
parameter. Thus, modify ReallocFunc to use the new extended realloc
primitives from the C side of the kernel (i. e.
k[v]realloc_node_align/vrealloc_node_align) and add the new function
alloc_node to the Allocator trait while keeping the existing one
(alloc) for backward compatibility.

This will allow to specify node to use for allocation of e. g.
{KV}Box, as well as for future NUMA aware users of the API.

Signed-off-by: Vitaly Wool <[email protected]>
Add support for large (> PAGE_SIZE) alignments in Rust allocators.
All the preparations on the C side are already done, we just need
to add bindings for <alloc>_node_align() functions and start
using those.

Signed-off-by: Vitaly Wool <[email protected]>
Acked-by: Danilo Krummrich <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: eeec23a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=980623
version: 12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants