aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm64/Kconfig1
-rw-r--r--arch/hexagon/Kconfig1
-rw-r--r--arch/ia64/Kconfig1
-rw-r--r--arch/m68k/Kconfig1
-rw-r--r--arch/mips/Kconfig1
-rw-r--r--arch/nios2/Kconfig1
-rw-r--r--arch/powerpc/Kconfig1
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/sh/Kconfig1
-rw-r--r--arch/x86/Kconfig1
-rw-r--r--include/linux/memblock.h3
-rw-r--r--kernel/kexec_file.c16
-rw-r--r--mm/Kconfig2
-rw-r--r--mm/memblock.c6
-rw-r--r--mm/page_alloc.c3
16 files changed, 19 insertions, 23 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a11dfcc2a130..5fd344bd06b9 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -4,7 +4,6 @@ config ARM
4 default y 4 default y
5 select ARCH_32BIT_OFF_T 5 select ARCH_32BIT_OFF_T
6 select ARCH_CLOCKSOURCE_DATA 6 select ARCH_CLOCKSOURCE_DATA
7 select ARCH_DISCARD_MEMBLOCK if !HAVE_ARCH_PFN_VALID && !KEXEC
8 select ARCH_HAS_DEBUG_VIRTUAL if MMU 7 select ARCH_HAS_DEBUG_VIRTUAL if MMU
9 select ARCH_HAS_DEVMEM_IS_ALLOWED 8 select ARCH_HAS_DEVMEM_IS_ALLOWED
10 select ARCH_HAS_ELF_RANDOMIZE 9 select ARCH_HAS_ELF_RANDOMIZE
@@ -22,6 +21,7 @@ config ARM
22 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 21 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
23 select ARCH_HAVE_CUSTOM_GPIO_H 22 select ARCH_HAVE_CUSTOM_GPIO_H
24 select ARCH_HAS_GCOV_PROFILE_ALL 23 select ARCH_HAS_GCOV_PROFILE_ALL
24 select ARCH_KEEP_MEMBLOCK if HAVE_ARCH_PFN_VALID || KEXEC
25 select ARCH_MIGHT_HAVE_PC_PARPORT 25 select ARCH_MIGHT_HAVE_PC_PARPORT
26 select ARCH_NO_SG_CHAIN if !ARM_HAS_SG_CHAIN 26 select ARCH_NO_SG_CHAIN if !ARM_HAS_SG_CHAIN
27 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX 27 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 7a1aa53d188d..69a59a5d1143 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -60,6 +60,7 @@ config ARM64
60 select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPT 60 select ARCH_INLINE_SPIN_UNLOCK_BH if !PREEMPT
61 select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPT 61 select ARCH_INLINE_SPIN_UNLOCK_IRQ if !PREEMPT
62 select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPT 62 select ARCH_INLINE_SPIN_UNLOCK_IRQRESTORE if !PREEMPT
63 select ARCH_KEEP_MEMBLOCK
63 select ARCH_USE_CMPXCHG_LOCKREF 64 select ARCH_USE_CMPXCHG_LOCKREF
64 select ARCH_USE_QUEUED_RWLOCKS 65 select ARCH_USE_QUEUED_RWLOCKS
65 select ARCH_USE_QUEUED_SPINLOCKS 66 select ARCH_USE_QUEUED_SPINLOCKS
diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 3e54a53208d5..b7d404bbaa0f 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -22,7 +22,6 @@ config HEXAGON
22 select GENERIC_IRQ_SHOW 22 select GENERIC_IRQ_SHOW
23 select HAVE_ARCH_KGDB 23 select HAVE_ARCH_KGDB
24 select HAVE_ARCH_TRACEHOOK 24 select HAVE_ARCH_TRACEHOOK
25 select ARCH_DISCARD_MEMBLOCK
26 select NEED_SG_DMA_LENGTH 25 select NEED_SG_DMA_LENGTH
27 select NO_IOPORT_MAP 26 select NO_IOPORT_MAP
28 select GENERIC_IOMAP 27 select GENERIC_IOMAP
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 73a26f04644e..7468d8e50467 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -33,7 +33,6 @@ config IA64
33 select ARCH_HAS_DMA_COHERENT_TO_PFN if SWIOTLB 33 select ARCH_HAS_DMA_COHERENT_TO_PFN if SWIOTLB
34 select ARCH_HAS_SYNC_DMA_FOR_CPU if SWIOTLB 34 select ARCH_HAS_SYNC_DMA_FOR_CPU if SWIOTLB
35 select VIRT_TO_BUS 35 select VIRT_TO_BUS
36 select ARCH_DISCARD_MEMBLOCK
37 select GENERIC_IRQ_PROBE 36 select GENERIC_IRQ_PROBE
38 select GENERIC_PENDING_IRQ if SMP 37 select GENERIC_PENDING_IRQ if SMP
39 select GENERIC_IRQ_SHOW 38 select GENERIC_IRQ_SHOW
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index fe5cc2da6d10..218e037ef901 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -26,7 +26,6 @@ config M68K
26 select MODULES_USE_ELF_RELA 26 select MODULES_USE_ELF_RELA
27 select OLD_SIGSUSPEND3 27 select OLD_SIGSUSPEND3
28 select OLD_SIGACTION 28 select OLD_SIGACTION
29 select ARCH_DISCARD_MEMBLOCK
30 select MMU_GATHER_NO_RANGE if MMU 29 select MMU_GATHER_NO_RANGE if MMU
31 30
32config CPU_BIG_ENDIAN 31config CPU_BIG_ENDIAN
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index ff8cff9fcf54..677e5bfeff47 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -5,7 +5,6 @@ config MIPS
5 select ARCH_32BIT_OFF_T if !64BIT 5 select ARCH_32BIT_OFF_T if !64BIT
6 select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT 6 select ARCH_BINFMT_ELF_STATE if MIPS_FP_SUPPORT
7 select ARCH_CLOCKSOURCE_DATA 7 select ARCH_CLOCKSOURCE_DATA
8 select ARCH_DISCARD_MEMBLOCK
9 select ARCH_HAS_ELF_RANDOMIZE 8 select ARCH_HAS_ELF_RANDOMIZE
10 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST 9 select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
11 select ARCH_HAS_UBSAN_SANITIZE_ALL 10 select ARCH_HAS_UBSAN_SANITIZE_ALL
diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index ea37394ff3ea..26a9c760a98b 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -23,7 +23,6 @@ config NIOS2
23 select SPARSE_IRQ 23 select SPARSE_IRQ
24 select USB_ARCH_HAS_HCD if USB_SUPPORT 24 select USB_ARCH_HAS_HCD if USB_SUPPORT
25 select CPU_NO_EFFICIENT_FFS 25 select CPU_NO_EFFICIENT_FFS
26 select ARCH_DISCARD_MEMBLOCK
27 select MMU_GATHER_NO_RANGE if MMU 26 select MMU_GATHER_NO_RANGE if MMU
28 27
29config GENERIC_CSUM 28config GENERIC_CSUM
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d7996cfaceca..8c1c636308c8 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -137,6 +137,7 @@ config PPC
137 select ARCH_HAS_UBSAN_SANITIZE_ALL 137 select ARCH_HAS_UBSAN_SANITIZE_ALL
138 select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64 138 select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64
139 select ARCH_HAVE_NMI_SAFE_CMPXCHG 139 select ARCH_HAVE_NMI_SAFE_CMPXCHG
140 select ARCH_KEEP_MEMBLOCK
140 select ARCH_MIGHT_HAVE_PC_PARPORT 141 select ARCH_MIGHT_HAVE_PC_PARPORT
141 select ARCH_MIGHT_HAVE_PC_SERIO 142 select ARCH_MIGHT_HAVE_PC_SERIO
142 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX 143 select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index d0c046af65fa..109243fdb6ec 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -100,6 +100,7 @@ config S390
100 select ARCH_INLINE_WRITE_UNLOCK_BH 100 select ARCH_INLINE_WRITE_UNLOCK_BH
101 select ARCH_INLINE_WRITE_UNLOCK_IRQ 101 select ARCH_INLINE_WRITE_UNLOCK_IRQ
102 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE 102 select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
103 select ARCH_KEEP_MEMBLOCK
103 select ARCH_SAVE_PAGE_KEYS if HIBERNATION 104 select ARCH_SAVE_PAGE_KEYS if HIBERNATION
104 select ARCH_SUPPORTS_ATOMIC_RMW 105 select ARCH_SUPPORTS_ATOMIC_RMW
105 select ARCH_SUPPORTS_NUMA_BALANCING 106 select ARCH_SUPPORTS_NUMA_BALANCING
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 2a77033e1e7c..b77f512bb176 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -10,7 +10,6 @@ config SUPERH
10 select DMA_DECLARE_COHERENT 10 select DMA_DECLARE_COHERENT
11 select HAVE_IDE if HAS_IOPORT_MAP 11 select HAVE_IDE if HAS_IOPORT_MAP
12 select HAVE_MEMBLOCK_NODE_MAP 12 select HAVE_MEMBLOCK_NODE_MAP
13 select ARCH_DISCARD_MEMBLOCK
14 select HAVE_OPROFILE 13 select HAVE_OPROFILE
15 select HAVE_ARCH_TRACEHOOK 14 select HAVE_ARCH_TRACEHOOK
16 select HAVE_PERF_EVENTS 15 select HAVE_PERF_EVENTS
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f21bc56e5d7b..818b361094ed 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -47,7 +47,6 @@ config X86
47 select ARCH_32BIT_OFF_T if X86_32 47 select ARCH_32BIT_OFF_T if X86_32
48 select ARCH_CLOCKSOURCE_DATA 48 select ARCH_CLOCKSOURCE_DATA
49 select ARCH_CLOCKSOURCE_INIT 49 select ARCH_CLOCKSOURCE_INIT
50 select ARCH_DISCARD_MEMBLOCK
51 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI 50 select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
52 select ARCH_HAS_DEBUG_VIRTUAL 51 select ARCH_HAS_DEBUG_VIRTUAL
53 select ARCH_HAS_DEVMEM_IS_ALLOWED 52 select ARCH_HAS_DEVMEM_IS_ALLOWED
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 47e3c0612592..676d3900e1bd 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -96,13 +96,14 @@ struct memblock {
96extern struct memblock memblock; 96extern struct memblock memblock;
97extern int memblock_debug; 97extern int memblock_debug;
98 98
99#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK 99#ifndef CONFIG_ARCH_KEEP_MEMBLOCK
100#define __init_memblock __meminit 100#define __init_memblock __meminit
101#define __initdata_memblock __meminitdata 101#define __initdata_memblock __meminitdata
102void memblock_discard(void); 102void memblock_discard(void);
103#else 103#else
104#define __init_memblock 104#define __init_memblock
105#define __initdata_memblock 105#define __initdata_memblock
106static inline void memblock_discard(void) {}
106#endif 107#endif
107 108
108#define memblock_dbg(fmt, ...) \ 109#define memblock_dbg(fmt, ...) \
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index f7fb8f6a688f..072b6ee55e3f 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -500,13 +500,7 @@ static int locate_mem_hole_callback(struct resource *res, void *arg)
500 return locate_mem_hole_bottom_up(start, end, kbuf); 500 return locate_mem_hole_bottom_up(start, end, kbuf);
501} 501}
502 502
503#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK 503#ifdef CONFIG_ARCH_KEEP_MEMBLOCK
504static int kexec_walk_memblock(struct kexec_buf *kbuf,
505 int (*func)(struct resource *, void *))
506{
507 return 0;
508}
509#else
510static int kexec_walk_memblock(struct kexec_buf *kbuf, 504static int kexec_walk_memblock(struct kexec_buf *kbuf,
511 int (*func)(struct resource *, void *)) 505 int (*func)(struct resource *, void *))
512{ 506{
@@ -550,6 +544,12 @@ static int kexec_walk_memblock(struct kexec_buf *kbuf,
550 544
551 return ret; 545 return ret;
552} 546}
547#else
548static int kexec_walk_memblock(struct kexec_buf *kbuf,
549 int (*func)(struct resource *, void *))
550{
551 return 0;
552}
553#endif 553#endif
554 554
555/** 555/**
@@ -589,7 +589,7 @@ int kexec_locate_mem_hole(struct kexec_buf *kbuf)
589 if (kbuf->mem != KEXEC_BUF_MEM_UNKNOWN) 589 if (kbuf->mem != KEXEC_BUF_MEM_UNKNOWN)
590 return 0; 590 return 0;
591 591
592 if (IS_ENABLED(CONFIG_ARCH_DISCARD_MEMBLOCK)) 592 if (!IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK))
593 ret = kexec_walk_resources(kbuf, locate_mem_hole_callback); 593 ret = kexec_walk_resources(kbuf, locate_mem_hole_callback);
594 else 594 else
595 ret = kexec_walk_memblock(kbuf, locate_mem_hole_callback); 595 ret = kexec_walk_memblock(kbuf, locate_mem_hole_callback);
diff --git a/mm/Kconfig b/mm/Kconfig
index 71e697e693df..c5124c2cb0b2 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -136,7 +136,7 @@ config HAVE_MEMBLOCK_PHYS_MAP
136config HAVE_GENERIC_GUP 136config HAVE_GENERIC_GUP
137 bool 137 bool
138 138
139config ARCH_DISCARD_MEMBLOCK 139config ARCH_KEEP_MEMBLOCK
140 bool 140 bool
141 141
142config MEMORY_ISOLATION 142config MEMORY_ISOLATION
diff --git a/mm/memblock.c b/mm/memblock.c
index f315eca9f4a1..6bbad46f4d2c 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -94,7 +94,7 @@
94 * :c:func:`mem_init` function frees all the memory to the buddy page 94 * :c:func:`mem_init` function frees all the memory to the buddy page
95 * allocator. 95 * allocator.
96 * 96 *
97 * If an architecure enables %CONFIG_ARCH_DISCARD_MEMBLOCK, the 97 * Unless an architecure enables %CONFIG_ARCH_KEEP_MEMBLOCK, the
98 * memblock data structures will be discarded after the system 98 * memblock data structures will be discarded after the system
99 * initialization compltes. 99 * initialization compltes.
100 */ 100 */
@@ -375,7 +375,7 @@ static void __init_memblock memblock_remove_region(struct memblock_type *type, u
375 } 375 }
376} 376}
377 377
378#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK 378#ifndef CONFIG_ARCH_KEEP_MEMBLOCK
379/** 379/**
380 * memblock_discard - discard memory and reserved arrays if they were allocated 380 * memblock_discard - discard memory and reserved arrays if they were allocated
381 */ 381 */
@@ -1987,7 +1987,7 @@ unsigned long __init memblock_free_all(void)
1987 return pages; 1987 return pages;
1988} 1988}
1989 1989
1990#if defined(CONFIG_DEBUG_FS) && !defined(CONFIG_ARCH_DISCARD_MEMBLOCK) 1990#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_ARCH_KEEP_MEMBLOCK)
1991 1991
1992static int memblock_debug_show(struct seq_file *m, void *private) 1992static int memblock_debug_show(struct seq_file *m, void *private)
1993{ 1993{
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index cbda9aea0bf5..f2f3fb4921d1 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1896,10 +1896,9 @@ void __init page_alloc_init_late(void)
1896 /* Reinit limits that are based on free pages after the kernel is up */ 1896 /* Reinit limits that are based on free pages after the kernel is up */
1897 files_maxfiles_init(); 1897 files_maxfiles_init();
1898#endif 1898#endif
1899#ifdef CONFIG_ARCH_DISCARD_MEMBLOCK 1899
1900 /* Discard memblock private memory */ 1900 /* Discard memblock private memory */
1901 memblock_discard(); 1901 memblock_discard();
1902#endif
1903 1902
1904 for_each_populated_zone(zone) 1903 for_each_populated_zone(zone)
1905 set_zone_contiguous(zone); 1904 set_zone_contiguous(zone);