mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yasunori Goto <y-goto@jp.fujitsu.com>
To: David Rientjes <rientjes@cs.washington.edu>
Cc: Andrew Morton <akpm@osdl.org>,
	Linux Kernel ML <linux-kernel@vger.kernel.org>,
	Randy Dunlap <randy.dunlap@oracle.com>
Subject: Re: [Patch](memory hotplug) Fix compile error for i386 with NUMA config
Date: Mon, 11 Dec 2006 13:48:00 +0900	[thread overview]
Message-ID: <20061211115829.AD68.Y-GOTO@jp.fujitsu.com> (raw)
In-Reply-To: <Pine.LNX.4.64N.0612090318510.11325@attu4.cs.washington.edu>

Hi David-san.

> On Sat, 9 Dec 2006, Yasunori Goto wrote:
> 
> > Hello.
> > 
> > This patch is to fix compile error when config memory hotplug
> > with numa on i386.
> > 
> > The cause of compile error was missing of arch_add_memory(), remove_memory(),
> > and memory_add_physaddr_to_nid() when NUMA config is on.
> > 
> > This is for 2.6.19, and I tested no compile error of it.
> > 
> > Please apply.
> > 
> > Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>
> > 
> > ---
> >  arch/i386/mm/discontig.c |   17 +++++++++++++++++
> >  arch/i386/mm/init.c      |    4 +---
> >  2 files changed, 18 insertions(+), 3 deletions(-)
> > 
> > Index: linux-2.6.19/arch/i386/mm/init.c
> > ===================================================================
> > --- linux-2.6.19.orig/arch/i386/mm/init.c	2006-12-04 20:06:32.000000000 +0900
> > +++ linux-2.6.19/arch/i386/mm/init.c	2006-12-04 21:09:49.000000000 +0900
> > @@ -681,10 +681,9 @@
> >   * memory to the highmem for now.
> >   */
> >  #ifdef CONFIG_MEMORY_HOTPLUG
> > -#ifndef CONFIG_NEED_MULTIPLE_NODES
> >  int arch_add_memory(int nid, u64 start, u64 size)
> >  {
> > -	struct pglist_data *pgdata = &contig_page_data;
> > +	struct pglist_data *pgdata = NODE_DATA(nid);
> >  	struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM;
> >  	unsigned long start_pfn = start >> PAGE_SHIFT;
> >  	unsigned long nr_pages = size >> PAGE_SHIFT;
> > @@ -697,7 +696,6 @@
> >  	return -EINVAL;
> >  }
> >  #endif
> > -#endif
> >  
> >  kmem_cache_t *pgd_cache;
> >  kmem_cache_t *pmd_cache;
> 
> The reason for the #ifndef CONFIG_NEED_MULTIPLE_NODES check seems to 
> solely exist for excluding the NUMA case, so it doesn't appear as though 
> this is the correct fix since your changelog indicates a compile problem 
> with a NUMA build.  This hypothesis is supported by the comment which 
> conveniently appears just before arch_add_memory which _explicitly_ states 
> that the following is for non-NUMA cases.

No.
Other arch's arch_add_memory() and remove_memory() have been already
used for NUMA case too. But i386 didn't do it because just 
contig_page_data is used. 
Current NODE_DATA() macro is defined both case appropriately.
So, this #ifdef is redundant now.

(See: http://marc.theaimsgroup.com/?l=linux-mm&m=116494983531221&w=2)

> 
> > Index: linux-2.6.19/arch/i386/mm/discontig.c
> > ===================================================================
> > --- linux-2.6.19.orig/arch/i386/mm/discontig.c	2006-12-04 20:06:32.000000000 +0900
> > +++ linux-2.6.19/arch/i386/mm/discontig.c	2006-12-09 17:30:24.000000000 +0900
> > @@ -405,3 +405,20 @@
> >  	totalram_pages += totalhigh_pages;
> >  #endif
> >  }
> > +
> > +#ifdef CONFIG_MEMORY_HOTPLUG
> > +/* This is the case that there is no _PXM on DSDT for added memory */
> > +int memory_add_physaddr_to_nid(u64 addr)
> > +{
> > +	int nid;
> > +	unsigned long pfn = addr >> PAGE_SHIFT;
> > +
> > +	for (nid = 0; nid < MAX_NUMNODES; nid++){
> > +		if (node_start_pfn[nid] <= pfn &&
> > +		    pfn < node_end_pfn[nid])
> > +			return nid;
> > +	}
> > +
> > +	return 0;
> > +}
> > +#endif
> > 
> 
> memory_add_physaddr_to_nid is only declared as extern in 
> include/linux/memory_hotplug.h in the CONFIG_NUMA case so this also 
> doesn't appear as the correct fix but probably worked for your compile 
> since you had CONFIG_MEMORY_HOTPLUG enabled.

memory_add_physaddr_to_nid() is used for memory hotplug to 
find node id for new memory when ACPI's DSDT doesn't define
_PXM for new memory. So, when CONFIG_MEMORY_HOTPLUG is not set,
this function is not used.

Bye.

-- 
Yasunori Goto 



  reply	other threads:[~2006-12-11  4:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-09  9:39 Yasunori Goto
2006-12-09 11:23 ` David Rientjes
2006-12-11  4:48   ` Yasunori Goto [this message]
2006-12-11  7:52     ` David Rientjes
2006-12-11  8:20       ` Yasunori Goto

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=20061211115829.AD68.Y-GOTO@jp.fujitsu.com \
    --to=y-goto@jp.fujitsu.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    --cc=rientjes@cs.washington.edu \
    /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

all inboxes | Powered by JetHome®