Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/memory_hotplug: remove CONFIG_MEMORY_HOTPLUG_SPARSE

CONFIG_MEMORY_HOTPLUG depends on CONFIG_SPARSEMEM, so there is no need for
CONFIG_MEMORY_HOTPLUG_SPARSE anymore; adjust all instances to use
CONFIG_MEMORY_HOTPLUG and remove CONFIG_MEMORY_HOTPLUG_SPARSE.

Link: https://lkml.kernel.org/r/20210929143600.49379-3-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org> [kselftest]
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Oscar Salvador <osalvador@suse.de>
Cc: Alex Shi <alexs@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

David Hildenbrand and committed by
Linus Torvalds
50f9481e 71b6f2dd

+24 -36
+1 -1
arch/powerpc/include/asm/machdep.h
··· 32 32 void (*iommu_save)(void); 33 33 void (*iommu_restore)(void); 34 34 #endif 35 - #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE 35 + #ifdef CONFIG_MEMORY_HOTPLUG 36 36 unsigned long (*memory_block_size)(void); 37 37 #endif 38 38 #endif /* CONFIG_PPC64 */
+1 -1
arch/powerpc/kernel/setup_64.c
··· 912 912 } 913 913 #endif 914 914 915 - #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE 915 + #ifdef CONFIG_MEMORY_HOTPLUG 916 916 unsigned long memory_block_size_bytes(void) 917 917 { 918 918 if (ppc_md.memory_block_size)
+2 -2
arch/powerpc/platforms/powernv/setup.c
··· 440 440 } 441 441 #endif /* CONFIG_KEXEC_CORE */ 442 442 443 - #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE 443 + #ifdef CONFIG_MEMORY_HOTPLUG 444 444 static unsigned long pnv_memory_block_size(void) 445 445 { 446 446 /* ··· 553 553 #ifdef CONFIG_KEXEC_CORE 554 554 .kexec_cpu_down = pnv_kexec_cpu_down, 555 555 #endif 556 - #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE 556 + #ifdef CONFIG_MEMORY_HOTPLUG 557 557 .memory_block_size = pnv_memory_block_size, 558 558 #endif 559 559 };
+1 -1
arch/powerpc/platforms/pseries/setup.c
··· 1089 1089 .machine_kexec = pSeries_machine_kexec, 1090 1090 .kexec_cpu_down = pseries_kexec_cpu_down, 1091 1091 #endif 1092 - #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE 1092 + #ifdef CONFIG_MEMORY_HOTPLUG 1093 1093 .memory_block_size = pseries_memory_block_size, 1094 1094 #endif 1095 1095 };
+1 -1
drivers/base/Makefile
··· 13 13 obj-$(CONFIG_ISA_BUS_API) += isa.o 14 14 obj-y += firmware_loader/ 15 15 obj-$(CONFIG_NUMA) += node.o 16 - obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o 16 + obj-$(CONFIG_MEMORY_HOTPLUG) += memory.o 17 17 ifeq ($(CONFIG_SYSFS),y) 18 18 obj-$(CONFIG_MODULES) += module.o 19 19 endif
+4 -5
drivers/base/node.c
··· 629 629 { 630 630 struct node *node = to_node(dev); 631 631 632 - #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) 632 + #if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_HUGETLBFS) 633 633 /* 634 634 * We schedule the work only when a memory section is 635 635 * onlined/offlined on this node. When we come here, ··· 782 782 return 0; 783 783 } 784 784 785 - #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE 785 + #ifdef CONFIG_MEMORY_HOTPLUG 786 786 static int __ref get_nid_for_pfn(unsigned long pfn) 787 787 { 788 788 #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT ··· 958 958 return NOTIFY_OK; 959 959 } 960 960 #endif /* CONFIG_HUGETLBFS */ 961 - #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 961 + #endif /* CONFIG_MEMORY_HOTPLUG */ 962 962 963 - #if !defined(CONFIG_MEMORY_HOTPLUG_SPARSE) || \ 964 - !defined(CONFIG_HUGETLBFS) 963 + #if !defined(CONFIG_MEMORY_HOTPLUG) || !defined(CONFIG_HUGETLBFS) 965 964 static inline int node_memory_callback(struct notifier_block *self, 966 965 unsigned long action, void *arg) 967 966 {
+1 -1
drivers/virtio/Kconfig
··· 98 98 default m 99 99 depends on X86_64 100 100 depends on VIRTIO 101 - depends on MEMORY_HOTPLUG_SPARSE 101 + depends on MEMORY_HOTPLUG 102 102 depends on MEMORY_HOTREMOVE 103 103 depends on CONTIG_ALLOC 104 104 help
+10 -14
include/linux/memory.h
··· 110 110 #define SLAB_CALLBACK_PRI 1 111 111 #define IPC_CALLBACK_PRI 10 112 112 113 - #ifndef CONFIG_MEMORY_HOTPLUG_SPARSE 113 + #ifndef CONFIG_MEMORY_HOTPLUG 114 114 static inline void memory_dev_init(void) 115 115 { 116 116 return; ··· 126 126 { 127 127 return 0; 128 128 } 129 - #else 129 + static inline int hotplug_memory_notifier(notifier_fn_t fn, int pri) 130 + { 131 + return 0; 132 + } 133 + /* These aren't inline functions due to a GCC bug. */ 134 + #define register_hotmemory_notifier(nb) ({ (void)(nb); 0; }) 135 + #define unregister_hotmemory_notifier(nb) ({ (void)(nb); }) 136 + #else /* CONFIG_MEMORY_HOTPLUG */ 130 137 extern int register_memory_notifier(struct notifier_block *nb); 131 138 extern void unregister_memory_notifier(struct notifier_block *nb); 132 139 int create_memory_block_devices(unsigned long start, unsigned long size, ··· 155 148 typedef int (*walk_memory_groups_func_t)(struct memory_group *, void *); 156 149 int walk_dynamic_memory_groups(int nid, walk_memory_groups_func_t func, 157 150 struct memory_group *excluded, void *arg); 158 - #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 159 - 160 - #ifdef CONFIG_MEMORY_HOTPLUG 161 151 #define hotplug_memory_notifier(fn, pri) ({ \ 162 152 static __meminitdata struct notifier_block fn##_mem_nb =\ 163 153 { .notifier_call = fn, .priority = pri };\ ··· 162 158 }) 163 159 #define register_hotmemory_notifier(nb) register_memory_notifier(nb) 164 160 #define unregister_hotmemory_notifier(nb) unregister_memory_notifier(nb) 165 - #else 166 - static inline int hotplug_memory_notifier(notifier_fn_t fn, int pri) 167 - { 168 - return 0; 169 - } 170 - /* These aren't inline functions due to a GCC bug. */ 171 - #define register_hotmemory_notifier(nb) ({ (void)(nb); 0; }) 172 - #define unregister_hotmemory_notifier(nb) ({ (void)(nb); }) 173 - #endif 161 + #endif /* CONFIG_MEMORY_HOTPLUG */ 174 162 175 163 /* 176 164 * Kernel text modification mutex, used for code patching. Users of this lock
+2 -2
include/linux/node.h
··· 85 85 struct device dev; 86 86 struct list_head access_list; 87 87 88 - #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) 88 + #if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_HUGETLBFS) 89 89 struct work_struct node_work; 90 90 #endif 91 91 #ifdef CONFIG_HMEM_REPORTING ··· 98 98 extern struct node *node_devices[]; 99 99 typedef void (*node_registration_func_t)(struct node *); 100 100 101 - #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA) 101 + #if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_NUMA) 102 102 void link_mem_sections(int nid, unsigned long start_pfn, 103 103 unsigned long end_pfn, 104 104 enum meminit_context context);
+1 -1
lib/Kconfig.debug
··· 877 877 878 878 config MEMORY_NOTIFIER_ERROR_INJECT 879 879 tristate "Memory hotplug notifier error injection module" 880 - depends on MEMORY_HOTPLUG_SPARSE && NOTIFIER_ERROR_INJECTION 880 + depends on MEMORY_HOTPLUG && NOTIFIER_ERROR_INJECTION 881 881 help 882 882 This option provides the ability to inject artificial errors to 883 883 memory hotplug notifier chain callbacks. It is controlled through
-4
mm/Kconfig
··· 128 128 depends on 64BIT || BROKEN 129 129 select NUMA_KEEP_MEMINFO if NUMA 130 130 131 - config MEMORY_HOTPLUG_SPARSE 132 - def_bool y 133 - depends on SPARSEMEM && MEMORY_HOTPLUG 134 - 135 131 config MEMORY_HOTPLUG_DEFAULT_ONLINE 136 132 bool "Online the newly added memory blocks by default" 137 133 depends on MEMORY_HOTPLUG
-2
mm/memory_hotplug.c
··· 220 220 kfree(res); 221 221 } 222 222 223 - #ifdef CONFIG_MEMORY_HOTPLUG_SPARSE 224 223 static int check_pfn_span(unsigned long pfn, unsigned long nr_pages, 225 224 const char *reason) 226 225 { ··· 1162 1163 mem_hotplug_done(); 1163 1164 return ret; 1164 1165 } 1165 - #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ 1166 1166 1167 1167 static void reset_node_present_pages(pg_data_t *pgdat) 1168 1168 {
-1
tools/testing/selftests/memory-hotplug/config
··· 1 1 CONFIG_MEMORY_HOTPLUG=y 2 - CONFIG_MEMORY_HOTPLUG_SPARSE=y 3 2 CONFIG_NOTIFIER_ERROR_INJECTION=y 4 3 CONFIG_MEMORY_NOTIFIER_ERROR_INJECT=m 5 4 CONFIG_MEMORY_HOTREMOVE=y