From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932540AbdJQLMv (ORCPT ); Tue, 17 Oct 2017 07:12:51 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:43451 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932307AbdJQLMt (ORCPT ); Tue, 17 Oct 2017 07:12:49 -0400 X-Google-Smtp-Source: AOwi7QBZFvWx56fDA60Ybv+C9oQ7Oh7r+nDpNIWnls8FAcOl8fO3v+5eAS/560Bo8cezr2YHOJmKjg== Date: Tue, 17 Oct 2017 14:12:46 +0300 From: "Kirill A. Shutemov" To: changbin.du@intel.com Cc: akpm@linux-foundation.org, corbet@lwn.net, hughd@google.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/2] mm, thp: introduce dedicated transparent huge page allocation interfaces Message-ID: <20171017111246.7rhmy7klggxjozom@node.shutemov.name> References: <1508145557-9944-1-git-send-email-changbin.du@intel.com> <1508145557-9944-2-git-send-email-changbin.du@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1508145557-9944-2-git-send-email-changbin.du@intel.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 16, 2017 at 05:19:16PM +0800, changbin.du@intel.com wrote: > @@ -501,6 +501,45 @@ 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; > + > + VM_BUG_ON(!(gfp_mask & __GFP_COMP)); Why do you check for __GFP_COMP only in this helper? > + page = alloc_pages(gfp_mask | __GFP_COMP, HPAGE_PMD_ORDER); And still apply __GFP_COMP anyway? > + if (unlikely(!page)) > + return NULL; > + prep_transhuge_page(page); > + return page; > +} > + > unsigned long __thp_get_unmapped_area(struct file *filp, unsigned long len, > loff_t off, unsigned long flags, unsigned long size) > { -- Kirill A. Shutemov