rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v6 0/2] rust: zpool: add API for C and Rust
@ 2025-09-23 10:25 Vitaly Wool
  2025-09-23 10:26 ` [PATCH v6 1/2] mm: reinstate zpool as a thin API Vitaly Wool
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Vitaly Wool @ 2025-09-23 10:25 UTC (permalink / raw)
  To: linux-mm, rust-for-linux
  Cc: Johannes Weiner, Yosry Ahmed, Nhat Pham, Chengming Zhou,
	Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R . Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Minchan Kim, Sergey Senozhatsky,
	Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	Trevor Gross, Danilo Krummrich, Greg Kroah-Hartman, linux-kernel,
	Vitaly Wool

zpool used to be a common frontend for memory storage pool
implementations. With its removal the opportunity to select an
allocation backend for zswap has been completely lost. However, with
the recent advancements in the vmap/vmalloc field that allow for fast
and simple allocation backends, and the initiative to implement one in
Rust, the zpool API is still necessary, though it's enough to have it
as a thin API for compile time backend selection.

This patchset provides such API and implements the interface to use
it in Rust kernel code, thus enabling both C and Rust implementations
of zpool allocators. zsmalloc and documentation are updated
accordingly.

Co-developed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.se>
---
Changelog:
v1 -> v2:
* reworked to stick to the existing Rust driver infrastructure
* removed raw pointers from the Rust API
v2 -> v3:
* detailed safety requirements for unsafe API functions
* removed unwrap()
* some typo corrections
v3 -> v4:
* added a working example of zpool Rust API usage in the
  documentation part
* change to Flags arranged as a separate patch
* improved safety requirements for ZpoolDriver trait
v4 -> v5:
* created a new type ZpoolHandle for handle representation on the
  Rust side
* improved description of Flags::from_raw()
* pool is no more borrowed as mutable for ZpoolDriver::malloc()
* ZpoolDriver::destroy() removed
* improved ZpoolDriver implementation example
* typos/markup corrections
v5 -> v6:
* removed zpool API is partially restored (to the minimal required
  extent)
* no Adapter based runtime registration is necessary
* a Rust macro for compile time registration is introduced instead
---
 Documentation/admin-guide/mm/zswap.rst |   14 +-
 MAINTAINERS                            |    1 
 include/linux/zpool.h                  |   62 ++++++++
 mm/Kconfig                             |   22 ++-
 mm/zsmalloc.c                          |    3 
 mm/zswap.c                             |   30 ++--
 rust/bindings/bindings_helper.h        |    1 
 rust/kernel/lib.rs                     |    2 
 rust/kernel/zpool.rs                   |  366 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 479 insertions(+), 22 deletions(-)


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

end of thread, other threads:[~2025-09-26 14:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23 10:25 [PATCH v6 0/2] rust: zpool: add API for C and Rust Vitaly Wool
2025-09-23 10:26 ` [PATCH v6 1/2] mm: reinstate zpool as a thin API Vitaly Wool
2025-09-23 10:27 ` [PATCH v6 2/2] rust: zpool: add abstraction for zpool drivers Vitaly Wool
2025-09-23 21:49   ` Benno Lossin
2025-09-24  9:23     ` Vitaly Wool
2025-09-24 17:32       ` Benno Lossin
2025-09-23 16:50 ` [syzbot ci] Re: rust: zpool: add API for C and Rust syzbot ci
2025-09-23 21:59   ` Johannes Weiner
2025-09-24  5:46     ` Vitaly Wool
2025-09-24 17:38       ` Nhat Pham
2025-09-26 14:27         ` Vlastimil Babka

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).