Skip to content

Commit bb1c50d

Browse files
rppttorvalds
authored andcommitted
mm: remove CONFIG_DISCONTIGMEM
There are no architectures that support DISCONTIGMEM left. Remove the configuration option and the dead code it was guarding in the generic memory management code. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Acked-by: David Hildenbrand <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Ivan Kokshaysky <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Matt Turner <[email protected]> Cc: Richard Henderson <[email protected]> Cc: Vineet Gupta <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 5ab06e1 commit bb1c50d

File tree

4 files changed

+12
-71
lines changed

4 files changed

+12
-71
lines changed

include/asm-generic/memory_model.h

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,18 @@
66

77
#ifndef __ASSEMBLY__
88

9+
/*
10+
* supports 3 memory models.
11+
*/
912
#if defined(CONFIG_FLATMEM)
1013

1114
#ifndef ARCH_PFN_OFFSET
1215
#define ARCH_PFN_OFFSET (0UL)
1316
#endif
1417

15-
#elif defined(CONFIG_DISCONTIGMEM)
16-
17-
#ifndef arch_pfn_to_nid
18-
#define arch_pfn_to_nid(pfn) pfn_to_nid(pfn)
19-
#endif
20-
21-
#ifndef arch_local_page_offset
22-
#define arch_local_page_offset(pfn, nid) \
23-
((pfn) - NODE_DATA(nid)->node_start_pfn)
24-
#endif
25-
26-
#endif /* CONFIG_DISCONTIGMEM */
27-
28-
/*
29-
* supports 3 memory models.
30-
*/
31-
#if defined(CONFIG_FLATMEM)
32-
3318
#define __pfn_to_page(pfn) (mem_map + ((pfn) - ARCH_PFN_OFFSET))
3419
#define __page_to_pfn(page) ((unsigned long)((page) - mem_map) + \
3520
ARCH_PFN_OFFSET)
36-
#elif defined(CONFIG_DISCONTIGMEM)
37-
38-
#define __pfn_to_page(pfn) \
39-
({ unsigned long __pfn = (pfn); \
40-
unsigned long __nid = arch_pfn_to_nid(__pfn); \
41-
NODE_DATA(__nid)->node_mem_map + arch_local_page_offset(__pfn, __nid);\
42-
})
43-
44-
#define __page_to_pfn(pg) \
45-
({ const struct page *__pg = (pg); \
46-
struct pglist_data *__pgdat = NODE_DATA(page_to_nid(__pg)); \
47-
(unsigned long)(__pg - __pgdat->node_mem_map) + \
48-
__pgdat->node_start_pfn; \
49-
})
5021

5122
#elif defined(CONFIG_SPARSEMEM_VMEMMAP)
5223

@@ -70,7 +41,7 @@
7041
struct mem_section *__sec = __pfn_to_section(__pfn); \
7142
__section_mem_map_addr(__sec) + __pfn; \
7243
})
73-
#endif /* CONFIG_FLATMEM/DISCONTIGMEM/SPARSEMEM */
44+
#endif /* CONFIG_FLATMEM/SPARSEMEM */
7445

7546
/*
7647
* Convert a physical address to a Page Frame Number and back

include/linux/mmzone.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,10 +749,12 @@ struct zonelist {
749749
struct zoneref _zonerefs[MAX_ZONES_PER_ZONELIST + 1];
750750
};
751751

752-
#ifndef CONFIG_DISCONTIGMEM
753-
/* The array of struct pages - for discontigmem use pgdat->lmem_map */
752+
/*
753+
* The array of struct pages for flatmem.
754+
* It must be declared for SPARSEMEM as well because there are configurations
755+
* that rely on that.
756+
*/
754757
extern struct page *mem_map;
755-
#endif
756758

757759
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
758760
struct deferred_split {

mm/Kconfig

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ choice
1919

2020
config FLATMEM_MANUAL
2121
bool "Flat Memory"
22-
depends on !(ARCH_DISCONTIGMEM_ENABLE || ARCH_SPARSEMEM_ENABLE) || ARCH_FLATMEM_ENABLE
22+
depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
2323
help
2424
This option is best suited for non-NUMA systems with
2525
flat address space. The FLATMEM is the most efficient
@@ -32,21 +32,6 @@ config FLATMEM_MANUAL
3232

3333
If unsure, choose this option (Flat Memory) over any other.
3434

35-
config DISCONTIGMEM_MANUAL
36-
bool "Discontiguous Memory"
37-
depends on ARCH_DISCONTIGMEM_ENABLE
38-
help
39-
This option provides enhanced support for discontiguous
40-
memory systems, over FLATMEM. These systems have holes
41-
in their physical address spaces, and this option provides
42-
more efficient handling of these holes.
43-
44-
Although "Discontiguous Memory" is still used by several
45-
architectures, it is considered deprecated in favor of
46-
"Sparse Memory".
47-
48-
If unsure, choose "Sparse Memory" over this option.
49-
5035
config SPARSEMEM_MANUAL
5136
bool "Sparse Memory"
5237
depends on ARCH_SPARSEMEM_ENABLE
@@ -62,17 +47,13 @@ config SPARSEMEM_MANUAL
6247

6348
endchoice
6449

65-
config DISCONTIGMEM
66-
def_bool y
67-
depends on (!SELECT_MEMORY_MODEL && ARCH_DISCONTIGMEM_ENABLE) || DISCONTIGMEM_MANUAL
68-
6950
config SPARSEMEM
7051
def_bool y
7152
depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
7253

7354
config FLATMEM
7455
def_bool y
75-
depends on (!DISCONTIGMEM && !SPARSEMEM) || FLATMEM_MANUAL
56+
depends on !SPARSEMEM || FLATMEM_MANUAL
7657

7758
config FLAT_NODE_MEM_MAP
7859
def_bool y
@@ -85,7 +66,7 @@ config FLAT_NODE_MEM_MAP
8566
#
8667
config NEED_MULTIPLE_NODES
8768
def_bool y
88-
depends on DISCONTIGMEM || NUMA
69+
depends on NUMA
8970

9071
#
9172
# SPARSEMEM_EXTREME (which is the default) does some bootmem

mm/page_alloc.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -349,20 +349,7 @@ compound_page_dtor * const compound_page_dtors[NR_COMPOUND_DTORS] = {
349349

350350
int min_free_kbytes = 1024;
351351
int user_min_free_kbytes = -1;
352-
#ifdef CONFIG_DISCONTIGMEM
353-
/*
354-
* DiscontigMem defines memory ranges as separate pg_data_t even if the ranges
355-
* are not on separate NUMA nodes. Functionally this works but with
356-
* watermark_boost_factor, it can reclaim prematurely as the ranges can be
357-
* quite small. By default, do not boost watermarks on discontigmem as in
358-
* many cases very high-order allocations like THP are likely to be
359-
* unsupported and the premature reclaim offsets the advantage of long-term
360-
* fragmentation avoidance.
361-
*/
362-
int watermark_boost_factor __read_mostly;
363-
#else
364352
int watermark_boost_factor __read_mostly = 15000;
365-
#endif
366353
int watermark_scale_factor = 10;
367354

368355
static unsigned long nr_kernel_pages __initdata;

0 commit comments

Comments
 (0)