Re: [PATCH v7 1/3] rust: allocator: add KUnit tests for alignment guarantees
From: Danilo Krummrich
Date: Wed Aug 13 2025 - 12:50:43 EST
On Thu Jul 31, 2025 at 11:19 AM CEST, Danilo Krummrich wrote:
> On Thu Jul 31, 2025 at 4:50 AM CEST, Hui Zhu wrote:
>> From: Hui Zhu <zhuhui@xxxxxxxxxx>
>>
>> Add a test module to verify memory alignment guarantees for Rust kernel
>> allocators.
>> The tests cover `Kmalloc`, `Vmalloc` and `KVmalloc` allocators
>> with both standard and large page-aligned allocations.
>>
>> Key features of the tests:
>> 1. Creates alignment-constrained types:
>> - 128-byte aligned `Blob`
>> - 8192-byte (4-page) aligned `LargeAlignBlob`
>> 2. Validates allocators using `TestAlign` helper which:
>> - Checks address alignment masks
>> - Supports uninitialized allocations
>> 3. Tests all three allocators with both alignment requirements:
>> - Kmalloc with 128B and 8192B
>> - Vmalloc with 128B and 8192B
>> - KVmalloc with 128B and 8192B
>>
>> Co-developed-by: Geliang Tang <geliang@xxxxxxxxxx>
>> Signed-off-by: Geliang Tang <geliang@xxxxxxxxxx>
>> Signed-off-by: Hui Zhu <zhuhui@xxxxxxxxxx>
>> Reviewed-by: Kunwu Chan <chentao@xxxxxxxxxx>
>
> Acked-by: Danilo Krummrich <dakr@xxxxxxxxxx>
>
> @Andrew: Can you please pick this one up once we land Vitaly's series [1]? I'll
> take the other two patches of the series through the Rust alloc tree once -rc1
> is out.
Just a reminder for this one to be picked up; I gave it a quick shot on top of
mm-everything and everything looks fine..
> [1] https://lore.kernel.org/lkml/20250730191921.352591-1-vitaly.wool@xxxxxxxxxxx/