Re: [PATCH] rust: mm: add abstractions for mm_struct and vm_area_struct

From: Alice Ryhl
Date: Tue Jul 23 2024 - 11:05:04 EST


On Tue, Jul 23, 2024 at 4:50 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> On Tue, Jul 23, 2024 at 02:32:03PM +0000, Alice Ryhl wrote:
> > +// SAFETY: It is safe to call `mmdrop` on another thread than where `mmgrab` was called.
>
> If I were reading the documentation, I might want to know if it's safe
> to call in interrupt context (either soft or hard). ie can mmdrop
> sleep (if it turns out to be the last owner of the mm).

I'll add some information on that.

> > +/// A wrapper for the kernel's `struct vm_area_struct`.
> > +///
> > +/// It represents an area of virtual memory.
> > +#[repr(transparent)]
> > +pub struct Area {
> > + vma: Opaque<bindings::vm_area_struct>,
> > +}
>
> That seems like a very generic name! MMArea? VMA? Certainly when I'm
> talking to people, I say VMA. struct vm_area_struct is a terrible name
> and I'd be happy to change it if we could stomach that churn. If I were
> naming it today, I'd want to call it struct mm_area.

Yeah, you're right. I should change it. Renaming the C struct seems
like it would be a lot of work. For now, I'll rename it to VmArea to
match C.

Alice