Re: [PATCH v12 4/4] rust: support large alignments in allocations

Danilo Krummrich
2025-07-09T21:01:01Z

On Wed, Jul 09, 2025 at 07:25:09PM +0200, Vitaly Wool wrote:
> void * __must_check __realloc_size(2)
> -rust_helper_krealloc_node(const void *objp, size_t new_size, gfp_t flags, int node)
> +rust_helper_krealloc_node_align(const void *objp, size_t new_size, unsigned long align,
> + gfp_t flags, int node)

CHECK: Alignment should match open parenthesis
#38: FILE: rust/helpers/slab.c:14:
+rust_helper_kvrealloc_node_align(const void *p, size_t size, unsigned long align,
+ gfp_t flags, int node)

total: 0 errors, 0 warnings, 1 checks, 94 lines checked

Please make sure to always run scripts/checkpatch.pl. :)

> @@ -185,12 +180,6 @@ unsafe fn realloc(
> flags: Flags,
> nid: NumaNode,
> ) -> Result<NonNull<[u8]>, AllocError> {
> - // TODO: Support alignments larger than PAGE_SIZE.
> - if layout.align() > bindings::PAGE_SIZE {
> - pr_warn!("KVmalloc does not support alignments larger than PAGE_SIZE yet.\n");
> - return Err(AllocError);
> - }
> -

Since you remove the pr_warn!(), you also have to remove the corresponding
import, otherwise you get a clippy warning.

Please build with CLIPPY=1, see also [1].

[1] https://rust-for-linux.com/contributing#submit-checklist-addendum