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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 2E23CC433E0 for ; Thu, 25 Mar 2021 12:38:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08E0961A21 for ; Thu, 25 Mar 2021 12:38:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230273AbhCYMhm (ORCPT ); Thu, 25 Mar 2021 08:37:42 -0400 Received: from outbound-smtp18.blacknight.com ([46.22.139.245]:39695 "EHLO outbound-smtp18.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbhCYMhQ (ORCPT ); Thu, 25 Mar 2021 08:37:16 -0400 Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp18.blacknight.com (Postfix) with ESMTPS id 415EC1C35EC for ; Thu, 25 Mar 2021 12:37:15 +0000 (GMT) Received: (qmail 32076 invoked from network); 25 Mar 2021 12:37:15 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 25 Mar 2021 12:37:14 -0000 Date: Thu, 25 Mar 2021 12:37:13 +0000 From: Mel Gorman To: Matthew Wilcox Cc: Andrew Morton , Chuck Lever , Jesper Dangaard Brouer , Christoph Hellwig , Alexander Duyck , Vlastimil Babka , Ilias Apalodimas , LKML , Linux-Net , Linux-MM , Linux-NFS Subject: Re: [PATCH 2/9] mm/page_alloc: Add a bulk page allocator Message-ID: <20210325123713.GQ3697@techsingularity.net> References: <20210325114228.27719-1-mgorman@techsingularity.net> <20210325114228.27719-3-mgorman@techsingularity.net> <20210325120525.GU1719932@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20210325120525.GU1719932@casper.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 25, 2021 at 12:05:25PM +0000, Matthew Wilcox wrote: > On Thu, Mar 25, 2021 at 11:42:21AM +0000, Mel Gorman wrote: > > +int __alloc_pages_bulk(gfp_t gfp, int preferred_nid, > > + nodemask_t *nodemask, int nr_pages, > > + struct list_head *list); > > + > > +/* Bulk allocate order-0 pages */ > > +static inline unsigned long > > +alloc_pages_bulk(gfp_t gfp, unsigned long nr_pages, struct list_head *list) > > +{ > > + return __alloc_pages_bulk(gfp, numa_mem_id(), NULL, nr_pages, list); > > Discrepancy in the two return types here. Suspect they should both > be 'unsigned int' so there's no question about "can it return an errno". > I'll make it unsigned long as the nr_pages parameter is unsigned long. It's a silly range to have for pages but it matches alloc_contig_range even though free_contig_range takes unsigned int *sigh* > > > > +/* > > If you could make that "/**" instead ... > I decided not to until we're reasonably sure the semantics are not going to change. ---8<--- mm/page_alloc: Add a bulk page allocator -fix Matthew Wilcox pointed out that the return type for alloc_pages_bulk() and __alloc_pages_bulk() is inconsistent. Fix it. Signed-off-by: Mel Gorman --- include/linux/gfp.h | 2 +- mm/page_alloc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 4a304fd39916..a2be8f4174a9 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -518,7 +518,7 @@ static inline int arch_make_page_accessible(struct page *page) struct page *__alloc_pages(gfp_t gfp, unsigned int order, int preferred_nid, nodemask_t *nodemask); -int __alloc_pages_bulk(gfp_t gfp, int preferred_nid, +unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, nodemask_t *nodemask, int nr_pages, struct list_head *list); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index eb547470a7e4..92d55f80c289 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4978,7 +4978,7 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, * * Returns the number of pages on the list. */ -int __alloc_pages_bulk(gfp_t gfp, int preferred_nid, +unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, nodemask_t *nodemask, int nr_pages, struct list_head *page_list) {