[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8734hkfmln.fsf@kernel.org>
Date: Wed, 15 Jan 2025 10:33:08 +0100
From: Andreas Hindborg <a.hindborg@...nel.org>
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>,
"Christian Brauner" <brauner@...nel.org>, "Jann Horn"
<jannh@...gle.com>, "Suren Baghdasaryan" <surenb@...gle.com>, "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>,
"Trevor Gross" <tmgross@...ch.edu>, <linux-kernel@...r.kernel.org>,
<linux-mm@...ck.org>, <rust-for-linux@...r.kernel.org>
Subject: Re: [PATCH v11 3/8] mm: rust: add vm_insert_page
"Alice Ryhl" <aliceryhl@...gle.com> writes:
> On Mon, Dec 16, 2024 at 3:51 PM Andreas Hindborg <a.hindborg@...nel.org> wrote:
>>
>> "Alice Ryhl" <aliceryhl@...gle.com> writes:
>>
>> > The vm_insert_page method is only usable on vmas with the VM_MIXEDMAP
>> > flag, so we introduce a new type to keep track of such vmas.
>> >
>> > The approach used in this patch assumes that we will not need to encode
>> > many flag combinations in the type. I don't think we need to encode more
>> > than VM_MIXEDMAP and VM_PFNMAP as things are now. However, if that
>> > becomes necessary, using generic parameters in a single type would scale
>> > better as the number of flags increases.
>> >
>> > Acked-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com> (for mm bits)
>> > Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
>> > ---
>> > rust/kernel/mm/virt.rs | 71 +++++++++++++++++++++++++++++++++++++++++++++++++-
>> > 1 file changed, 70 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/rust/kernel/mm/virt.rs b/rust/kernel/mm/virt.rs
>> > index 68c763169cf0..3a23854e14f4 100644
>> > --- a/rust/kernel/mm/virt.rs
>> > +++ b/rust/kernel/mm/virt.rs
>> > @@ -4,7 +4,15 @@
>> >
>> > //! Virtual memory.
>> >
>> > -use crate::{bindings, mm::MmWithUser, types::Opaque};
>> > +use crate::{
>> > + bindings,
>> > + error::{to_result, Result},
>> > + mm::MmWithUser,
>> > + page::Page,
>> > + types::Opaque,
>> > +};
>> > +
>> > +use core::ops::Deref;
>> >
>> > /// A wrapper for the kernel's `struct vm_area_struct` with read access.
>> > ///
>> > @@ -100,6 +108,67 @@ pub fn zap_page_range_single(&self, address: usize, size: usize) {
>> > )
>> > };
>> > }
>> > +
>> > + /// Check whether the `VM_MIXEDMAP` flag is set.
>>
>> Perhaps "Check whether the `VM_MIXEDMAP` flag is set. If so, return
>> `Some`, otherwise `None` ?
>
> How about
>
> If the `VM_MIXEDMAP` flag is set, returns a `VmAreaMixedMap` to this
> VMA, otherwise returns `None`.
>
> This follows the example of slice::as_ascii
Sounds good 👍
Best regards,
Andreas Hindborg
Powered by blists - more mailing lists