From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-bk0-x229.google.com (mail-bk0-x229.google.com [IPv6:2a00:1450:4008:c01::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id BEDA32C0097 for ; Sat, 25 Jan 2014 10:49:46 +1100 (EST) Received: by mail-bk0-f41.google.com with SMTP id na10so1599509bkb.14 for ; Fri, 24 Jan 2014 15:49:39 -0800 (PST) Date: Fri, 24 Jan 2014 15:49:33 -0800 (PST) From: David Rientjes To: Nishanth Aravamudan Subject: Re: [PATCH] slub: Don't throw away partial remote slabs if there is no local memory In-Reply-To: <20140124232902.GB30361@linux.vnet.ibm.com> Message-ID: References: <20140107132100.5b5ad198@kryten> <20140107074136.GA4011@lge.com> <52dce7fe.e5e6420a.5ff6.ffff84a0SMTPIN_ADDED_BROKEN@mx.google.com> <52e1d960.2715420a.3569.1013SMTPIN_ADDED_BROKEN@mx.google.com> <52e1da8f.86f7440a.120f.25f3SMTPIN_ADDED_BROKEN@mx.google.com> <20140124232902.GB30361@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Han Pingtian , penberg@kernel.org, linux-mm@kvack.org, paulus@samba.org, Anton Blanchard , mpm@selenic.com, Christoph Lameter , linuxppc-dev@lists.ozlabs.org, Joonsoo Kim , Wanpeng Li List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, 24 Jan 2014, Nishanth Aravamudan wrote: > > I think the problem is a memoryless node being used for kmalloc_node() so > > we need to decide where to enforce node_present_pages(). __slab_alloc() > > seems like the best candidate when !node_match(). > > Actually, this is effectively what Anton's patch does, except with > Wanpeng's adjustment to use node_present_pages(). Does that seem > sufficient to you? > I don't see that as being the effect of Anton's patch. We need to use numa_mem_id() as Christoph mentioned when a memoryless node is passed for the best NUMA locality. Something like this: diff --git a/mm/slub.c b/mm/slub.c --- a/mm/slub.c +++ b/mm/slub.c @@ -2278,10 +2278,14 @@ redo: if (unlikely(!node_match(page, node))) { stat(s, ALLOC_NODE_MISMATCH); - deactivate_slab(s, page, c->freelist); - c->page = NULL; - c->freelist = NULL; - goto new_slab; + if (unlikely(!node_present_pages(node))) + node = numa_mem_id(); + if (!node_match(page, node)) { + deactivate_slab(s, page, c->freelist); + c->page = NULL; + c->freelist = NULL; + goto new_slab; + } } /* > It does only cover the memoryless node case (not the exhausted node > case), but I think that shouldn't block the fix (and it does fix the > issue we've run across in our testing). > kmalloc_node(nid) and kmem_cache_alloc_node(nid) should fallback to nodes other than nid when memory can't be allocated, these functions only indicate a preference.