[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87bjuye2yy.fsf@kernel.org>
Date: Wed, 19 Feb 2025 09:46:45 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
To: "Asahi Lina" <lina@...hilina.net>
Cc: "Miguel Ojeda" <ojeda@...nel.org>, "Alex Gaynor"
<alex.gaynor@...il.com>, "Boqun Feng" <boqun.feng@...il.com>, "Gary Guo"
<gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Benno
Lossin" <benno.lossin@...ton.me>, "Alice Ryhl" <aliceryhl@...gle.com>,
"Trevor Gross" <tmgross@...ch.edu>, "Jann Horn" <jannh@...gle.com>,
"Matthew Wilcox" <willy@...radead.org>, "Paolo Bonzini"
<pbonzini@...hat.com>, "Danilo Krummrich" <dakr@...nel.org>, "Wedson
Almeida Filho" <wedsonaf@...il.com>, "Valentin Obst"
<kernel@...entinobst.de>, "Andrew Morton" <akpm@...ux-foundation.org>,
<linux-mm@...ck.org>, <airlied@...hat.com>, "Abdiel Janulgue"
<abdiel.janulgue@...il.com>, <rust-for-linux@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <asahi@...ts.linux.dev>
Subject: Re: [PATCH 2/6] rust: page: Convert to Ownable
"Asahi Lina" <lina@...hilina.net> writes:
> This allows Page references to be returned as borrowed references,
> without necessarily owning the struct page.
>
> Signed-off-by: Asahi Lina <lina@...hilina.net>
> ---
> rust/kernel/page.rs | 30 ++++++++++++++++--------------
> 1 file changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/rust/kernel/page.rs b/rust/kernel/page.rs
> index fdac6c375fe46e1ba589f1640afeae3e001e39ae..0b6cbe02522ab6e6e1810288ad23af4e4aa587d8 100644
> --- a/rust/kernel/page.rs
> +++ b/rust/kernel/page.rs
> @@ -7,6 +7,7 @@
> bindings,
> error::code::*,
> error::Result,
> + types::{Opaque, Ownable, Owned},
> uaccess::UserSliceReader,
> };
> use core::ptr::{self, NonNull};
> @@ -30,13 +31,10 @@ pub const fn page_align(addr: usize) -> usize {
> (addr + (PAGE_SIZE - 1)) & PAGE_MASK
> }
>
> -/// A pointer to a page that owns the page allocation.
> -///
> -/// # Invariants
> -///
> -/// The pointer is valid, and has ownership over the page.
> +/// An object representing a memory page in the kernel (`struct page`).
Can you link to the header file containing `struct page`?
.. memory page in the kernel ([`struct page`]).
[`struct page`]: srctree/include/linux/mm_types.h
Otherwise looks good 👍
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists