rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/7] BorrowedPage, AsPageIter and VmallocPageIter
@ 2025-08-14  9:33 Danilo Krummrich
  2025-08-14  9:33 ` [PATCH v4 1/7] rust: page: implement BorrowedPage Danilo Krummrich
                   ` (7 more replies)
  0 siblings, 8 replies; 28+ messages in thread
From: Danilo Krummrich @ 2025-08-14  9:33 UTC (permalink / raw)
  To: lorenzo.stoakes, vbabka, Liam.Howlett, urezki, ojeda, alex.gaynor,
	boqun.feng, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl,
	tmgross, abdiel.janulgue, acourbot
  Cc: rust-for-linux, Danilo Krummrich

This patch series implements the BorrowedPage type, the AsPageIter trait and
VmallocPageIter type.

AsPageIter can be implemented by any type that owns pages to allow users to
borrow them through a generic interface.

For instance, this is useful to access and borrow the backing pages of
allocation primitives, such as Box and Vec, backing a scatterlist.

Hence, implement AsPageIter for VBox and VVec.

Additionally, implement Vmalloc::to_page() and ArrayLayout::size(), which are
dependencies of the above.

Changes in v4:
  - Rename IntoPageIter into AsPageIter.
  - Put lifetime on AsPageIter::Iter instead of AsPageIter itself.
  - Implement size_hint() for VmallocPageIter.
  - Use PhantomData<page::BorrowedPage<'a>> instead of PhantomData<&'a u8>.

Changes in v3:
  - Generalize the previous PageOwner impl of VBox and VVec in VmallocPageIter.
  - Correspondingly, replace PageOwner with IntoPageIter.

Changes in v2:
  - BorrowedPage
    - Add link to Ownable
    - Use borrow_page() in the example
  - Add PageOwner, Vmalloc::to_page(), ArrayLayout, VBox, VVec patches.


Danilo Krummrich (7):
  rust: page: implement BorrowedPage
  rust: alloc: vmalloc: implement Vmalloc::to_page()
  rust: alloc: implement VmallocPageIter
  rust: page: define trait AsPageIter
  rust: alloc: kbox: implement AsPageIter for VBox
  rust: alloc: layout: implement ArrayLayout::size()
  rust: alloc: kvec: implement AsPageIter for VVec

 rust/bindings/bindings_helper.h |   1 +
 rust/kernel/alloc/allocator.rs  | 147 ++++++++++++++++++++++++++++++++
 rust/kernel/alloc/kbox.rs       |  40 ++++++++-
 rust/kernel/alloc/kvec.rs       |  40 ++++++++-
 rust/kernel/alloc/layout.rs     |   5 ++
 rust/kernel/page.rs             |  87 ++++++++++++++++++-
 6 files changed, 317 insertions(+), 3 deletions(-)


base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
-- 
2.50.1


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

end of thread, other threads:[~2025-08-19 13:16 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14  9:33 [PATCH v4 0/7] BorrowedPage, AsPageIter and VmallocPageIter Danilo Krummrich
2025-08-14  9:33 ` [PATCH v4 1/7] rust: page: implement BorrowedPage Danilo Krummrich
2025-08-19 12:42   ` Daniel Almeida
2025-08-14  9:33 ` [PATCH v4 2/7] rust: alloc: vmalloc: implement Vmalloc::to_page() Danilo Krummrich
2025-08-19 12:46   ` Daniel Almeida
2025-08-14  9:33 ` [PATCH v4 3/7] rust: alloc: implement VmallocPageIter Danilo Krummrich
2025-08-18 12:02   ` Alexandre Courbot
2025-08-19 11:48   ` Alice Ryhl
2025-08-19 12:02     ` Danilo Krummrich
2025-08-19 12:58   ` Daniel Almeida
2025-08-14  9:33 ` [PATCH v4 4/7] rust: page: define trait AsPageIter Danilo Krummrich
2025-08-18 12:06   ` Alexandre Courbot
2025-08-18 12:07     ` Danilo Krummrich
2025-08-18 12:14       ` Alexandre Courbot
2025-08-18 12:18         ` Danilo Krummrich
2025-08-19 11:49   ` Alice Ryhl
2025-08-19 13:08   ` Daniel Almeida
2025-08-19 13:16     ` Danilo Krummrich
2025-08-14  9:33 ` [PATCH v4 5/7] rust: alloc: kbox: implement AsPageIter for VBox Danilo Krummrich
2025-08-18 12:07   ` Alexandre Courbot
2025-08-19 11:50   ` Alice Ryhl
2025-08-19 12:06     ` Danilo Krummrich
2025-08-14  9:33 ` [PATCH v4 6/7] rust: alloc: layout: implement ArrayLayout::size() Danilo Krummrich
2025-08-14  9:33 ` [PATCH v4 7/7] rust: alloc: kvec: implement AsPageIter for VVec Danilo Krummrich
2025-08-18 12:09   ` Alexandre Courbot
2025-08-19 11:51   ` Alice Ryhl
2025-08-19 13:11   ` Daniel Almeida
2025-08-18 12:11 ` [PATCH v4 0/7] BorrowedPage, AsPageIter and VmallocPageIter Alexandre Courbot

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