Skip to content

Commit

Permalink
memory hotplug: sysfs probe routine should add all memory sections
Browse files Browse the repository at this point in the history
As a follow-on to the recent patches I submitted that allowed for a sysfs
memory block to span multiple memory sections, we should also update the
probe routine to online all of the memory sections in a memory block.  Without
this patch the current code will only add a single memory section.  I think
the probe routine should add all of the memory sections in the specified memory
block so that its behavior is in line with memory hotplug actions through
the sysfs interfaces.

This patch applies on top of the previous sysfs memory updates to allow
a sysfs directory o span multiple memory sections.

https://lkml.org/lkml/2011/1/20/245

Signed-off-by: Nathan Fontenot <nfont@austin.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Nathan Fontenot authored and Greg Kroah-Hartman committed Feb 4, 2011
1 parent 1dc41aa commit 6add7cd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions drivers/base/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,12 +387,19 @@ memory_probe_store(struct class *class, struct class_attribute *attr,
{
u64 phys_addr;
int nid;
int ret;
int i, ret;

phys_addr = simple_strtoull(buf, NULL, 0);

nid = memory_add_physaddr_to_nid(phys_addr);
ret = add_memory(nid, phys_addr, PAGES_PER_SECTION << PAGE_SHIFT);
for (i = 0; i < sections_per_block; i++) {
nid = memory_add_physaddr_to_nid(phys_addr);
ret = add_memory(nid, phys_addr,
PAGES_PER_SECTION << PAGE_SHIFT);
if (ret)
break;

phys_addr += MIN_MEMORY_BLOCK_SIZE;
}

if (ret)
count = ret;
Expand Down

0 comments on commit 6add7cd

Please sign in to comment.