[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87mssngpnc.fsf@samsung.com>
Date: Tue, 30 Jan 2024 09:02:54 +0000
From: Andreas Hindborg <a.hindborg@...sung.com>
To: Matthew Wilcox <willy@...radead.org>
CC: Alice Ryhl <aliceryhl@...gle.com>, 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`
Matthew Wilcox <willy@...radead.org> writes:
> On Wed, Jan 24, 2024 at 11:20:23AM +0000, Alice Ryhl wrote:
>> +impl Page {
>> + /// Allocates a new set of contiguous pages.
>> + pub fn new() -> Result<Self, AllocError> {
>> + // SAFETY: These are the correct arguments to allocate a single page.
>> + let page = unsafe {
>> + bindings::alloc_pages(
>> + bindings::GFP_KERNEL | bindings::__GFP_ZERO | bindings::__GFP_HIGHMEM,
>> + 0,
>> + )
>> + };
>
> This feels too Binder-specific to be 'Page'. Pages are not necessarily
> allocated with GFP_HIGHMEM, nor are they necessarily zeroed. Maybe you
> want a BinderPage type?
Rust null block uses the same definition of these flags [1], so there is
at least that synergy.
I feel like we had the discussion of the flags before, although I can't
find the thread now. I think the conclusion was that we fix them until
we have code that need to actually change them (as to not add dead
code).
BR Andreas
[1] https://github.com/metaspace/linux/blob/702026e6645193fc89b7d55e00dac75fd492bfb8/rust/kernel/pages.rs#L28
Powered by blists - more mailing lists