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>,
"Matthew Wilcox" <willy@infradead.org>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
"Vlastimil Babka" <vbabka@suse.cz>,
"Lorenzo Stoakes" <lorenzo.stoakes@oracle.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
rust-for-linux@vger.kernel.org
Subject: Re: [PATCH v3] rust: mm: add abstractions for mm_struct and vm_area_struct
Date: Thu, 01 Aug 2024 15:29:15 +0000 [thread overview]
Message-ID: <79ce2394-25af-469f-88f1-5de31b9f48f6@proton.me> (raw)
In-Reply-To: <CAH5fLgi__fgLnifj3ON9iNyugnUzm82VWWduO3Ds6Hz54H1ZWQ@mail.gmail.com>
On 01.08.24 16:37, Alice Ryhl wrote:
> On Thu, Aug 1, 2024 at 4:02 PM Benno Lossin <benno.lossin@proton.me> wrote:
>> On 01.08.24 14:58, Alice Ryhl wrote:
>>> +/// A wrapper for the kernel's `struct mm_struct`.
>>> +///
>>> +/// This type is identical to `MmWithUser` except that it uses `mmput_async` when dropping a
>>> +/// refcount. This means that the destructor of `ARef<MmWithUserAsync>` is safe to call in atomic
>>> +/// context.
>>
>> Missing Invariants.
>
> Hmm. Structs will inherit invariants from their fields, no?
No, usually the fields handle their invariants on their own, eg NonNull
can only be constructed if the pointer is not null. But Refcounted
structs are somewhat special in this regard, since you cannot construct
them by-value. Thus if you build a new struct that contains them, then
that also needs to be refcounted and have its own invariant to guarantee
that the field still is refcounted.
---
Cheers,
Benno
next prev parent reply other threads:[~2024-08-01 15:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-01 12:58 Alice Ryhl
2024-08-01 14:01 ` Benno Lossin
2024-08-01 14:37 ` Alice Ryhl
2024-08-01 15:29 ` Benno Lossin [this message]
2024-08-02 7:32 ` Alice Ryhl
2024-08-01 14:02 ` Danilo Krummrich
2024-08-01 14:07 ` 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=79ce2394-25af-469f-88f1-5de31b9f48f6@proton.me \
--to=benno.lossin@proton.me \
--cc=Liam.Howlett@oracle.com \
--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=lorenzo.stoakes@oracle.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=vbabka@suse.cz \
--cc=wedsonaf@gmail.com \
--cc=willy@infradead.org \
/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