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). BR Andreas [1] https://github.com/metaspace/linux/blob/702026e6645193fc89b7d55e00dac75fd492bfb8/rust/kernel/pages.rs#L28