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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 26FA0C433E0 for ; Tue, 9 Mar 2021 18:11:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 54D316522E for ; Tue, 9 Mar 2021 18:11:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 54D316522E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C4AF08D012D; Tue, 9 Mar 2021 13:11:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BFA288D012A; Tue, 9 Mar 2021 13:11:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9BBC8D012D; Tue, 9 Mar 2021 13:11:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id 8DFC98D012A for ; Tue, 9 Mar 2021 13:11:12 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3E3A7181AF5EA for ; Tue, 9 Mar 2021 18:11:12 +0000 (UTC) X-FDA: 77901127584.24.B130653 Received: from outbound-smtp47.blacknight.com (outbound-smtp47.blacknight.com [46.22.136.64]) by imf14.hostedemail.com (Postfix) with ESMTP id 9858AC001C74 for ; Tue, 9 Mar 2021 18:10:05 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp47.blacknight.com (Postfix) with ESMTPS id 1A920FBF75 for ; Tue, 9 Mar 2021 18:10:08 +0000 (GMT) Received: (qmail 21638 invoked from network); 9 Mar 2021 18:10:07 -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); 9 Mar 2021 18:10:07 -0000 Date: Tue, 9 Mar 2021 18:10:06 +0000 From: Mel Gorman To: Christoph Hellwig Cc: Andrew Morton , Chuck Lever , Jesper Dangaard Brouer , LKML , Linux-Net , Linux-MM , Linux-NFS Subject: Re: [PATCH 2/5] mm/page_alloc: Add a bulk page allocator Message-ID: <20210309181006.GP3697@techsingularity.net> References: <20210301161200.18852-1-mgorman@techsingularity.net> <20210301161200.18852-3-mgorman@techsingularity.net> <20210309171230.GA198878@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20210309171230.GA198878@infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Stat-Signature: myo3z67s3kubjj48bcmdxdf4az3tir89 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9858AC001C74 Received-SPF: none (techsingularity.net>: No applicable sender policy available) receiver=imf14; identity=mailfrom; envelope-from=""; helo=outbound-smtp47.blacknight.com; client-ip=46.22.136.64 X-HE-DKIM-Result: none/none X-HE-Tag: 1615313405-507580 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: On Tue, Mar 09, 2021 at 05:12:30PM +0000, Christoph Hellwig wrote: > Would vmalloc be another good user of this API? > > > + /* May set ALLOC_NOFRAGMENT, fragmentation will return 1 page. */ > > + if (!prepare_alloc_pages(gfp_mask, 0, preferred_nid, nodemask, &ac, &alloc_mask, &alloc_flags)) > > This crazy long line is really hard to follow. > It's not crazier than what is already in alloc_pages_nodemask to share code. > > + return 0; > > + gfp_mask = alloc_mask; > > + > > + /* Find an allowed local zone that meets the high watermark. */ > > + for_each_zone_zonelist_nodemask(zone, z, ac.zonelist, ac.highest_zoneidx, ac.nodemask) { > > Same here. > Similar to what happens in get_page_from_freelist with the for_next_zone_zonelist_nodemask iterator. > > + unsigned long mark; > > + > > + if (cpusets_enabled() && (alloc_flags & ALLOC_CPUSET) && > > + !__cpuset_zone_allowed(zone, gfp_mask)) { > > + continue; > > + } > > No need for the curly braces. > Yes, but it's for coding style. MM has no hard coding style guidelines around this but for sched, it's generally preferred that if the "if" statement spans multiple lines then it should use {} even if the block is one line long for clarity. > > } > > > > - gfp_mask &= gfp_allowed_mask; > > - alloc_mask = gfp_mask; > > Is this change intentional? Yes so that prepare_alloc_pages works for both the single page and bulk allocator. Slightly less code duplication. -- Mel Gorman SUSE Labs