[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210309181006.GP3697@techsingularity.net>
Date: Tue, 9 Mar 2021 18:10:06 +0000
From: Mel Gorman <mgorman@...hsingularity.net>
To: Christoph Hellwig <hch@...radead.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Chuck Lever <chuck.lever@...cle.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Linux-Net <netdev@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>,
Linux-NFS <linux-nfs@...r.kernel.org>
Subject: Re: [PATCH 2/5] mm/page_alloc: Add a bulk page allocator
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
Powered by blists - more mailing lists