On Mon, Jan 16, 2023 at 07:18:09PM +0000, Matthew Wilcox (Oracle) wrote: > Replace alloc_zeroed_user_highpage_movable(). The main difference is > returning a folio containing a single page instead of returning the > page, but take the opportunity to rename the function to match other > allocation functions a little better and rewrite the documentation > to place more emphasis on the zeroing rather than the highmem aspect. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> > --- > arch/alpha/include/asm/page.h | 5 ++--- > arch/arm64/include/asm/page.h | 4 ++-- > arch/arm64/mm/fault.c | 4 ++-- > arch/ia64/include/asm/page.h | 14 ++++++-------- > arch/m68k/include/asm/page_no.h | 5 ++--- > arch/s390/include/asm/page.h | 5 ++--- > arch/x86/include/asm/page.h | 5 ++--- > include/linux/highmem.h | 33 ++++++++++++++++----------------- > mm/memory.c | 16 ++++++++++------ > 9 files changed, 44 insertions(+), 47 deletions(-) ... > diff --git a/include/linux/highmem.h b/include/linux/highmem.h > index 56703082f803..9fa462561e05 100644 > --- a/include/linux/highmem.h > +++ b/include/linux/highmem.h > @@ -208,31 +208,30 @@ static inline void clear_user_highpage(struct page *page, unsigned long vaddr) > } > #endif > > -#ifndef __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE_MOVABLE > +#ifndef vma_alloc_zeroed_movable_folio > /** > - * alloc_zeroed_user_highpage_movable - Allocate a zeroed HIGHMEM page for a VMA that the caller knows can move > - * @vma: The VMA the page is to be allocated for > - * @vaddr: The virtual address the page will be inserted into > + * vma_alloc_zeroed_movable_folio - Allocate a zeroed page for a VMA. > + * @vma: The VMA the page is to be allocated for. > + * @vaddr: The virtual address the page will be inserted into. > * > - * Returns: The allocated and zeroed HIGHMEM page > + * This function will allocate a page suitable for inserting into this > + * VMA at this virtual address. It may be allocated from highmem or > + * the movable zone. An architecture may provide its own implementation. > * > - * This function will allocate a page for a VMA that the caller knows will > - * be able to migrate in the future using move_pages() or reclaimed > - * > - * An architecture may override this function by defining > - * __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE_MOVABLE and providing their own > - * implementation. > + * Return: A folio containing one allocated and zeroed page or NULL if > + * we are out of memory. > */ > -static inline struct page * > -alloc_zeroed_user_highpage_movable(struct vm_area_struct *vma, > +static inline > +struct folio *vma_alloc_zeroed_movable_folio(struct vm_area_struct *vma, > unsigned long vaddr) > { > - struct page *page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, vaddr); > + struct folio *folio; > > - if (page) > - clear_user_highpage(page, vaddr); > + folio = vma_alloc_folio(GFP_HIGHUSER_MOVABLE, 0, vma, vaddr, false); Add __GFP_ZERO and simply return vma_alloc_folio(...)? > + if (folio) > + clear_user_highpage(&folio->page, vaddr); > > - return page; > + return folio; > } > #endif -- Sincerely yours, Mike.