linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
To: minskey guo <chaohong_guo@linux.intel.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, prarit@redhat.com, andi.kleen@intel.com,
	linux-kernel@vger.kernel.org,
	minskey guo <chaohong.guo@intel.com>, Tejun Heo <tj@kernel.org>,
	stable@kernel.org
Subject: Re: [PATCH] online CPU before memory failed in pcpu_alloc_pages()
Date: Fri, 21 May 2010 09:21:47 -0400	[thread overview]
Message-ID: <1274448107.9131.87.camel@useless.americas.hpqcorp.net> (raw)
In-Reply-To: <4BF64E79.4010401@linux.intel.com>

On Fri, 2010-05-21 at 17:12 +0800, minskey guo wrote:
> On 05/21/2010 04:39 PM, KAMEZAWA Hiroyuki wrote:
> > On Fri, 21 May 2010 16:22:19 +0800
> > minskey guo<chaohong_guo@linux.intel.com>  wrote:
> >
> >> Yes.  I can use cpu_to_mem().  only some little difference during
> >> CPU online:  1st cpu within memoryless node gets memory from current
> >> node or the node to which the cpu0 belongs,
> >>
> >>
> >> But I have a question about the patch:
> >>
> >>      numa-slab-use-numa_mem_id-for-slab-local-memory-node.patch,
> >>
> >>
> >>
> >>
> >> @@ -2968,9 +2991,23 @@ static int __build_all_zonelists(void *d
> >> ...
> >>
> >> -	for_each_possible_cpu(cpu)
> >> +	for_each_possible_cpu(cpu) {
> >> 		setup_pageset(&per_cpu(boot_pageset, cpu), 0);
> >> ...
> >>
> >> +#ifdef CONFIG_HAVE_MEMORYLESS_NODES
> >> + 	if (cpu_online(cpu))
> >> +		cpu_to_mem(cpu) = local_memory_node(cpu_to_node(cpu));
> >> +#endif
> 
> Look at the above code,  int __build_all_zonelists(),  cpu_to_mem(cpu)
> is set only when cpu is onlined.  Suppose that a node with local memory,
> all memory segments are onlined first, and then,  cpus within that node
> are onlined one by one,  in this case,  where does the cpu_to_mem(cpu)
> for the last cpu get its value ?

Minskey:

As I mentioned to Kame-san, x86 does not define
CONFIG_HAVE_MEMORYLESS_NODES, so this code is not compiled for that
arch.  If x86 did support memoryless nodes--i.e., did not hide them and
reassign the cpus to other nodes, as is the case for ia64--then we could
have on-line cpus associated with memoryless nodes.  The code above is
in __build_all_zonelists() so that in the case where we add memory to a
previously memoryless node, we re-evaluate the "local memory node" for
all online cpus.

For cpu hotplug--again, if x86 supports memoryless nodes--we'll need to
add a similar chunk to the path where we set up the cpu_to_node map for
a hotplugged cpu.  See, for example, the call to set_numa_mem() in
smp_callin() in arch/ia64/kernel/smpboot.c.  But currently, I don't
think you can use the numa_mem_id()/cpu_to_mem() interfaces for your
purpose.  I suppose you could change page_alloc.c to compile
local_memory_node() #if defined(CONFIG_HAVE_MEMORYLESS_NODES) || defined
(CPU_HOTPLUG) and use that function to find the nearest memory.  It
should return a valid node after zonelists have been rebuilt.

Does that make sense?

Lee
> 
> 
> >
> > So, cpu_to_node(cpu) for possible cpus will have NUMA_NO_NODE(-1)
> > or the number of the nearest node.
> >
> > IIUC, if SRAT is not broken, all pxm has its own node_id.
> 
> Thank you very much for the info,  I have been thinking why node_id
> is (-1) in some cases.
> 
> 
> -minskey
> 
> --
> 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>

--
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-05-21 13:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18  6:17 minskey guo
2010-05-20 20:43 ` Andrew Morton
2010-05-21  0:55   ` Stephen Rothwell
2010-05-21  4:44     ` KAMEZAWA Hiroyuki
2010-05-21  8:22       ` minskey guo
2010-05-21  8:39         ` KAMEZAWA Hiroyuki
2010-05-21  9:12           ` minskey guo
2010-05-21 13:21             ` Lee Schermerhorn [this message]
2010-05-24  1:03               ` Guo, Chaohong
2010-05-24 14:59                 ` Lee Schermerhorn
2010-05-25  1:35                   ` Guo, Chaohong
2010-05-21 12:32       ` Lee Schermerhorn
2010-05-21  4:05   ` Guo, Chaohong
2010-05-21  7:29   ` Kleen, Andi

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=1274448107.9131.87.camel@useless.americas.hpqcorp.net \
    --to=lee.schermerhorn@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi.kleen@intel.com \
    --cc=chaohong.guo@intel.com \
    --cc=chaohong_guo@linux.intel.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=prarit@redhat.com \
    --cc=sfr@canb.auug.org.au \
    --cc=stable@kernel.org \
    --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