On Tue, Jan 30, 2024 at 10:02 AM Andreas Hindborg <a.hindborg@xxxxxxxxxxx> wrote: > > > Matthew Wilcox <willy@xxxxxxxxxxxxx> 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