s390/mm: make arch_add_memory() NUMA aware
With NUMA support for s390, arch_add_memory() needs to respect the nid parameter. Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
ecf46abdd3
commit
199071f108
@ -27,6 +27,7 @@
|
|||||||
#include <linux/initrd.h>
|
#include <linux/initrd.h>
|
||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
#include <linux/gfp.h>
|
#include <linux/gfp.h>
|
||||||
|
#include <linux/memblock.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
||||||
@ -170,37 +171,36 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
|
|||||||
#ifdef CONFIG_MEMORY_HOTPLUG
|
#ifdef CONFIG_MEMORY_HOTPLUG
|
||||||
int arch_add_memory(int nid, u64 start, u64 size)
|
int arch_add_memory(int nid, u64 start, u64 size)
|
||||||
{
|
{
|
||||||
unsigned long zone_start_pfn, zone_end_pfn, nr_pages;
|
unsigned long normal_end_pfn = PFN_DOWN(memblock_end_of_DRAM());
|
||||||
|
unsigned long dma_end_pfn = PFN_DOWN(MAX_DMA_ADDRESS);
|
||||||
unsigned long start_pfn = PFN_DOWN(start);
|
unsigned long start_pfn = PFN_DOWN(start);
|
||||||
unsigned long size_pages = PFN_DOWN(size);
|
unsigned long size_pages = PFN_DOWN(size);
|
||||||
struct zone *zone;
|
unsigned long nr_pages;
|
||||||
int rc;
|
int rc, zone_enum;
|
||||||
|
|
||||||
rc = vmem_add_mapping(start, size);
|
rc = vmem_add_mapping(start, size);
|
||||||
if (rc)
|
if (rc)
|
||||||
return rc;
|
return rc;
|
||||||
for_each_zone(zone) {
|
|
||||||
if (zone_idx(zone) != ZONE_MOVABLE) {
|
while (size_pages > 0) {
|
||||||
/* Add range within existing zone limits */
|
if (start_pfn < dma_end_pfn) {
|
||||||
zone_start_pfn = zone->zone_start_pfn;
|
nr_pages = (start_pfn + size_pages > dma_end_pfn) ?
|
||||||
zone_end_pfn = zone->zone_start_pfn +
|
dma_end_pfn - start_pfn : size_pages;
|
||||||
zone->spanned_pages;
|
zone_enum = ZONE_DMA;
|
||||||
|
} else if (start_pfn < normal_end_pfn) {
|
||||||
|
nr_pages = (start_pfn + size_pages > normal_end_pfn) ?
|
||||||
|
normal_end_pfn - start_pfn : size_pages;
|
||||||
|
zone_enum = ZONE_NORMAL;
|
||||||
} else {
|
} else {
|
||||||
/* Add remaining range to ZONE_MOVABLE */
|
nr_pages = size_pages;
|
||||||
zone_start_pfn = start_pfn;
|
zone_enum = ZONE_MOVABLE;
|
||||||
zone_end_pfn = start_pfn + size_pages;
|
|
||||||
}
|
}
|
||||||
if (start_pfn < zone_start_pfn || start_pfn >= zone_end_pfn)
|
rc = __add_pages(nid, NODE_DATA(nid)->node_zones + zone_enum,
|
||||||
continue;
|
start_pfn, size_pages);
|
||||||
nr_pages = (start_pfn + size_pages > zone_end_pfn) ?
|
|
||||||
zone_end_pfn - start_pfn : size_pages;
|
|
||||||
rc = __add_pages(nid, zone, start_pfn, nr_pages);
|
|
||||||
if (rc)
|
if (rc)
|
||||||
break;
|
break;
|
||||||
start_pfn += nr_pages;
|
start_pfn += nr_pages;
|
||||||
size_pages -= nr_pages;
|
size_pages -= nr_pages;
|
||||||
if (!size_pages)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (rc)
|
if (rc)
|
||||||
vmem_remove_mapping(start, size);
|
vmem_remove_mapping(start, size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user