]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
rust: add support for NUMA ids in allocations
authorVitaly Wool <vitaly.wool@konsulko.se>
Wed, 6 Aug 2025 12:55:22 +0000 (14:55 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 13 Sep 2025 23:54:46 +0000 (16:54 -0700)
commit7760b6421b6c1b49550885ecdfa9cf720ead6eed
tree64fcaa0754c54f04ec8706cb4b0b047eb9faf89b
parent2cd8231796b5e7133b1c3d66ad7d2a3c42c97258
rust: add support for NUMA ids in allocations

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.

[ojeda@kernel.org: fix missing import needed for `rusttest`]
Link: https://lkml.kernel.org/r/20250816210214.2729269-1-ojeda@kernel.org
Link: https://lkml.kernel.org/r/20250806125522.1726992-1-vitaly.wool@konsulko.se
Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.se>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Acked-by: Alice Ryhl <aliceryhl@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Jann Horn <jannh@google.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Uladzislau Rezki (Sony) <urezki@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
rust/helpers/slab.c
rust/helpers/vmalloc.c
rust/kernel/alloc.rs
rust/kernel/alloc/allocator.rs
rust/kernel/alloc/allocator_test.rs
rust/kernel/alloc/kbox.rs
rust/kernel/alloc/kvec.rs