rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/2] rust: alloc: kvec doc example and allocator unit tests
@ 2025-07-25  7:02 Hui Zhu
  2025-07-25  7:02 ` [PATCH v5 1/2] rust: allocator: add KUnit tests for alignment guarantees Hui Zhu
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hui Zhu @ 2025-07-25  7:02 UTC (permalink / raw)
  To: Danilo Krummrich, Lorenzo Stoakes, Vlastimil Babka,
	Liam R . Howlett, Uladzislau Rezki, Miguel Ojeda, Alex Gaynor,
	Boqun Feng, Gary Guo, bjorn3_gh, Benno Lossin, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, rust-for-linux, linux-kernel
  Cc: Hui Zhu

From: Hui Zhu <zhuhui@kylinos.cn>

This series includes two Rust patches:

Patch 1 adds KUnit tests for alignment guarantees in Rust allocators.
Validates kmalloc handling of standard (128B) and page-size (8KB)
alignments.
Confirms vmalloc/kvmalloc reject oversized alignment requests.
Ensures Rust allocators respect kernel allocation constraints.

Patch 2 improves the documentation for KVec::as_slice() by adding a
code example. This shows how to use the method with push operations and
assertions.

Both patches are co-developed with Geliang Tang. Tested on x86_64 using
KUnit.

Changelog:
v5:
According to the comments of Danilo, change to use generic struct and
allocator Generics in allocator.rs.
v4:
According to the comments of, add the error check for push.
v3:
According to the comments of Danilo and Boqun, move KVec test to doc
example and move VBox to allocator unit tests.
v2:
According to the comments of Danilo, updated the commit to samples the
usage of VBox and KVec.

Hui Zhu (2):
  rust: allocator: add KUnit tests for alignment guarantees
  rust: alloc: kvec: add doc example for as_slice method

 rust/kernel/alloc/allocator.rs | 58 ++++++++++++++++++++++++++++++++++
 rust/kernel/alloc/kvec.rs      | 10 ++++++
 2 files changed, 68 insertions(+)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-07-30  3:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-25  7:02 [PATCH v5 0/2] rust: alloc: kvec doc example and allocator unit tests Hui Zhu
2025-07-25  7:02 ` [PATCH v5 1/2] rust: allocator: add KUnit tests for alignment guarantees Hui Zhu
2025-07-25  9:50   ` Danilo Krummrich
2025-07-25 10:02     ` Danilo Krummrich
2025-07-30  3:59       ` Hui Zhu
2025-07-25  7:02 ` [PATCH v5 2/2] rust: alloc: kvec: add doc example for as_slice method Hui Zhu
2025-07-27  7:16 ` [PATCH v5 0/2] rust: alloc: kvec doc example and allocator unit tests Alice Ryhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).