linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Du, Changbin" <changbin.du@intel.com>
To: Christopher Lameter <cl@linux.com>
Cc: Changbin Du <changbin.du@intel.com>,
	akpm@linux-foundation.org, corbet@lwn.net, hughd@google.com,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, khandual@linux.vnet.ibm.com,
	kirill@shutemov.name
Subject: Re: [PATCH v2 1/2] mm, thp: introduce dedicated transparent huge page allocation interfaces
Date: Sun, 22 Oct 2017 23:55:51 +0800	[thread overview]
Message-ID: <20171022155551.GA23682@intel.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1710200634180.10736@nuc-kabylake>

[-- Attachment #1: Type: text/plain, Size: 2196 bytes --]

Hi Lameter,
On Fri, Oct 20, 2017 at 06:35:44AM -0500, Christopher Lameter wrote:
> On Fri, 20 Oct 2017, changbin.du@intel.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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  reply	other threads:[~2017-10-22 16:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-20  8:36 [PATCH v2 0/2] mm, thp: introduce dedicated transparent huge page allocation interfaces changbin.du
2017-10-20  8:36 ` [PATCH v2 1/2] " changbin.du
2017-10-20 11:35   ` Christopher Lameter
2017-10-22 15:55     ` Du, Changbin [this message]
2017-10-20  8:36 ` [PATCH v2 2/2] mm: rename page dtor functions to {compound,huge,transhuge}_page__dtor changbin.du

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171022155551.GA23682@intel.com \
    --to=changbin.du@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=corbet@lwn.net \
    --cc=hughd@google.com \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=kirill@shutemov.name \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).