On Thu, Aug 1, 2024 at 4:02 PM Benno Lossin <benno.lossin@xxxxxxxxx> wrote: > > On 01.08.24 14:58, Alice Ryhl wrote: > > diff --git a/rust/kernel/mm.rs b/rust/kernel/mm.rs > > new file mode 100644 > > index 000000000000..ed2db893fb79 > > --- /dev/null > > +++ b/rust/kernel/mm.rs > > @@ -0,0 +1,337 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > + > > +// Copyright (C) 2024 Google LLC. > > + > > +//! Memory management. > > +//! > > +//! C header: [`include/linux/mm.h`](../../../../include/linux/mm.h) > > + > > +use crate::{ > > + bindings, > > + types::{ARef, AlwaysRefCounted, Opaque}, > > +}; > > + > > +use core::{ > > + ops::Deref, > > + ptr::{self, NonNull}, > > +}; > > + > > +pub mod virt; > > + > > +/// A wrapper for the kernel's `struct mm_struct`. > > +/// > > +/// Since `mm_users` may be zero, the associated address space may not exist anymore. You must use > > Can it also be the case that the space never existed to begin with? Then > I would write "the associated address space may not exist." > > Also I think it makes more sense to use "You can use [`mmget_not_zero`] > to be able to access the address space." instead of the second sentence. I took the "may not exist anymore" wording from the C side, so I'm going to keep it. Alice