Re: [PATCH 4/4] mm/mempolicy: Use vma_alloc_folio() in new_page()

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

 



On Mon, Apr 04, 2022 at 03:51:30PM -0400, Zi Yan wrote:
> On 4 Apr 2022, at 15:30, Matthew Wilcox (Oracle) wrote:
> >
> > -	if (PageHuge(page)) {
> > -		return alloc_huge_page_vma(page_hstate(compound_head(page)),
> > +	if (folio_test_hugetlb(src)) {
> > +		return alloc_huge_page_vma(page_hstate(&src->page),
> >  				vma, address);
> > -	} else if (PageTransHuge(page)) {
> > -		struct page *thp;
> > -
> > -		thp = alloc_hugepage_vma(GFP_TRANSHUGE, vma, address,
> > -					 HPAGE_PMD_ORDER);
> > -		if (!thp)
> > -			return NULL;
> > -		prep_transhuge_page(thp);
> > -		return thp;
> > +	} else if (folio_test_large(src)) {
> > +		gfp = GFP_TRANSHUGE;
> >  	}
> 
> Nit. The two bracket pairs from the two ifs can be removed.

Even better, the first is a return, so it can simply be:

        if (folio_test_hugetlb(src))
                return alloc_huge_page_vma(page_hstate(&src->page),
                                vma, address);

        if (folio_test_large(src))
                gfp = GFP_TRANSHUGE;

        dst = vma_alloc_folio(gfp, folio_order(src), vma, address,
                        folio_test_large(src));






[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