lkml.org 
[lkml]   [2024]   [Jan]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 3/3] rust: add abstraction for `struct page`
On Tue, Jan 30, 2024 at 10:02 AM Andreas Hindborg
<a.hindborg@samsung.com> wrote:
>
>
> Matthew Wilcox <willy@infradead.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).

I don't think there's any problem with replacing the constructor with
one that takes a flag argument dead-code-wise. I can definitely do
that.

Alice

\
 
 \ /
  Last update: 2024-05-27 14:39    [W:0.046 / U:1.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site