Skip to content

Commit

Permalink
sh: memory hot-add for sparsemem users support.
Browse files Browse the repository at this point in the history
This enables simple hotplug support for sparsemem users. Presently
this only permits memory being added in to node 0 on ZONE_NORMAL.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
pmundt authored and Paul Mundt committed Jun 8, 2007
1 parent 05a1178 commit 33d63bd
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
8 changes: 8 additions & 0 deletions arch/sh/mm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,14 @@ config ARCH_POPULATES_NODE_MAP
config ARCH_SELECT_MEMORY_MODEL
def_bool y

config ARCH_ENABLE_MEMORY_HOTPLUG
def_bool y
depends on SPARSEMEM

config ARCH_MEMORY_PROBE
def_bool y
depends on MEMORY_HOTPLUG

choice
prompt "Kernel page size"
default PAGE_SIZE_4KB
Expand Down
42 changes: 42 additions & 0 deletions arch/sh/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,45 @@ void free_initrd_mem(unsigned long start, unsigned long end)
printk("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
}
#endif

#ifdef CONFIG_MEMORY_HOTPLUG
void online_page(struct page *page)
{
ClearPageReserved(page);
init_page_count(page);
__free_page(page);
totalram_pages++;
num_physpages++;
}

int arch_add_memory(int nid, u64 start, u64 size)
{
pg_data_t *pgdat;
unsigned long start_pfn = start >> PAGE_SHIFT;
unsigned long nr_pages = size >> PAGE_SHIFT;
int ret;

pgdat = NODE_DATA(nid);

/* We only have ZONE_NORMAL, so this is easy.. */
ret = __add_pages(pgdat->node_zones + ZONE_NORMAL, start_pfn, nr_pages);
if (unlikely(ret))
printk("%s: Failed, __add_pages() == %d\n", __FUNCTION__, ret);

return ret;
}
EXPORT_SYMBOL_GPL(arch_add_memory);

int remove_memory(u64 start, u64 size)
{
return -EINVAL;
}
EXPORT_SYMBOL_GPL(remove_memory);

int memory_add_physaddr_to_nid(u64 addr)
{
/* Node 0 for now.. */
return 0;
}
EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
#endif
2 changes: 1 addition & 1 deletion mm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ config MEMORY_HOTPLUG
bool "Allow for memory hot-add"
depends on SPARSEMEM || X86_64_ACPI_NUMA
depends on HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG
depends on (IA64 || X86 || PPC64)
depends on (IA64 || X86 || PPC64 || SUPERH)

comment "Memory hotplug is currently incompatible with Software Suspend"
depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND
Expand Down

0 comments on commit 33d63bd

Please sign in to comment.