Re: [PATCH 1/5] mm: Add vma_alloc_zeroed_movable_folio()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 19, 2023 at 12:16:12PM +0200, Mike Rapoport wrote:
> > +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);

This page is about to be mapped into userspace; the kernel isn't going
to touch the data in it.  So we don't care if the kernel's view of this
page contains zeroes, only that the userspace view of this page contains
zeroes.  The architectures that override this do exactly what you
suggest, but they know they have a physical cache and so that works for
them.  For virtually indexed caches, this is more efficient.





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux