[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v86zrr45.fsf@samsung.com>
Date: Thu, 8 Feb 2024 14:02:43 +0000
From: Andreas Hindborg <a.hindborg@...sung.com>
To: Alice Ryhl <aliceryhl@...gle.com>
CC: Trevor Gross <tmgross@...ch.edu>, Miguel Ojeda <ojeda@...nel.org>, "Alex
Gaynor" <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...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>, Kees Cook <keescook@...omium.org>, Al Viro
<viro@...iv.linux.org.uk>, Andrew Morton <akpm@...ux-foundation.org>, "Greg
Kroah-Hartman" <gregkh@...uxfoundation.org>,
Arve Hjønnevåg <arve@...roid.com>, Todd Kjos
<tkjos@...roid.com>, Martijn Coenen <maco@...roid.com>, Joel Fernandes
<joel@...lfernandes.org>, Carlos Llamas <cmllamas@...gle.com>, "Suren
Baghdasaryan" <surenb@...gle.com>, Arnd Bergmann <arnd@...db.de>,
"linux-mm@...ck.org" <linux-mm@...ck.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "rust-for-linux@...r.kernel.org"
<rust-for-linux@...r.kernel.org>, Christian Brauner <brauner@...nel.org>
Subject: Re: [PATCH 3/3] rust: add abstraction for `struct page`
Alice Ryhl <aliceryhl@...gle.com> writes:
> On Thu, Feb 1, 2024 at 7:02 AM Trevor Gross <tmgross@...ch.edu> wrote:
>>
>> On Wed, Jan 24, 2024 at 6:22 AM Alice Ryhl <aliceryhl@...gle.com> wrote:
>> > +/// A pointer to a page that owns the page allocation.
>> > +///
>> > +/// # Invariants
>> > +///
>> > +/// The pointer points at a page, and has ownership over the page.
>> > +pub struct Page {
>> > + page: NonNull<bindings::page>,
>> > +}
>>
>> Shouldn't this be UnsafeCell / Opaque? Since `struct page` contains locks.
>
> That only matters when we use a reference. Here, it's behind a raw pointer.
Why is it behind a pointer rather than being transparent over
`Opaque<bindings::page>` and using a `&Page` instead?
BR Andreas
Powered by blists - more mailing lists