Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753279Ab0DMPsl (ORCPT ); Tue, 13 Apr 2010 11:48:41 -0400 Received: from gir.skynet.ie ([193.1.99.77]:47452 "EHLO gir.skynet.ie" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752708Ab0DMPsk (ORCPT ); Tue, 13 Apr 2010 11:48:40 -0400 Date: Tue, 13 Apr 2010 16:48:20 +0100 From: Mel Gorman To: Minchan Kim Cc: Andrew Morton , KAMEZAWA Hiroyuki , Bob Liu , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Tejun Heo , Christoph Lameter Subject: Re: [PATCH 2/6] change alloc function in pcpu_alloc_pages Message-ID: <20100413154820.GC25756@csn.ul.ie> References: <9918f566ab0259356cded31fd1dd80da6cae0c2b.1271171877.git.minchan.kim@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2124 Lines: 57 On Wed, Apr 14, 2010 at 12:24:59AM +0900, Minchan Kim wrote: > alloc_pages_node is called with cpu_to_node(cpu). > I think cpu_to_node(cpu) never returns -1. > (But I am not sure we need double check.) > > So we can use alloc_pages_exact_node instead of alloc_pages_node. > It could avoid comparison and branch as 6484eb3e2a81807722 tried. > Well, numa_node_id() is implemented as #ifndef numa_node_id #define numa_node_id() (cpu_to_node(raw_smp_processor_id())) #endif and the mapping table on x86 at least is based on possible CPUs in init_cpu_to_node() leaves the mapping as 0 if the APIC is bad or the numa node is reported in apicid_to_node as -1. It would appear on power that the node will be 0 for possible CPUs as well. Hence, I believe this to be safe but a confirmation from Tejun would be nice. I would continue digging but this looks like an initialisation path so I'll move on to the next patch rather than spending more time. > Cc: Tejun Heo > Cc: Christoph Lameter > Signed-off-by: Minchan Kim > --- > mm/percpu.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/mm/percpu.c b/mm/percpu.c > index 768419d..ec3e671 100644 > --- a/mm/percpu.c > +++ b/mm/percpu.c > @@ -720,7 +720,7 @@ static int pcpu_alloc_pages(struct pcpu_chunk *chunk, > for (i = page_start; i < page_end; i++) { > struct page **pagep = &pages[pcpu_page_idx(cpu, i)]; > > - *pagep = alloc_pages_node(cpu_to_node(cpu), gfp, 0); > + *pagep = alloc_pages_exact_node(cpu_to_node(cpu), gfp, 0); > if (!*pagep) { > pcpu_free_pages(chunk, pages, populated, > page_start, page_end); > -- > 1.7.0.5 > -- Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab -- 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/