[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250225155632.3a8d69e1@eugeo>
Date: Tue, 25 Feb 2025 15:56:32 +0000
From: Gary Guo <gary@...yguo.net>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Matthew Wilcox <willy@...radead.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Vlastimil Babka
<vbabka@...e.cz>, John Hubbard <jhubbard@...dia.com>, "Liam R. Howlett"
<Liam.Howlett@...cle.com>, Andrew Morton <akpm@...ux-foundation.org>, Greg
Kroah-Hartman <gregkh@...uxfoundation.org>, Arnd Bergmann <arnd@...db.de>,
Jann Horn <jannh@...gle.com>, Suren Baghdasaryan <surenb@...gle.com>, Alex
Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, "
Björn Roy Baron" <bjorn3_gh@...tonmail.com>, Benno Lossin
<benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, Trevor
Gross <tmgross@...ch.edu>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, rust-for-linux@...r.kernel.org, Balbir Singh
<balbirs@...dia.com>
Subject: Re: [PATCH v14 1/8] mm: rust: add abstraction for struct mm_struct
On Thu, 13 Feb 2025 11:04:00 +0000
Alice Ryhl <aliceryhl@...gle.com> wrote:
> These abstractions allow you to reference a `struct mm_struct` using
> both mmgrab and mmget refcounts. This is done using two Rust types:
>
> * Mm - represents an mm_struct where you don't know anything about the
> value of mm_users.
> * MmWithUser - represents an mm_struct where you know at compile time
> that mm_users is non-zero.
>
> This allows us to encode in the type system whether a method requires
> that mm_users is non-zero or not. For instance, you can always call
> `mmget_not_zero` but you can only call `mmap_read_lock` when mm_users is
> non-zero.
>
> The struct is called Mm to keep consistency with the C side.
>
> The ability to obtain `current->mm` is added later in this series.
>
> Acked-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> Acked-by: Balbir Singh <balbirs@...dia.com>
> Reviewed-by: Andreas Hindborg <a.hindborg@...nel.org>
> Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
Reviewed-by: Gary Guo <gary@...yguo.net>
> ---
> rust/helpers/helpers.c | 1 +
> rust/helpers/mm.c | 39 +++++++++
> rust/kernel/lib.rs | 1 +
> rust/kernel/mm.rs | 209 +++++++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 250 insertions(+)
Powered by blists - more mailing lists