Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp345092pxf; Thu, 25 Mar 2021 05:38:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6vWkmMCz9vc6o+bCHEcjNgo5/iKGtszrpczm8FT+nd7dNIg99zcn26WYObiXnfU3nDCCv X-Received: by 2002:a17:906:5611:: with SMTP id f17mr9250296ejq.208.1616675922352; Thu, 25 Mar 2021 05:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616675922; cv=none; d=google.com; s=arc-20160816; b=JFa7rdnMNiPTV/GVCouQwmRO2qwKIW9JarQVyuPo/xFCQ0sDb7Z44FZrRYRYV/GZsA +WkVIqrpBTW0cNyZVkQuUBKIs8cNT32vuM7AHepRieSxldUwatgb7KjSMNiEehR+nwhP P+8Gagw52KQszHDBD41CnkkuFfz1UiS15/KT6kzpOPxBFncj6ODvN1Df1mh7QiECDTlX lUWw+DBcnCxb7QKXglPimQhUKa+/h4rFuFQj2Vgwc0zvWUEQcB+h2eOMu2mRC4VpqQIu uEtD0RaZHEt2PYo92IlQ9nDCxPN7aac71Q6u6kGoj5AiZhRoVAnTwL9ZENfBYq4GKGPw Wgig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=sbRnrN5nTJR10vIFnipcoffOqoEbmeDa0uZ3xylrsDI=; b=HRYCYk5haJJmdYREy3SSDHgjrh6vY6nkO6bydH2B7RWgkCNOZNWH/P8/QucvEBpiy2 3nk65AYPlIaD6dQNS4G792xYtlmgBeT7O24qqxDiYZH68GU2iu8EpdJ2+WKcPCr2oqTV o9FZkBJUaT9dp3ETMVIftf2nIBh7Cfp6NMkR631EexEE9WhbftxpGfA1J8aa52Q8Qks9 Aw9YzEIJ+qT2+/hQKY22EHLJp005uImpgZg/3JbLBFxh0ROZOaagXhLnpVBkVV/GXwdJ qkndtwRSm14RPyOTq2eqRPzvwmN2QkM1XEjg4HlnuoxKFqc3Faj7ag3yvyLiV227SGSh C7Sw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si4151949edy.61.2021.03.25.05.38.12; Thu, 25 Mar 2021 05:38:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbhCYMhk (ORCPT + 99 others); Thu, 25 Mar 2021 08:37:40 -0400 Received: from outbound-smtp57.blacknight.com ([46.22.136.241]:52099 "EHLO outbound-smtp57.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230452AbhCYMhQ (ORCPT ); Thu, 25 Mar 2021 08:37:16 -0400 Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp57.blacknight.com (Postfix) with ESMTPS id 398CAFA852 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-nfs@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) {