linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: Minchan Kim <minchan.kim@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Bob Liu <lliubbo@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Tejun Heo <tj@kernel.org>,
	Christoph Lameter <cl@linux-foundation.org>
Subject: Re: [PATCH 2/6] change alloc function in pcpu_alloc_pages
Date: Tue, 13 Apr 2010 16:48:20 +0100	[thread overview]
Message-ID: <20100413154820.GC25756@csn.ul.ie> (raw)
In-Reply-To: <d5d70d4b57376bc89f178834cf0e424eaa681ab4.1271171877.git.minchan.kim@gmail.com>

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 <tj@kernel.org>
> Cc: Christoph Lameter <cl@linux-foundation.org>
> Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
> ---
>  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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-04-13 15:48 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13 15:24 [PATCH 1/6] Remove node's validity check in alloc_pages Minchan Kim
2010-04-13 15:24 ` [PATCH 2/6] change alloc function in pcpu_alloc_pages Minchan Kim
2010-04-13 15:48   ` Mel Gorman [this message]
2010-04-14 23:39     ` Tejun Heo
2010-04-15  1:31       ` Minchan Kim
2010-04-15  7:21         ` Tejun Heo
2010-04-15  8:00           ` Minchan Kim
2010-04-15  8:15             ` Tejun Heo
2010-04-15  9:40               ` Minchan Kim
2010-04-15 10:08                 ` Tejun Heo
2010-04-15 10:21                   ` Minchan Kim
2010-04-15 10:33                     ` Minchan Kim
2010-04-15 11:43                     ` Tejun Heo
2010-04-15 11:49                       ` Minchan Kim
2010-04-16 16:07                         ` Christoph Lameter
2010-04-16 19:13                           ` Lee Schermerhorn
2010-04-18 15:55                             ` Minchan Kim
2010-04-18 15:54                           ` Minchan Kim
2010-04-18 21:22                             ` Tejun Heo
2010-04-19  0:03                               ` Minchan Kim
2010-04-19 17:45                                 ` Christoph Lameter
2010-04-20  0:20                                   ` Minchan Kim
2010-04-19 17:38                             ` Christoph Lameter
2010-04-19 22:27                               ` Tejun Heo
2010-04-20 15:05                                 ` Mel Gorman
2010-04-21 10:48                                   ` Tejun Heo
2010-04-22 10:15                                     ` Minchan Kim
2010-04-21 14:15                                   ` Christoph Lameter
2010-04-21 17:06                                     ` Minchan Kim
2010-04-13 15:25 ` [PATCH 3/6] change alloc function in alloc_slab_page Minchan Kim
2010-04-13 15:52   ` Mel Gorman
2010-04-13 16:01     ` Minchan Kim
2010-04-13 16:14       ` Mel Gorman
2010-04-13 21:37   ` David Rientjes
2010-04-13 23:40     ` Minchan Kim
2010-04-13 23:55       ` David Rientjes
2010-04-14  0:02         ` Minchan Kim
2010-04-14  0:18   ` KAMEZAWA Hiroyuki
2010-04-14 12:23     ` Pekka Enberg
2010-04-16 16:10       ` Christoph Lameter
2010-04-18 18:49         ` Pekka Enberg
2010-04-19  9:05         ` Mel Gorman
2010-04-13 15:25 ` [PATCH 4/6] change alloc function in vmemmap_alloc_block Minchan Kim
2010-04-13 15:59   ` Mel Gorman
2010-04-14  0:19   ` KAMEZAWA Hiroyuki
2010-04-13 15:25 ` [PATCH 5/6] change alloc function in __vmalloc_area_node Minchan Kim
2010-04-13 16:02   ` Mel Gorman
2010-04-14  0:22   ` KAMEZAWA Hiroyuki
2010-04-14  0:33     ` Minchan Kim
2010-04-13 15:25 ` [PATCH 6/6] Add comment in alloc_pages_exact_node Minchan Kim
2010-04-13 16:13   ` Mel Gorman
2010-04-13 16:20     ` Minchan Kim
2010-04-13 15:32 ` [PATCH 1/6] Remove node's validity check in alloc_pages Mel Gorman
2010-04-14  0:04 ` KAMEZAWA Hiroyuki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100413154820.GC25756@csn.ul.ie \
    --to=mel@csn.ul.ie \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lliubbo@gmail.com \
    --cc=minchan.kim@gmail.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).