[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20171022155551.GA23682@intel.com>
Date: Sun, 22 Oct 2017 23:55:51 +0800
From: "Du, Changbin" <changbin.du@...el.com>
To: Christopher Lameter <cl@...ux.com>
Cc: Changbin Du <changbin.du@...el.com>, akpm@...ux-foundation.org,
corbet@....net, hughd@...gle.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
khandual@...ux.vnet.ibm.com, kirill@...temov.name
Subject: Re: [PATCH v2 1/2] mm, thp: introduce dedicated transparent huge
page allocation interfaces
Hi Lameter,
On Fri, Oct 20, 2017 at 06:35:44AM -0500, Christopher Lameter wrote:
> On Fri, 20 Oct 2017, changbin.du@...el.com wrote:
>
> > diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> > index 269b5df..2a960fc 100644
> > --- a/mm/huge_memory.c
> > +++ b/mm/huge_memory.c
> > @@ -501,6 +501,43 @@ void prep_transhuge_page(struct page *page)
> > set_compound_page_dtor(page, TRANSHUGE_PAGE_DTOR);
> > }
> >
> > +struct page *alloc_transhuge_page_vma(gfp_t gfp_mask,
> > + struct vm_area_struct *vma, unsigned long addr)
> > +{
> > + struct page *page;
> > +
> > + page = alloc_pages_vma(gfp_mask | __GFP_COMP, HPAGE_PMD_ORDER,
> > + vma, addr, numa_node_id(), true);
> > + if (unlikely(!page))
> > + return NULL;
> > + prep_transhuge_page(page);
> > + return page;
> > +}
> > +
> > +struct page *alloc_transhuge_page_nodemask(gfp_t gfp_mask,
> > + int preferred_nid, nodemask_t *nmask)
> > +{
> > + struct page *page;
> > +
> > + page = __alloc_pages_nodemask(gfp_mask | __GFP_COMP, HPAGE_PMD_ORDER,
> > + preferred_nid, nmask);
> > + if (unlikely(!page))
> > + return NULL;
> > + prep_transhuge_page(page);
> > + return page;
> > +}
> > +
> > +struct page *alloc_transhuge_page(gfp_t gfp_mask)
> > +{
> > + struct page *page;
> > +
> > + page = alloc_pages(gfp_mask | __GFP_COMP, HPAGE_PMD_ORDER);
> > + if (unlikely(!page))
> > + return NULL;
> > + prep_transhuge_page(page);
> > + return page;
> > +}
> > +
>
> These look pretty similar to the code used for huge pages (aside from the
> call to prep_transhuge_page(). Maybe we can have common allocation
> primitives for huge pages?
>
yes, they are similar to each other, but allocation approaches are much different.
hugetlbfs alloc page from reserved memory, while thp just directly get page
from page allocator.
I think it doesn't make much sense to provide uified api for both of them, because
transhuge_page allocation primitives only used within hugetlbfs code. thp
allocation is more common as system wide. If Unify them then all the api need 1 more
parameter to distinguish what huge page is going to allocate.
--
Thanks,
Changbin Du
Download attachment "signature.asc" of type "application/pgp-signature" (474 bytes)
Powered by blists - more mailing lists