Re: [PATCH 38/46] rust: slab: add __rust_helper to helpers

From: Boqun Feng
Date: Tue Dec 02 2025 - 20:45:48 EST


On Tue, Dec 02, 2025 at 07:38:02PM +0000, Alice Ryhl wrote:
> This is needed to inline these helpers into Rust code.
>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
> ---
> Cc: Vlastimil Babka <vbabka@xxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Christoph Lameter <cl@xxxxxxxxxx>
> Cc: David Rientjes <rientjes@xxxxxxxxxx>
> Cc: Vitaly Wool <vitaly.wool@xxxxxxxxxxx>
> Cc: Danilo Krummrich <dakr@xxxxxxxxxx>
> ---
> rust/helpers/slab.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/rust/helpers/slab.c b/rust/helpers/slab.c
> index 7fac958907b0a7cbb28ef3a8a56e0cc10d39288f..970161023d8885935f2116fe81949d0ed622f9e9 100644
> --- a/rust/helpers/slab.c
> +++ b/rust/helpers/slab.c
> @@ -2,16 +2,18 @@
>
> #include <linux/slab.h>
>
> -void * __must_check __realloc_size(2)
> -rust_helper_krealloc_node_align(const void *objp, size_t new_size, unsigned long align,
> - gfp_t flags, int node)
> +__rust_helper void *__must_check __realloc_size(2)
> + rust_helper_krealloc_node_align(const void *objp, size_t new_size,

Similar here, shouldn't it be:


__rust_helper void *__must_check __realloc_size(2)
rust_helper_krealloc_node_align(const void *objp, size_t new_size,
unsigned long align, gfp_t flags,
int node)

?
> + unsigned long align, gfp_t flags,
> + int node)
> {
> return krealloc_node_align(objp, new_size, align, flags, node);
> }
>
> -void * __must_check __realloc_size(2)
> -rust_helper_kvrealloc_node_align(const void *p, size_t size, unsigned long align,
> - gfp_t flags, int node)
> +__rust_helper void *__must_check __realloc_size(2)
> + rust_helper_kvrealloc_node_align(const void *p, size_t size,

Ditto.

Regards,
Boqun

> + unsigned long align, gfp_t flags,
> + int node)
> {
> return kvrealloc_node_align(p, size, align, flags, node);
> }
>
> --
> 2.52.0.158.g65b55ccf14-goog
>
>