From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0ECDC433DB for ; Sun, 24 Jan 2021 12:05:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 63D7F22C9D for ; Sun, 24 Jan 2021 12:05:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63D7F22C9D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0A7696B000A; Sun, 24 Jan 2021 07:05:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 059DD6B000C; Sun, 24 Jan 2021 07:05:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED9E26B000D; Sun, 24 Jan 2021 07:05:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id D814B6B000A for ; Sun, 24 Jan 2021 07:05:10 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id A7820180ACEE9 for ; Sun, 24 Jan 2021 12:05:10 +0000 (UTC) X-FDA: 77740537980.10.leaf08_32010482757c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 8C39616A4B1 for ; Sun, 24 Jan 2021 12:05:10 +0000 (UTC) X-HE-Tag: leaf08_32010482757c X-Filterd-Recvd-Size: 7763 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf33.hostedemail.com (Postfix) with ESMTP for ; Sun, 24 Jan 2021 12:05:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=NLA6rYEjOY5mJEfKpcEacKgfdrOF2HChstZ5QeOKD5g=; b=WB3EppXP3aaLjKgM1fl53L4iiI 9suadnmn2B8+1lgnFpmndo+CeHDSM7aSXxNcKgvTH1YumrWYrhuLhl5xbZHs3hoB6AkZhQE6/9Gm6 zoew806oQ+vCdYJCkunTywAHJtIco/UzTeHqma0cyfaOZuQ1QBK1+y57rmFTRwYt9b+Kd9skE9xaY x9t1BQQqrFKfYy0X+rm0XB+Lk0voXTGzmk+JlB3qsvTbSRvIOB4hV9yoMHqACP/ADgMCsf6tLPUG7 zhCfxVYoAn40CyKoQF/8POqj0acvHhpy1osa2iIrYgJGBv8JAIF8RuOjrt6i7ErooinfUcH9I8llv eKriVt0g==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1l3e87-002wPr-BE; Sun, 24 Jan 2021 12:04:34 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 2/2] mm: Combine __alloc_pages and __alloc_pages_nodemask Date: Sun, 24 Jan 2021 12:03:57 +0000 Message-Id: <20210124120357.701077-3-willy@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210124120357.701077-1-willy@infradead.org> References: <20210124120357.701077-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: There are only two callers of __alloc_pages() so prune the thicket of alloc_pages variants by combining the two functions together. Current callers of __alloc_pages() simply add an extra 'NULL' parameter and current callers of __alloc_pages_nodemask() call __alloc_pages() instead. Signed-off-by: Matthew Wilcox (Oracle) --- Documentation/admin-guide/mm/transhuge.rst | 2 +- include/linux/gfp.h | 13 +++---------- mm/hugetlb.c | 2 +- mm/internal.h | 4 ++-- mm/mempolicy.c | 6 +++--- mm/migrate.c | 2 +- mm/page_alloc.c | 5 ++--- 7 files changed, 13 insertions(+), 21 deletions(-) diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/a= dmin-guide/mm/transhuge.rst index 3b8a336511a4..c9c37f16eef8 100644 --- a/Documentation/admin-guide/mm/transhuge.rst +++ b/Documentation/admin-guide/mm/transhuge.rst @@ -402,7 +402,7 @@ compact_fail but failed. =20 It is possible to establish how long the stalls were using the function -tracer to record how long was spent in __alloc_pages_nodemask and +tracer to record how long was spent in __alloc_pages() and using the mm_page_alloc tracepoint to identify which allocations were for huge pages. =20 diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 53caa9846854..acca2c487da8 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -501,15 +501,8 @@ static inline int arch_make_page_accessible(struct p= age *page) } #endif =20 -struct page * -__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred= _nid, - nodemask_t *nodemask); - -static inline struct page * -__alloc_pages(gfp_t gfp_mask, unsigned int order, int preferred_nid) -{ - return __alloc_pages_nodemask(gfp_mask, order, preferred_nid, NULL); -} +struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_= nid, + nodemask_t *nodemask); =20 /* * Allocate pages, preferring the node given as nid. The node must be va= lid and @@ -521,7 +514,7 @@ __alloc_pages_node(int nid, gfp_t gfp_mask, unsigned = int order) VM_BUG_ON(nid < 0 || nid >=3D MAX_NUMNODES); VM_WARN_ON((gfp_mask & __GFP_THISNODE) && !node_online(nid)); =20 - return __alloc_pages(gfp_mask, order, nid); + return __alloc_pages(gfp_mask, order, nid, NULL); } =20 /* diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a6bad1f686c5..604857289e02 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1644,7 +1644,7 @@ static struct page *alloc_buddy_huge_page(struct hs= tate *h, gfp_mask |=3D __GFP_RETRY_MAYFAIL; if (nid =3D=3D NUMA_NO_NODE) nid =3D numa_mem_id(); - page =3D __alloc_pages_nodemask(gfp_mask, order, nid, nmask); + page =3D __alloc_pages(gfp_mask, order, nid, nmask); if (page) __count_vm_event(HTLB_BUDDY_PGALLOC); else diff --git a/mm/internal.h b/mm/internal.h index 8e9c660f33ca..19aee773f6a8 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -126,10 +126,10 @@ extern pmd_t *mm_find_pmd(struct mm_struct *mm, uns= igned long address); * family of functions. * * nodemask, migratetype and highest_zoneidx are initialized only once i= n - * __alloc_pages_nodemask() and then never change. + * __alloc_pages() and then never change. * * zonelist, preferred_zone and highest_zoneidx are set first in - * __alloc_pages_nodemask() for the fast path, and might be later change= d + * __alloc_pages() for the fast path, and might be later changed * in __alloc_pages_slowpath(). All other functions pass the whole struc= ture * by a const pointer. */ diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 6961238c7ef5..addf0854d693 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -2140,7 +2140,7 @@ static struct page *alloc_page_interleave(gfp_t gfp= , unsigned order, { struct page *page; =20 - page =3D __alloc_pages(gfp, order, nid); + page =3D __alloc_pages(gfp, order, nid, NULL); /* skip NUMA_INTERLEAVE_HIT counter update if numa stats is disabled */ if (!static_branch_likely(&vm_numa_stat_key)) return page; @@ -2237,7 +2237,7 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_are= a_struct *vma, =20 nmask =3D policy_nodemask(gfp, pol); preferred_nid =3D policy_node(gfp, pol, node); - page =3D __alloc_pages_nodemask(gfp, order, preferred_nid, nmask); + page =3D __alloc_pages(gfp, order, preferred_nid, nmask); mpol_cond_put(pol); out: return page; @@ -2274,7 +2274,7 @@ struct page *alloc_pages_current(gfp_t gfp, unsigne= d order) if (pol->mode =3D=3D MPOL_INTERLEAVE) page =3D alloc_page_interleave(gfp, order, interleave_nodes(pol)); else - page =3D __alloc_pages_nodemask(gfp, order, + page =3D __alloc_pages(gfp, order, policy_node(gfp, pol, numa_node_id()), policy_nodemask(gfp, pol)); =20 diff --git a/mm/migrate.c b/mm/migrate.c index a3e1acc72ad7..f1ca50febfbe 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1617,7 +1617,7 @@ struct page *alloc_migration_target(struct page *pa= ge, unsigned long private) if (is_highmem_idx(zidx) || zidx =3D=3D ZONE_MOVABLE) gfp_mask |=3D __GFP_HIGHMEM; =20 - new_page =3D __alloc_pages_nodemask(gfp_mask, order, nid, mtc->nmask); + new_page =3D __alloc_pages(gfp_mask, order, nid, mtc->nmask); =20 if (new_page && PageTransHuge(new_page)) prep_transhuge_page(new_page); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index d72ef706f6e6..90a1eb06c11b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4962,8 +4962,7 @@ static inline bool prepare_alloc_pages(gfp_t gfp_ma= sk, unsigned int order, /* * This is the 'heart' of the zoned buddy allocator. */ -struct page * -__alloc_pages_nodemask(gfp_t gfp, unsigned int order, int preferred_nid, +struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_= nid, nodemask_t *nodemask) { struct page *page; @@ -5025,7 +5024,7 @@ __alloc_pages_nodemask(gfp_t gfp, unsigned int orde= r, int preferred_nid, =20 return page; } -EXPORT_SYMBOL(__alloc_pages_nodemask); +EXPORT_SYMBOL(__alloc_pages); =20 /* * Common helper functions. Never use with __GFP_HIGHMEM because the ret= urned --=20 2.29.2