Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964900AbbGVBXF (ORCPT ); Tue, 21 Jul 2015 21:23:05 -0400 Received: from ozlabs.org ([103.22.144.67]:50695 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753106AbbGVBXC (ORCPT ); Tue, 21 Jul 2015 21:23:02 -0400 Message-ID: <1437528180.16792.4.camel@ellerman.id.au> Subject: Re: [PATCH] mm: rename and document alloc_pages_exact_node From: Michael Ellerman To: Vlastimil Babka Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, cbe-oss-dev@lists.ozlabs.org, kvm@vger.kernel.org, Mel Gorman , David Rientjes , Greg Thelen , "Aneesh Kumar K.V" , Christoph Lameter , Pekka Enberg , Joonsoo Kim , Naoya Horiguchi , Tony Luck , Fenghua Yu , Arnd Bergmann , Benjamin Herrenschmidt , Paul Mackerras , Gleb Natapov , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Cliff Whickman , Robin Holt Date: Wed, 22 Jul 2015 11:23:00 +1000 In-Reply-To: <1437486951-19898-1-git-send-email-vbabka@suse.cz> References: <1437486951-19898-1-git-send-email-vbabka@suse.cz> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2448 Lines: 54 On Tue, 2015-07-21 at 15:55 +0200, Vlastimil Babka wrote: > The function alloc_pages_exact_node() was introduced in 6484eb3e2a81 ("page > allocator: do not check NUMA node ID when the caller knows the node is valid") > as an optimized variant of alloc_pages_node(), that doesn't allow the node id > to be -1. Unfortunately the name of the function can easily suggest that the > allocation is restricted to the given node. In truth, the node is only > preferred, unless __GFP_THISNODE is among the gfp flags. > > The misleading name has lead to mistakes in the past, see 5265047ac301 ("mm, > thp: really limit transparent hugepage allocation to local node") and > b360edb43f8e ("mm, mempolicy: migrate_to_node should only migrate to node"). > > To prevent further mistakes, this patch renames the function to > alloc_pages_prefer_node() and documents it together with alloc_pages_node(). > > Signed-off-by: Vlastimil Babka > I'm CC'ing also maintainers of the callsites so they can verify that the > callsites that don't pass __GFP_THISNODE are really not intended to restrict > allocation to the given node. I went through them myself and each looked like > it's better off if it can successfully allocate on a fallback node rather > than fail. DavidR checked them also I think, but it's better if maintainers > can verify that. I'm not completely sure about all the usages in sl*b due to > multiple layers through which gfp flags are being passed. > diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c > index e865d74..646a310 100644 > --- a/arch/powerpc/platforms/cell/ras.c > +++ b/arch/powerpc/platforms/cell/ras.c > @@ -123,7 +123,7 @@ static int __init cbe_ptcal_enable_on_node(int nid, int order) > > area->nid = nid; > area->order = order; > - area->pages = alloc_pages_exact_node(area->nid, > + area->pages = alloc_pages_prefer_node(area->nid, > GFP_KERNEL|__GFP_THISNODE, > area->order); Yeah that looks right to me. This code enables some firmware memory calibration so I think it really does want to get memory on the specified node, or else fail. Acked-by: Michael Ellerman cheers -- 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/