All of lore.kernel.org
 help / color / mirror / Atom feed
From: keith mannthey <kmannth@us.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
	lhms-devel <lhms-devel@lists.sourceforge.net>,
	"y-goto@jp.fujitsu.com" <y-goto@jp.fujitsu.com>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] memory hotadd fixes [1/5] not-aligned memory hotadd handling fix
Date: Thu, 03 Aug 2006 11:13:48 -0700	[thread overview]
Message-ID: <1154628828.5925.8.camel@keithlap> (raw)
In-Reply-To: <20060803123039.c50feb85.kamezawa.hiroyu@jp.fujitsu.com>

On Thu, 2006-08-03 at 12:30 +0900, KAMEZAWA Hiroyuki wrote:
> After Keith's report of memory hotadd failure, I increased test patterns.
> These patches are a result of new patterns. But I cannot cover all existing
> memory layout in the world, more tests are needed.
> Now, I think my patch can make things better and want this codes to be tested
> in -mm.patche series is consitsts of 5 patches.

I will test and review today.  
 
Thanks,
  Keith 

> ==
> ioresouce handling code in memory hotplug allows not-aligned memory hot add.
> But when memmap and other memory structures are initialized, parameters
> should be aligned. (if not aligned, initialization of mem_map will do wrong,
> it assumes parameters are aligned.) This patch fix it.
> 
> And this patch allows ioresource collision check to handle -EEXIST.
> 
> Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
> 
>  mm/memory_hotplug.c |   23 ++++++++++++++++-------
>  1 files changed, 16 insertions(+), 7 deletions(-)
> 
> Index: linux-2.6.18-rc3/mm/memory_hotplug.c
> ===================================================================
> --- linux-2.6.18-rc3.orig/mm/memory_hotplug.c	2006-08-01 16:11:56.000000000 +0900
> +++ linux-2.6.18-rc3/mm/memory_hotplug.c	2006-08-01 16:38:19.000000000 +0900
> @@ -76,15 +76,22 @@
>  {
>  	unsigned long i;
>  	int err = 0;
> +	int start_sec, end_sec;
> +	/* during initialize mem_map, align hot-added range to section */
> +	start_sec = pfn_to_section_nr(phys_start_pfn);
> +	end_sec = pfn_to_section_nr(phys_start_pfn + nr_pages - 1);
>  
> -	for (i = 0; i < nr_pages; i += PAGES_PER_SECTION) {
> -		err = __add_section(zone, phys_start_pfn + i);
> +	for (i = start_sec; i <= end_sec; i++) {
> +		err = __add_section(zone, i << PFN_SECTION_SHIFT);
>  
> -		/* We want to keep adding the rest of the
> -		 * sections if the first ones already exist
> +		/*
> +		 * EEXIST is finally dealed with by ioresource collision
> +		 * check. see add_memory() => register_memory_resource()
> +		 * Warning will be printed if there is collision.
>  		 */
>  		if (err && (err != -EEXIST))
>  			break;
> +		err = 0;
>  	}
>  
>  	return err;
> @@ -213,10 +220,10 @@
>  }
>  
>  /* add this memory to iomem resource */
> -static void register_memory_resource(u64 start, u64 size)
> +static int register_memory_resource(u64 start, u64 size)
>  {
>  	struct resource *res;
> -
> +	int ret = 0;
>  	res = kzalloc(sizeof(struct resource), GFP_KERNEL);
>  	BUG_ON(!res);
>  
> @@ -228,7 +235,9 @@
>  		printk("System RAM resource %llx - %llx cannot be added\n",
>  		(unsigned long long)res->start, (unsigned long long)res->end);
>  		kfree(res);
> +		ret = -EEXIST;
>  	}
> +	return ret;
>  }
>  
> 
> @@ -269,7 +278,7 @@
>  	}
>  
>  	/* register this memory as resource */
> -	register_memory_resource(start, size);
> +	ret = register_memory_resource(start, size);
>  
>  	return ret;
>  error:



  parent reply	other threads:[~2006-08-03 18:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-03  3:30 [PATCH] memory hotadd fixes [1/5] not-aligned memory hotadd handling fix KAMEZAWA Hiroyuki
2006-08-03  6:38 ` Andrew Morton
2006-08-03  7:03   ` KAMEZAWA Hiroyuki
2006-08-03  7:47   ` Yasunori Goto
2006-08-03 18:29     ` keith mannthey
2006-08-04 11:31     ` [Lhms-devel] " Yasunori Goto
2006-08-03 18:13 ` keith mannthey [this message]
2006-08-04  0:03 ` keith mannthey

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=1154628828.5925.8.camel@keithlap \
    --to=kmannth@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=lhms-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=y-goto@jp.fujitsu.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.