Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617AbbB1DV4 (ORCPT ); Fri, 27 Feb 2015 22:21:56 -0500 Received: from mail-ie0-f177.google.com ([209.85.223.177]:46736 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752478AbbB1DVy (ORCPT ); Fri, 27 Feb 2015 22:21:54 -0500 Date: Fri, 27 Feb 2015 19:21:51 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Christoph Lameter cc: Andrew Morton , Vlastimil Babka , Pekka Enberg , Joonsoo Kim , Johannes Weiner , Mel Gorman , Pravin Shelar , Jarno Rajahalme , Li Zefan , Greg Thelen , linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, cgroups@vger.kernel.org, dev@openvswitch.org Subject: Re: [patch v2 1/3] mm: remove GFP_THISNODE In-Reply-To: Message-ID: References: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2286 Lines: 62 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/