Skip to content

Commit 50f9481

Browse files
David Hildenbrandtorvalds
authored andcommitted
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>
1 parent 71b6f2d commit 50f9481

13 files changed

Lines changed: 24 additions & 36 deletions

File tree

‎arch/powerpc/include/asm/machdep.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct machdep_calls {
3232
void (*iommu_save)(void);
3333
void (*iommu_restore)(void);
3434
#endif
35-
#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
35+
#ifdef CONFIG_MEMORY_HOTPLUG
3636
unsigned long (*memory_block_size)(void);
3737
#endif
3838
#endif /* CONFIG_PPC64 */

‎arch/powerpc/kernel/setup_64.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ void __init setup_per_cpu_areas(void)
912912
}
913913
#endif
914914

915-
#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
915+
#ifdef CONFIG_MEMORY_HOTPLUG
916916
unsigned long memory_block_size_bytes(void)
917917
{
918918
if (ppc_md.memory_block_size)

‎arch/powerpc/platforms/powernv/setup.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ static void pnv_kexec_cpu_down(int crash_shutdown, int secondary)
440440
}
441441
#endif /* CONFIG_KEXEC_CORE */
442442

443-
#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
443+
#ifdef CONFIG_MEMORY_HOTPLUG
444444
static unsigned long pnv_memory_block_size(void)
445445
{
446446
/*
@@ -553,7 +553,7 @@ define_machine(powernv) {
553553
#ifdef CONFIG_KEXEC_CORE
554554
.kexec_cpu_down = pnv_kexec_cpu_down,
555555
#endif
556-
#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
556+
#ifdef CONFIG_MEMORY_HOTPLUG
557557
.memory_block_size = pnv_memory_block_size,
558558
#endif
559559
};

‎arch/powerpc/platforms/pseries/setup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ define_machine(pseries) {
10891089
.machine_kexec = pSeries_machine_kexec,
10901090
.kexec_cpu_down = pseries_kexec_cpu_down,
10911091
#endif
1092-
#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
1092+
#ifdef CONFIG_MEMORY_HOTPLUG
10931093
.memory_block_size = pseries_memory_block_size,
10941094
#endif
10951095
};

‎drivers/base/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ obj-y += power/
1313
obj-$(CONFIG_ISA_BUS_API) += isa.o
1414
obj-y += firmware_loader/
1515
obj-$(CONFIG_NUMA) += node.o
16-
obj-$(CONFIG_MEMORY_HOTPLUG_SPARSE) += memory.o
16+
obj-$(CONFIG_MEMORY_HOTPLUG) += memory.o
1717
ifeq ($(CONFIG_SYSFS),y)
1818
obj-$(CONFIG_MODULES) += module.o
1919
endif

‎drivers/base/node.c‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ static void node_device_release(struct device *dev)
629629
{
630630
struct node *node = to_node(dev);
631631

632-
#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
632+
#if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_HUGETLBFS)
633633
/*
634634
* We schedule the work only when a memory section is
635635
* onlined/offlined on this node. When we come here,
@@ -782,7 +782,7 @@ int unregister_cpu_under_node(unsigned int cpu, unsigned int nid)
782782
return 0;
783783
}
784784

785-
#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
785+
#ifdef CONFIG_MEMORY_HOTPLUG
786786
static int __ref get_nid_for_pfn(unsigned long pfn)
787787
{
788788
#ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT
@@ -958,10 +958,9 @@ static int node_memory_callback(struct notifier_block *self,
958958
return NOTIFY_OK;
959959
}
960960
#endif /* CONFIG_HUGETLBFS */
961-
#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
961+
#endif /* CONFIG_MEMORY_HOTPLUG */
962962

963-
#if !defined(CONFIG_MEMORY_HOTPLUG_SPARSE) || \
964-
!defined(CONFIG_HUGETLBFS)
963+
#if !defined(CONFIG_MEMORY_HOTPLUG) || !defined(CONFIG_HUGETLBFS)
965964
static inline int node_memory_callback(struct notifier_block *self,
966965
unsigned long action, void *arg)
967966
{

‎drivers/virtio/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ config VIRTIO_MEM
9898
default m
9999
depends on X86_64
100100
depends on VIRTIO
101-
depends on MEMORY_HOTPLUG_SPARSE
101+
depends on MEMORY_HOTPLUG
102102
depends on MEMORY_HOTREMOVE
103103
depends on CONTIG_ALLOC
104104
help

‎include/linux/memory.h‎

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ struct mem_section;
110110
#define SLAB_CALLBACK_PRI 1
111111
#define IPC_CALLBACK_PRI 10
112112

113-
#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE
113+
#ifndef CONFIG_MEMORY_HOTPLUG
114114
static inline void memory_dev_init(void)
115115
{
116116
return;
@@ -126,7 +126,14 @@ static inline int memory_notify(unsigned long val, void *v)
126126
{
127127
return 0;
128128
}
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 */
130137
extern int register_memory_notifier(struct notifier_block *nb);
131138
extern void unregister_memory_notifier(struct notifier_block *nb);
132139
int create_memory_block_devices(unsigned long start, unsigned long size,
@@ -148,25 +155,14 @@ struct memory_group *memory_group_find_by_id(int mgid);
148155
typedef int (*walk_memory_groups_func_t)(struct memory_group *, void *);
149156
int walk_dynamic_memory_groups(int nid, walk_memory_groups_func_t func,
150157
struct memory_group *excluded, void *arg);
151-
#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
152-
153-
#ifdef CONFIG_MEMORY_HOTPLUG
154158
#define hotplug_memory_notifier(fn, pri) ({ \
155159
static __meminitdata struct notifier_block fn##_mem_nb =\
156160
{ .notifier_call = fn, .priority = pri };\
157161
register_memory_notifier(&fn##_mem_nb); \
158162
})
159163
#define register_hotmemory_notifier(nb) register_memory_notifier(nb)
160164
#define unregister_hotmemory_notifier(nb) unregister_memory_notifier(nb)
161-
#else
162-
static inline int hotplug_memory_notifier(notifier_fn_t fn, int pri)
163-
{
164-
return 0;
165-
}
166-
/* These aren't inline functions due to a GCC bug. */
167-
#define register_hotmemory_notifier(nb) ({ (void)(nb); 0; })
168-
#define unregister_hotmemory_notifier(nb) ({ (void)(nb); })
169-
#endif
165+
#endif /* CONFIG_MEMORY_HOTPLUG */
170166

171167
/*
172168
* Kernel text modification mutex, used for code patching. Users of this lock

‎include/linux/node.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct node {
8585
struct device dev;
8686
struct list_head access_list;
8787

88-
#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS)
88+
#if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_HUGETLBFS)
8989
struct work_struct node_work;
9090
#endif
9191
#ifdef CONFIG_HMEM_REPORTING
@@ -98,7 +98,7 @@ struct memory_block;
9898
extern struct node *node_devices[];
9999
typedef void (*node_registration_func_t)(struct node *);
100100

101-
#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA)
101+
#if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_NUMA)
102102
void link_mem_sections(int nid, unsigned long start_pfn,
103103
unsigned long end_pfn,
104104
enum meminit_context context);

‎lib/Kconfig.debug‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ config DEBUG_MEMORY_INIT
877877

878878
config MEMORY_NOTIFIER_ERROR_INJECT
879879
tristate "Memory hotplug notifier error injection module"
880-
depends on MEMORY_HOTPLUG_SPARSE && NOTIFIER_ERROR_INJECTION
880+
depends on MEMORY_HOTPLUG && NOTIFIER_ERROR_INJECTION
881881
help
882882
This option provides the ability to inject artificial errors to
883883
memory hotplug notifier chain callbacks. It is controlled through

0 commit comments

Comments
 (0)