[S390] Add support for memory hot-remove.
authorGerald Schaefer <gerald.schaefer@de.ibm.com>
Fri, 1 Aug 2008 14:39:16 +0000 (16:39 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 1 Aug 2008 14:39:33 +0000 (16:39 +0200)
This patch enables memory hot-remove on s390.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/Kconfig
arch/s390/mm/init.c
drivers/s390/char/sclp_cmd.c

index 2ed88122be9319ea735da3b7b7a6cfd8e6700f67..8d41908e251375ea3c5a96cbd8000a7b4a29df12 100644 (file)
@@ -317,6 +317,9 @@ config ARCH_ENABLE_MEMORY_HOTPLUG
        def_bool y
        depends on SPARSEMEM
 
+config ARCH_ENABLE_MEMORY_HOTREMOVE
+       def_bool y
+
 source "mm/Kconfig"
 
 comment "I/O subsystem configuration"
index 4993b0f594eb86ac0b5604e06112b36de20e492a..1169130a97efdc2661a8e51fcfa9abbb33f4f5cc 100644 (file)
@@ -179,7 +179,7 @@ int arch_add_memory(int nid, u64 start, u64 size)
        int rc;
 
        pgdat = NODE_DATA(nid);
-       zone = pgdat->node_zones + ZONE_NORMAL;
+       zone = pgdat->node_zones + ZONE_MOVABLE;
        rc = vmem_add_mapping(start, size);
        if (rc)
                return rc;
@@ -189,3 +189,14 @@ int arch_add_memory(int nid, u64 start, u64 size)
        return rc;
 }
 #endif /* CONFIG_MEMORY_HOTPLUG */
+
+#ifdef CONFIG_MEMORY_HOTREMOVE
+int remove_memory(u64 start, u64 size)
+{
+       unsigned long start_pfn, end_pfn;
+
+       start_pfn = PFN_DOWN(start);
+       end_pfn = start_pfn + PFN_DOWN(size);
+       return offline_pages(start_pfn, end_pfn, 120 * HZ);
+}
+#endif /* CONFIG_MEMORY_HOTREMOVE */
index 0c2b77493db44ae564033ea20e247330c0951ae2..eb5f1b8bc57fd0546c94067a5b57364f3db1addf 100644 (file)
@@ -427,6 +427,8 @@ static int sclp_mem_notifier(struct notifier_block *nb,
                        sclp_attach_storage(id);
        switch (action) {
        case MEM_ONLINE:
+       case MEM_GOING_OFFLINE:
+       case MEM_CANCEL_OFFLINE:
                break;
        case MEM_GOING_ONLINE:
                rc = sclp_mem_change_state(start, size, 1);
@@ -434,6 +436,9 @@ static int sclp_mem_notifier(struct notifier_block *nb,
        case MEM_CANCEL_ONLINE:
                sclp_mem_change_state(start, size, 0);
                break;
+       case MEM_OFFLINE:
+               sclp_mem_change_state(start, size, 0);
+               break;
        default:
                rc = -EINVAL;
                break;