[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1502271905280.22682@chino.kir.corp.google.com>
Date: Fri, 27 Feb 2015 19:21:51 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Christoph Lameter <cl@...ux.com>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Pekka Enberg <penberg@...nel.org>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Johannes Weiner <hannes@...xchg.org>,
Mel Gorman <mgorman@...e.de>,
Pravin Shelar <pshelar@...ira.com>,
Jarno Rajahalme <jrajahalme@...ira.com>,
Li Zefan <lizefan@...wei.com>,
Greg Thelen <gthelen@...gle.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, netdev@...r.kernel.org,
cgroups@...r.kernel.org, dev@...nvswitch.org
Subject: Re: [patch v2 1/3] mm: remove GFP_THISNODE
On Fri, 27 Feb 2015, Christoph Lameter wrote:
> > +/*
> > + * Construct gfp mask to allocate from a specific node but do not invoke reclaim
> > + * or warn about failures.
> > + */
>
> We should be triggering reclaim from slab allocations. Why would we not do
> this?
>
> Otherwise we will be going uselessly off node for slab allocations.
>
> > +static inline gfp_t gfp_exact_node(gfp_t flags)
> > +{
> > + return (flags | __GFP_THISNODE | __GFP_NOWARN) & ~__GFP_WAIT;
> > +}
> > #endif
>
> Reclaim needs to be triggered. In particular zone reclaim was made to be
> triggered from slab allocations to create more room if needed.
>
This illustrates the precise need for a patch like this that removes
GFP_THISNODE entirely: notice there's no functional change with this
patch.
GFP_THISNODE is __GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY.
The calls to ____cache_alloc_node() and cache_grow() modified by this
patch in mm/slab.c that pass GFP_THISNODE get caught in the page allocator
slowpath by this:
if (IS_ENABLED(CONFIG_NUMA) &&
(gfp_mask & GFP_THISNODE) == GFP_THISNODE)
goto nopage;
with today's kernel. In fact, there is no way for the slab allocator to
currently allocate exactly on one node, allow reclaim, and avoid looping
forever while suppressing the page allocation failure warning. The reason
is because of how GFP_THISNODE is defined above.
With this patch, it would be possible to modify gfp_exact_node() so that
instead of doing
return (flags | __GFP_THISNODE | __GFP_NOWARN) & ~__GFP_WAIT;
which has no functional change from today, it could be
return flags | __GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY;
so that we _can_ do reclaim for that node and avoid looping forever when
the allocation fails. These three flags are the exact same bits set in
today's GFP_THISNODE and it is, I agree, what the slab allocator really
wants to do in cache_grow(). But the conditional above is what
short-circuits such an allocation and needs to be removed, which is what
this patch does.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists