rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benno Lossin <benno.lossin@proton.me>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	rust-for-linux@vger.kernel.org
Subject: Re: [PATCH] rust: mm: add abstractions for mm_struct and vm_area_struct
Date: Fri, 26 Jul 2024 13:36:57 +0000	[thread overview]
Message-ID: <b7e8b816-a3c1-454c-bf97-516bf78c697c@proton.me> (raw)
In-Reply-To: <CAH5fLgjfiE6xNpKVBAgXu=eFyE65k+RxWqNt10J+44pK-mJgTw@mail.gmail.com>

On 26.07.24 10:32, Alice Ryhl wrote:
> On Fri, Jul 26, 2024 at 10:11 AM Benno Lossin <benno.lossin@proton.me> wrote:
>>
>> On 23.07.24 16:32, Alice Ryhl wrote:
>>> This is a follow-up to the page abstractions [1] that were recently
>>> merged in 6.11. Rust Binder will need these abstractions to manipulate
>>> the vma in its implementation of the mmap fop on the Binder file.
>>>
>>> The ARef wrapper is not used for mm_struct because there are several
>>> different types of refcounts.
>>
>> I am confused, why can't you use the `ARef` wrapper for the different
>> types that you create below?
> 
> Well, maybe I can, but it means we have several wrapper structs of
> Opaque<mm_struct>. Would it not be confusing? Could you suggest a
> naming scheme for the structs I should have?

I don't know of a good way to avoid that, IMO your current
implementation has the same issue (multiple wrappers). So I don't think
it's that bad to have multiple wrappers for one C struct.
We could also use generics to solve this, right? I am not sure about the
ergonomics/looks, so for example:
- ARef<Mm<Grab>>
- ARef<Mm<Get>>
- ARef<Mm<Async>>

I think it looks fine, then you also only have one struct wrapper.

BTW what does "mm" stand for? Memory management?

---
Cheers,
Benno


  reply	other threads:[~2024-07-26 13:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-23 14:32 [PATCH] rust: mm: add abstractions for mm_struct and vm_area_struct Alice Ryhl
2024-07-23 14:50 ` Matthew Wilcox
2024-07-23 15:04   ` Alice Ryhl
2024-07-26  8:10 ` Benno Lossin
2024-07-26  8:14   ` Alice Ryhl
2024-07-26  8:26     ` Benno Lossin
2024-07-26  8:33       ` Alice Ryhl
2024-07-26  8:32   ` Alice Ryhl
2024-07-26 13:36     ` Benno Lossin [this message]
2024-07-26 19:04       ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b7e8b816-a3c1-454c-bf97-516bf78c697c@proton.me \
    --to=benno.lossin@proton.me \
    --cc=a.hindborg@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).