arch, mm: deprecate DISCONTIGMEM
Subsystems (20)
Mike Rapoport
maintainercover arch, mm: deprecate DISCONTIGMEM
From: Mike Rapoport <[email protected]>
Hi,
It's been a while since DISCONTIGMEM is generally considered deprecated, but it is still used by four architectures. This set replaces DISCONTIGMEM with a different way to handle holes in the memory map and marks DISCONTIGMEM configuration as BROKEN in Kconfigs of these architectures with the intention to completely remove it in several releases.
While for 64-bit alpha and ia64 the switch to SPARSEMEM is quite obvious and was a matter of moving some bits around, for smaller 32-bit arc and m68k SPARSEMEM is not necessarily the best thing to do.
On 32-bit machines SPARSEMEM would require large sections to make section index fit in the page flags, but larger sections mean that more memory is wasted for unused memory map.
Besides, pfn_to_page() and page_to_pfn() become less efficient, at least on arc.
So I've decided to generalize arm's approach for freeing of unused parts of the memory map with FLATMEM and enable it for both arc and m68k. The details are in the description of patches 10 (arc) and 13 (m68k).
Mike Rapoport (13):
alpha: switch from DISCONTIGMEM to SPARSEMEM
ia64: remove custom __early_pfn_to_nid()
ia64: remove 'ifdef CONFIG_ZONE_DMA32' statements
ia64: discontig: paging_init(): remove local max_pfn calculation
ia64: split virtual map initialization out of paging_init()
ia64: forbid using VIRTUAL_MEM_MAP with FLATMEM
ia64: make SPARSEMEM default and disable DISCONTIGMEM
arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
arm, arm64: move free_unused_memmap() to generic mm
arc: use FLATMEM with freeing of unused memory map instead of DISCONTIGMEM m68k/mm: make node data and node setup depend on CONFIG_DISCONTIGMEM m68k/mm: enable use of generic memory_model.h for !DISCONTIGMEM
m68k: deprecate DISCONTIGMEM
Documentation/vm/memory-model.rst | 3 +- arch/Kconfig | 3 ++ arch/alpha/Kconfig | 8 +++ arch/alpha/include/asm/mmzone.h | 14 +---- arch/alpha/include/asm/page.h | 7 +-- arch/alpha/include/asm/pgtable.h | 12 ++--- arch/alpha/include/asm/sparsemem.h | 18 +++++++ arch/alpha/kernel/setup.c | 1 + arch/arc/Kconfig | 3 +- arch/arc/include/asm/page.h | 20 ++++++-- arch/arc/mm/init.c | 29 ++++++++--- arch/arm/Kconfig | 10 +--- arch/arm/mach-bcm/Kconfig | 1 - arch/arm/mach-davinci/Kconfig | 1 - arch/arm/mach-exynos/Kconfig | 1 - arch/arm/mach-highbank/Kconfig | 1 - arch/arm/mach-omap2/Kconfig | 1 - arch/arm/mach-s5pv210/Kconfig | 1 - arch/arm/mach-tango/Kconfig | 1 - arch/arm/mm/init.c | 78 ---------------------------- arch/arm64/Kconfig | 4 +- arch/arm64/mm/init.c | 68 ------------------------ arch/ia64/Kconfig | 11 ++-- arch/ia64/include/asm/meminit.h | 2 - arch/ia64/mm/contig.c | 58 ++++++++++----------- arch/ia64/mm/discontig.c | 44 ++++++++-------- arch/ia64/mm/init.c | 14 ----- arch/ia64/mm/numa.c | 30 ----------- arch/m68k/Kconfig.cpu | 32 ++++++++++-- arch/m68k/include/asm/page.h | 2 + arch/m68k/include/asm/page_mm.h | 7 ++- arch/m68k/include/asm/virtconvert.h | 2 +- arch/m68k/mm/init.c | 8 +-- fs/proc/kcore.c | 2 - include/linux/mm.h | 3 -- include/linux/mmzone.h | 42 --------------- mm/memblock.c | 80 +++++++++++++++++++++++++++++ mm/mmzone.c | 14 ----- mm/page_alloc.c | 16 ++++-- mm/vmstat.c | 4 -- 40 files changed, 272 insertions(+), 384 deletions(-) create mode 100644 arch/alpha/include/asm/sparsemem.h
base-commit: 3650b228f83adda7e5ee532e2b90429c03f7b9ec
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 1/13 alpha: switch from DISCONTIGMEM to SPARSEMEM
From: Mike Rapoport <[email protected]>
Enable SPARSEMEM support on alpha and deprecate DISCONTIGMEM.
The required changes are mostly around moving duplicated definitions of page access and address conversion macros to a common place and making sure they are available for all memory models.
The DISCONTINGMEM support is marked as BROKEN an will be removed in a couple of releases.
--- arch/alpha/Kconfig | 8 ++++++++ arch/alpha/include/asm/mmzone.h | 14 ++------------ arch/alpha/include/asm/page.h | 7 ++++--- arch/alpha/include/asm/pgtable.h | 12 +++++------- arch/alpha/include/asm/sparsemem.h | 18 ++++++++++++++++++ arch/alpha/kernel/setup.c | 1 + 6 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 arch/alpha/include/asm/sparsemem.h
arch/alpha/Kconfig +8 -0
@@ -40,6 +40,7 @@ config ALPHA select CPU_NO_EFFICIENT_FFS if !ALPHA_EV67 select MMU_GATHER_NO_RANGE select SET_FS + select SPARSEMEM_EXTREME if SPARSEMEM help The Alpha is a 64-bit general-purpose processor designed and marketed by the Digital Equipment Corporation of blessed memory,
@@ -551,12 +552,19 @@ config NR_CPUS config ARCH_DISCONTIGMEM_ENABLE bool "Discontiguous Memory Support" + depends on BROKEN help Say Y to support efficient handling of discontiguous physical memory, for architectures which are either NUMA (Non-Uniform Memory Access) or have huge holes in the physical address space for other reasons. See <file:Documentation/vm/numa.rst> for more. +config ARCH_SPARSEMEM_ENABLE + bool "Sparse Memory Support" + help + Say Y to support efficient handling of discontiguous physical memory, + for systems that have huge holes in the physical address space. + config NUMA bool "NUMA Support (EXPERIMENTAL)" depends on DISCONTIGMEM && BROKEN
arch/alpha/include/asm/mmzone.h +2 -12
@@ -6,6 +6,8 @@#ifndef _ASM_MMZONE_H_#define _ASM_MMZONE_H_ +#ifdef CONFIG_DISCONTIGMEM +#include <asm/smp.h> /*
@@ -45,8 +47,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) }#endif -#ifdef CONFIG_DISCONTIGMEM -/* * Following are macros that each numa implementation must define. */
@@ -68,11 +68,6 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n)/* XXX: FIXME -- nyc */ #define kern_addr_valid (kaddr) (0) -#define virt_to_page (kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) - -#define pmd_page (pmd) (pfn_to_page(pmd_val(pmd) >> 32)) -#define pte_pfn (pte) (pte_val(pte) >> 32) -#define mk_pte (page, pgprot) \ ({ \ pte_t pte; \
@@ -95,16 +90,11 @@ PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) __xx; \ }) -#define page_to_pa (page) \ - (page_to_pfn(page) << PAGE_SHIFT) -#define pfn_to_nid (pfn) pa_to_nid(((u64)(pfn) << PAGE_SHIFT))#define pfn_valid (pfn) \ (((pfn) - node_start_pfn(pfn_to_nid(pfn))) < \ node_spanned_pages(pfn_to_nid(pfn))) \ -#define virt_addr_valid (kaddr) pfn_valid((__pa(kaddr) >> PAGE_SHIFT)) -#endif /* CONFIG_DISCONTIGMEM */ #endif /* _ASM_MMZONE_H_ */
arch/alpha/include/asm/page.h +4 -3
@@ -83,12 +83,13 @@ typedef struct page *pgtable_t;#define __pa (x) ((unsigned long) (x) - PAGE_OFFSET)#define __va (x) ((void *)((unsigned long) (x) + PAGE_OFFSET)) -#ifndef CONFIG_DISCONTIGMEM +#define virt_to_page (kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) +#define virt_addr_valid (kaddr) pfn_valid((__pa(kaddr) >> PAGE_SHIFT)) +#ifdef CONFIG_FLATMEM #define pfn_valid (pfn) ((pfn) < max_mapnr) -#define virt_addr_valid (kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) -#endif /* CONFIG_DISCONTIGMEM */ +#endif /* CONFIG_FLATMEM */ #include <asm-generic/memory_model.h> #include <asm-generic/getorder.h>
arch/alpha/include/asm/pgtable.h +5 -7
@@ -203,10 +203,10 @@ extern unsigned long __zero_page(void);* Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ -#ifndef CONFIG_DISCONTIGMEM -#define page_to_pa (page) (((page) - mem_map) << PAGE_SHIFT) - +#define page_to_pa (page) (page_to_pfn(page) << PAGE_SHIFT)#define pte_pfn (pte) (pte_val(pte) >> 32) + +#ifndef CONFIG_DISCONTIGMEM #define pte_page (pte) pfn_to_page(pte_pfn(pte))#define mk_pte (page, pgprot) \ ({ \
@@ -236,10 +236,8 @@ pmd_page_vaddr(pmd_t pmd)return ((pmd_val (pmd) & _PFN_MASK) >> (32 -PAGE_SHIFT )) +PAGE_OFFSET ; } -#ifndef CONFIG_DISCONTIGMEM -#define pmd_page (pmd) (mem_map + ((pmd_val(pmd) & _PFN_MASK) >> 32)) -#define pud_page (pud) (mem_map + ((pud_val(pud) & _PFN_MASK) >> 32)) -#endif +#define pmd_page (pmd) (pfn_to_page(pmd_val(pmd) >> 32)) +#define pud_page (pud) (pfn_to_page(pud_val(pud) >> 32))extern inline unsigned long pud_page_vaddr (pud_t pgd) {return PAGE_OFFSET + ((pud_val (pgd) & _PFN_MASK) >> (32 -PAGE_SHIFT )); }
arch/alpha/include/asm/sparsemem.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_ALPHA_SPARSEMEM_H +#define _ASM_ALPHA_SPARSEMEM_H + +#ifdef CONFIG_SPARSEMEM + +#define SECTION_SIZE_BITS 27 + +/* +* According to "Alpha Architecture Reference Manual" physical +* addresses are at most 48 bits. +* https://download.majix.org/dec/alpha_arch_ref.pdf +*/ +#define MAX_PHYSMEM_BITS 48 + +#endif /* CONFIG_SPARSEMEM */ + +#endif /* _ASM_ALPHA_SPARSEMEM_H */
arch/alpha/kernel/setup.c +1 -0
@@ -648,6 +648,7 @@ setup_arch(char **cmdline_p)/* Find our memory. */ setup_memory (kernel_end);memblock_set_bottom_up (true); +sparse_init ();/* First guess at cpu cache sizes. Do this before init_arch. */ determine_cpu_caches (cpu->type);
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 2/13 ia64: remove custom __early_pfn_to_nid()
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
The ia64 implementation of __early_pfn_to_nid() essentially relies on the same data as the generic implementation.
The correspondence between memory ranges and nodes is set in memblock during early memory initialization in register_active_ranges() function.
The initialization of sparsemem that requires early_pfn_to_nid() happens later and it can use the memblock information like the other architectures.
--- arch/ia64/Kconfig | 3 --- arch/ia64/mm/numa.c | 30 ------------------------------ include/linux/mm.h | 3 --- include/linux/mmzone.h | 11 ----------- mm/page_alloc.c | 16 ++++++++++++---- 5 files changed, 12 insertions(+), 51 deletions(-)
arch/ia64/Kconfig +0 -3
@@ -342,9 +342,6 @@ config HOLES_IN_ZONE bool default y if VIRTUAL_MEM_MAP -config HAVE_ARCH_EARLY_PFN_TO_NID - def_bool NUMA && SPARSEMEM - config HAVE_ARCH_NODEDATA_EXTENSION def_bool y depends on NUMA
arch/ia64/mm/numa.c +0 -30
@@ -58,36 +58,6 @@ paddr_to_nid(unsigned long paddr)EXPORT_SYMBOL (paddr_to_nid);#if defined(CONFIG_SPARSEMEM ) && defined(CONFIG_NUMA ) -/* -* Because of holes evaluate on section limits. -* If the section of memory exists, then return the node where the section -* resides. Otherwise return node 0 as the default. This is used by -* SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where -* the section resides. -*/ -int __meminit __early_pfn_to_nid (unsigned long pfn, -struct mminit_pfnnid_cache *state) -{ -int i, section = pfn >>PFN_SECTION_SHIFT , ssec, esec; - -if (section >= state->last_start && section < state->last_end) -return state->last_nid; - -for (i =0 ; i < num_node_memblks; i++) { - ssec = node_memblk[i].start_paddr >>PA_SECTION_SHIFT ; - esec = (node_memblk[i].start_paddr + node_memblk[i].size + - ((1L <<PA_SECTION_SHIFT ) -1 )) >>PA_SECTION_SHIFT ; -if (section >= ssec && section < esec) { - state->last_start = ssec; - state->last_end = esec; - state->last_nid = node_memblk[i].nid; -return node_memblk[i].nid; - } - } - -return -1 ; -} -void numa_clear_node (int cpu) {unmap_cpu_from_node (cpu,NUMA_NO_NODE );
include/linux/mm.h +0 -3
@@ -2433,9 +2433,6 @@ static inline int early_pfn_to_nid(unsigned long pfn)#else /* please see mm/page_alloc.c */ extern int __meminit early_pfn_to_nid (unsigned long pfn); -/* there is a per-arch backend function. */ -extern int __meminit __early_pfn_to_nid (unsigned long pfn, -struct mminit_pfnnid_cache *state);#endif extern void set_dma_reserve (unsigned long new_dma_reserve);
include/linux/mmzone.h +0 -11
@@ -1428,17 +1428,6 @@ void sparse_init(void);#define subsection_map_init (_pfn, _nr_pages) do {} while (0)#endif /* CONFIG_SPARSEMEM */ -/* -* During memory init memblocks map pfns to nids. The search is expensive and -* this caches recent lookups. The implementation of __early_pfn_to_nid -* may treat start/end as pfns or sections. -*/ -struct mminit_pfnnid_cache { -unsigned long last_start; -unsigned long last_end; -int last_nid; -}; -/* * If it is possible to have holes within a MAX_ORDER_NR_PAGES, then we * need to check pfn validity within that MAX_ORDER_NR_PAGES block.
mm/page_alloc.c +12 -4
@@ -1558,14 +1558,23 @@ void __free_pages_core(struct page *page, unsigned int order)#ifdef CONFIG_NEED_MULTIPLE_NODES -static struct mminit_pfnnid_cache early_pfnnid_cache __meminitdata; +/* +* During memory init memblocks map pfns to nids. The search is expensive and +* this caches recent lookups. The implementation of __early_pfn_to_nid +* treats start/end as pfns. +*/ +struct mminit_pfnnid_cache { +unsigned long last_start; +unsigned long last_end; +int last_nid; +}; -#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID +static struct mminit_pfnnid_cache early_pfnnid_cache__meminitdata ;/* * Required by SPARSEMEM. Given a PFN, return what node the PFN is on. */ -int __meminit __early_pfn_to_nid(unsigned long pfn, +static int __meminit __early_pfn_to_nid (unsigned long pfn,struct mminit_pfnnid_cache *state) {unsigned long start_pfn, end_pfn;
@@ -1583,7 +1592,6 @@ int __meminit __early_pfn_to_nid(unsigned long pfn,return nid; } -#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */ int __meminit early_pfn_to_nid (unsigned long pfn) {
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 3/13 ia64: remove 'ifdef CONFIG_ZONE_DMA32' statements
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
After the removal of SN2 platform (commit cf07cb1ff4ea ("ia64: remove support for the SGI SN2 platform") IA-64 always has ZONE_DMA32 and there is no point to guard code with this configuration option.
Remove ifdefery associated with CONFIG_ZONE_DMA32
--- arch/ia64/mm/contig.c | 2 -- arch/ia64/mm/discontig.c | 2 -- 2 files changed, 4 deletions(-)
arch/ia64/mm/contig.c +0 -2
@@ -177,10 +177,8 @@ paging_init (void)unsigned long max_zone_pfns[MAX_NR_ZONES ];memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); -#ifdef CONFIG_ZONE_DMA32 max_dma =virt_to_phys ((void *)MAX_DMA_ADDRESS ) >>PAGE_SHIFT ; max_zone_pfns[ZONE_DMA32 ] = max_dma; -#endif max_zone_pfns[ZONE_NORMAL ] = max_low_pfn;#ifdef CONFIG_VIRTUAL_MEM_MAP
arch/ia64/mm/discontig.c +0 -2
@@ -621,9 +621,7 @@ void __init paging_init(void) }memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); -#ifdef CONFIG_ZONE_DMA32 max_zone_pfns[ZONE_DMA32 ] = max_dma; -#endif max_zone_pfns[ZONE_NORMAL ] = max_pfn;free_area_init (max_zone_pfns);
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 4/13 ia64: discontig: paging_init(): remove local max_pfn calculation
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
The maximal PFN in the system is calculated during find_memory() time and it is stored at max_low_pfn then.
Use this value in paging_init() and remove the redundant detection of max_pfn in that function.
--- arch/ia64/mm/discontig.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/ia64/mm/discontig.c +1 -4
@@ -594,7 +594,6 @@ void __init paging_init(void) {unsigned long max_dma;unsigned long pfn_offset =0 ; -unsigned long max_pfn =0 ;int node;unsigned long max_zone_pfns[MAX_NR_ZONES ];
@@ -616,13 +615,11 @@ void __init paging_init(void)#ifdef CONFIG_VIRTUAL_MEM_MAP NODE_DATA (node)->node_mem_map = vmem_map + pfn_offset;#endif -if (mem_data[node].max_pfn > max_pfn) - max_pfn = mem_data[node].max_pfn; }memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); max_zone_pfns[ZONE_DMA32 ] = max_dma; - max_zone_pfns[ZONE_NORMAL ] = max_pfn; + max_zone_pfns[ZONE_NORMAL ] = max_low_pfn;free_area_init (max_zone_pfns); zero_page_memmap_ptr =virt_to_page (ia64_imva (empty_zero_page));
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 5/13 ia64: split virtual map initialization out of paging_init()
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
For both FLATMEM and DISCONTIGMEM/SPARSEMEM the virtual map initialization is spread over paging_init() for no good reason.
Split out the bits related to virtual map initialization to a helper functions, one for FLATMEM and another for !FLATMEM configurations.
--- arch/ia64/mm/contig.c | 34 ++++++++++++++++++++-------------- arch/ia64/mm/discontig.c | 37 ++++++++++++++++++++----------------- 2 files changed, 40 insertions(+), 31 deletions(-)
arch/ia64/mm/contig.c +20 -14
@@ -166,21 +166,8 @@ find_memory (void)alloc_per_cpu_data (); } -/* -* Set up the page tables. -*/ - -void __init -paging_init (void ) +static void __init virtual_map_init (void ) { -unsigned long max_dma; -unsigned long max_zone_pfns[MAX_NR_ZONES ]; - -memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); - max_dma =virt_to_phys ((void *)MAX_DMA_ADDRESS ) >>PAGE_SHIFT ; - max_zone_pfns[ZONE_DMA32 ] = max_dma; - max_zone_pfns[ZONE_NORMAL ] = max_low_pfn; -#ifdef CONFIG_VIRTUAL_MEM_MAP efi_memmap_walk (find_largest_hole, (u64 *)&max_gap);if (max_gap <LARGE_GAP ) {
@@ -206,6 +193,25 @@ paging_init (void) printk("Virtual mem_map starts at 0x%p\n", mem_map); }#endif /* !CONFIG_VIRTUAL_MEM_MAP */ +} + +/* +* Set up the page tables. +*/ + +void __init +paging_init (void ) +{ +unsigned long max_dma; +unsigned long max_zone_pfns[MAX_NR_ZONES ]; + +memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); + max_dma =virt_to_phys ((void *)MAX_DMA_ADDRESS ) >>PAGE_SHIFT ; + max_zone_pfns[ZONE_DMA32 ] = max_dma; + max_zone_pfns[ZONE_NORMAL ] = max_low_pfn; + +virtual_map_init (); +free_area_init (max_zone_pfns); zero_page_memmap_ptr =virt_to_page (ia64_imva (empty_zero_page)); }
arch/ia64/mm/discontig.c +20 -17
@@ -584,6 +584,25 @@ void call_pernode_memory(unsigned long start, unsigned long len, void *arg) } } +static void __init virtual_map_init (void ) +{ +#ifdef CONFIG_VIRTUAL_MEM_MAP +int node; + +VMALLOC_END -=PAGE_ALIGN (ALIGN (max_low_pfn,MAX_ORDER_NR_PAGES ) * +sizeof (struct page )); + vmem_map = (struct page *)VMALLOC_END ; +efi_memmap_walk (create_mem_map_page_table,NULL ); +printk ("Virtual mem_map starts at 0x%p\n" , vmem_map); + +for_each_online_node (node) { +unsigned long pfn_offset = mem_data[node].min_pfn; + +NODE_DATA (node)->node_mem_map = vmem_map + pfn_offset; + } +#endif +} +/** * paging_init - setup page tables *
@@ -593,29 +612,13 @@ void call_pernode_memory(unsigned long start, unsigned long len, void *arg)void __init paging_init (void ) {unsigned long max_dma; -unsigned long pfn_offset =0 ; -int node;unsigned long max_zone_pfns[MAX_NR_ZONES ]; max_dma =virt_to_phys ((void *)MAX_DMA_ADDRESS ) >>PAGE_SHIFT ;sparse_init (); -#ifdef CONFIG_VIRTUAL_MEM_MAP -VMALLOC_END -=PAGE_ALIGN (ALIGN (max_low_pfn,MAX_ORDER_NR_PAGES ) * -sizeof (struct page )); - vmem_map = (struct page *)VMALLOC_END ; -efi_memmap_walk (create_mem_map_page_table,NULL ); -printk ("Virtual mem_map starts at 0x%p\n" , vmem_map); -#endif - -for_each_online_node (node) { - pfn_offset = mem_data[node].min_pfn; - -#ifdef CONFIG_VIRTUAL_MEM_MAP -NODE_DATA (node)->node_mem_map = vmem_map + pfn_offset; -#endif - } +virtual_map_init ();memset (max_zone_pfns,0 ,sizeof (max_zone_pfns)); max_zone_pfns[ZONE_DMA32 ] = max_dma;
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 6/13 ia64: forbid using VIRTUAL_MEM_MAP with FLATMEM
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
Virtual memory map was intended to avoid wasting memory on the memory map on systems with large holes in the physical memory layout. Long ago it been superseded first by DISCONTIGMEM and then by SPARSEMEM. Moreover, SPARSEMEM_VMEMMAP provide the same functionality in much more portable way.
As the first step to removing the VIRTUAL_MEM_MAP forbid it's usage with FLATMEM and panic on systems with large holes in the physical memory layout that try to run FLATMEM kernels.
--- arch/ia64/Kconfig | 2 +- arch/ia64/include/asm/meminit.h | 2 -- arch/ia64/mm/contig.c | 48 +++++++++++++++------------------ arch/ia64/mm/init.c | 14 ---------- 4 files changed, 22 insertions(+), 44 deletions(-)
arch/ia64/Kconfig +1 -1
@@ -329,7 +329,7 @@ config NODES_SHIFT # VIRTUAL_MEM_MAP has been retained for historical reasons. config VIRTUAL_MEM_MAP bool "Virtual mem map" - depends on !SPARSEMEM + depends on !SPARSEMEM && !FLATMEM default y help Say Y to compile the kernel with support for a virtual mem map.
arch/ia64/include/asm/meminit.h +0 -2
@@ -59,10 +59,8 @@ extern int reserve_elfcorehdr(u64 *start, u64 *end);extern int register_active_ranges (u64 start,u64 len,int nid);#ifdef CONFIG_VIRTUAL_MEM_MAP -# define LARGE_GAP 0x40000000/* Use virtual mem map if hole is > than this */ extern unsigned long VMALLOC_END ;extern struct page *vmem_map; -extern int find_largest_hole (u64 start,u64 end,void *arg);extern int create_mem_map_page_table (u64 start,u64 end,void *arg);extern int vmemmap_find_next_valid_pfn (int ,int );#else
arch/ia64/mm/contig.c +21 -27
76 lines not on this page · raw message
arch/ia64/mm/init.c +0 -14
@@ -574,20 +574,6 @@ ia64_pfn_valid (unsigned long pfn) }EXPORT_SYMBOL (ia64_pfn_valid); -int __init find_largest_hole (u64 start,u64 end,void *arg) -{ -u64 *max_gap = arg; - -static u64 last_end =PAGE_OFFSET ; - -/* NOTE: this algorithm assumes efi memmap table is ordered */ - -if (*max_gap < (start - last_end)) - *max_gap = start - last_end; - last_end = end; -return 0 ; -} -#endif /* CONFIG_VIRTUAL_MEM_MAP */ int __init register_active_ranges (u64 start,u64 len,int nid)
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 7/13 ia64: make SPARSEMEM default and disable DISCONTIGMEM
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
SPARSEMEM memory model suitable for systems with large holes in their phyiscal memory layout. With SPARSEMEM_VMEMMAP enabled it provides pfn_to_page() and page_to_pfn() as fast as FLATMEM.
Make it the default memory model for IA-64 and disable DISCONTIGMEM which is considered obsolete for quite some time.
--- arch/ia64/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/ia64/Kconfig +3 -3
@@ -288,6 +288,7 @@ config ARCH_SELECT_MEMORY_MODEL config ARCH_DISCONTIGMEM_ENABLE def_bool y + depends on BROKEN help Say Y to support efficient handling of discontiguous physical memory, for architectures which are either NUMA (Non-Uniform Memory Access)
@@ -299,12 +300,11 @@ config ARCH_FLATMEM_ENABLE config ARCH_SPARSEMEM_ENABLE def_bool y - depends on ARCH_DISCONTIGMEM_ENABLE select SPARSEMEM_VMEMMAP_ENABLE -config ARCH_DISCONTIGMEM_DEFAULT +config ARCH_SPARSEMEM_DEFAULT def_bool y - depends on ARCH_DISCONTIGMEM_ENABLE + depends on ARCH_SPARSEMEM_ENABLE config NUMA bool "NUMA support"
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 8/13 arm: remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
ARM is the only architecture that defines CONFIG_ARCH_HAS_HOLES_MEMORYMODEL which in turn enables memmap_valid_within() function that is intended to verify existence of struct page associated with a pfn when there are holes in the memory map.
However, the ARCH_HAS_HOLES_MEMORYMODEL also enables HAVE_ARCH_PFN_VALID and arch-specific pfn_valid() implementation that also deals with the holes in the memory map.
The only two users of memmap_valid_within() call this function after a call to pfn_valid() so the memmap_valid_within() check becomes redundant.
Remove CONFIG_ARCH_HAS_HOLES_MEMORYMODEL and memmap_valid_within() and rely entirely on ARM's implementation of pfn_valid() that is now enabled unconditionally.
--- Documentation/vm/memory-model.rst | 3 +-- arch/arm/Kconfig | 8 ++------ arch/arm/mach-bcm/Kconfig | 1 - arch/arm/mach-davinci/Kconfig | 1 - arch/arm/mach-exynos/Kconfig | 1 - arch/arm/mach-highbank/Kconfig | 1 - arch/arm/mach-omap2/Kconfig | 1 - arch/arm/mach-s5pv210/Kconfig | 1 - arch/arm/mach-tango/Kconfig | 1 - fs/proc/kcore.c | 2 -- include/linux/mmzone.h | 31 ------------------------------- mm/mmzone.c | 14 -------------- mm/vmstat.c | 4 ---- 13 files changed, 3 insertions(+), 66 deletions(-)
Documentation/vm/memory-model.rst +1 -2
@@ -51,8 +51,7 @@ call :c:func:`free_area_init` function. Yet, the mappings array is not usable until the call to :c:func:`memblock_free_all` that hands all the memory to the page allocator. -If an architecture enables `CONFIG_ARCH_HAS_HOLES_MEMORYMODEL` option, -it may free parts of the `mem_map` array that do not cover the +An architecture may free parts of the `mem_map` array that do not cover the actual physical pages. In such case, the architecture specific :c:func:`pfn_valid` implementation should take the holes in the `mem_map` into account.
arch/arm/Kconfig +2 -6
@@ -25,7 +25,7 @@ config ARM select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAVE_CUSTOM_GPIO_H select ARCH_HAS_GCOV_PROFILE_ALL - select ARCH_KEEP_MEMBLOCK if HAVE_ARCH_PFN_VALID || KEXEC + select ARCH_KEEP_MEMBLOCK select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_NO_SG_CHAIN if !ARM_HAS_SG_CHAIN select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
@@ -519,7 +519,6 @@ config ARCH_S3C24XX config ARCH_OMAP1 bool "TI OMAP1" depends on MMU - select ARCH_HAS_HOLES_MEMORYMODEL select ARCH_OMAP select CLKDEV_LOOKUP select CLKSRC_MMIO
@@ -1479,9 +1478,6 @@ config OABI_COMPAT UNPREDICTABLE (in fact it can be predicted that it won't work at all). If in doubt say N. -config ARCH_HAS_HOLES_MEMORYMODEL - bool - config ARCH_SELECT_MEMORY_MODEL bool
@@ -1493,7 +1489,7 @@ config ARCH_SPARSEMEM_ENABLE select SPARSEMEM_STATIC if SPARSEMEM config HAVE_ARCH_PFN_VALID - def_bool ARCH_HAS_HOLES_MEMORYMODEL || !SPARSEMEM + def_bool y config HIGHMEM bool "High Memory Support"
arch/arm/mach-bcm/Kconfig +0 -1
@@ -211,7 +211,6 @@ config ARCH_BRCMSTB select BCM7038_L1_IRQ select BRCMSTB_L2_IRQ select BCM7120_L2_IRQ - select ARCH_HAS_HOLES_MEMORYMODEL select ZONE_DMA if ARM_LPAE select SOC_BRCMSTB select SOC_BUS
arch/arm/mach-davinci/Kconfig +0 -1
@@ -5,7 +5,6 @@ menuconfig ARCH_DAVINCI depends on ARCH_MULTI_V5 select DAVINCI_TIMER select ZONE_DMA - select ARCH_HAS_HOLES_MEMORYMODEL select PM_GENERIC_DOMAINS if PM select PM_GENERIC_DOMAINS_OF if PM && OF select REGMAP_MMIO
arch/arm/mach-exynos/Kconfig +0 -1
@@ -8,7 +8,6 @@ menuconfig ARCH_EXYNOS bool "Samsung Exynos" depends on ARCH_MULTI_V7 - select ARCH_HAS_HOLES_MEMORYMODEL select ARCH_SUPPORTS_BIG_ENDIAN select ARM_AMBA select ARM_GIC
arch/arm/mach-highbank/Kconfig +0 -1
@@ -2,7 +2,6 @@ config ARCH_HIGHBANK bool "Calxeda ECX-1000/2000 (Highbank/Midway)" depends on ARCH_MULTI_V7 - select ARCH_HAS_HOLES_MEMORYMODEL select ARCH_SUPPORTS_BIG_ENDIAN select ARM_AMBA select ARM_ERRATA_764369 if SMP
arch/arm/mach-omap2/Kconfig +0 -1
@@ -94,7 +94,6 @@ config SOC_DRA7XX config ARCH_OMAP2PLUS bool select ARCH_HAS_BANDGAP - select ARCH_HAS_HOLES_MEMORYMODEL select ARCH_HAS_RESET_CONTROLLER select ARCH_OMAP select CLKSRC_MMIO
arch/arm/mach-s5pv210/Kconfig +0 -1
@@ -8,7 +8,6 @@ config ARCH_S5PV210 bool "Samsung S5PV210/S5PC110" depends on ARCH_MULTI_V7 - select ARCH_HAS_HOLES_MEMORYMODEL select ARM_VIC select CLKSRC_SAMSUNG_PWM select COMMON_CLK_SAMSUNG
arch/arm/mach-tango/Kconfig +0 -1
@@ -3,7 +3,6 @@ config ARCH_TANGO bool "Sigma Designs Tango4 (SMP87xx)" depends on ARCH_MULTI_V7 # Cortex-A9 MPCore r3p0, PL310 r3p2 - select ARCH_HAS_HOLES_MEMORYMODEL select ARM_ERRATA_754322 select ARM_ERRATA_764369 if SMP select ARM_ERRATA_775420
fs/proc/kcore.c +0 -2
@@ -193,8 +193,6 @@ kclist_add_private(unsigned long pfn, unsigned long nr_pages, void *arg)return 1 ; p =pfn_to_page (pfn); -if (!memmap_valid_within (pfn, p,page_zone (p))) -return 1 ; ent =kmalloc (sizeof (*ent),GFP_KERNEL );if (!ent)
include/linux/mmzone.h +0 -31
@@ -1440,37 +1440,6 @@ void sparse_init(void);#define pfn_valid_within (pfn) (1)#endif -#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL -/* -* pfn_valid() is meant to be able to tell if a given PFN has valid memmap -* associated with it or not. This means that a struct page exists for this -* pfn. The caller cannot assume the page is fully initialized in general. -* Hotplugable pages might not have been onlined yet. pfn_to_online_page() -* will ensure the struct page is fully online and initialized. Special pages -* (e.g. ZONE_DEVICE) are never onlined and should be treated accordingly. -* -* In FLATMEM, it is expected that holes always have valid memmap as long as -* there is valid PFNs either side of the hole. In SPARSEMEM, it is assumed -* that a valid section has a memmap for the entire section. -* -* However, an ARM, and maybe other embedded architectures in the future -* free memmap backing holes to save memory on the assumption the memmap is -* never used. The page_zone linkages are then broken even though pfn_valid() -* returns true. A walker of the full memmap must then do this additional -* check to ensure the memmap they are looking at is sane by making sure -* the zone and PFN linkages are still valid. This is expensive, but walkers -* of the full memmap are extremely rare. -*/ -bool memmap_valid_within (unsigned long pfn, -struct page *page,struct zone *zone); -#else -static inline bool memmap_valid_within (unsigned long pfn, -struct page *page,struct zone *zone) -{ -return true; -} -#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ -#endif /* !__GENERATING_BOUNDS.H */ #endif /* !__ASSEMBLY__ */ #endif /* _LINUX_MMZONE_H */
mm/mmzone.c +0 -14
@@ -72,20 +72,6 @@ struct zoneref *__next_zones_zonelist(struct zoneref *z,return z; } -#ifdef CONFIG_ARCH_HAS_HOLES_MEMORYMODEL -bool memmap_valid_within (unsigned long pfn, -struct page *page,struct zone *zone) -{ -if (page_to_pfn (page) != pfn) -return false; - -if (page_zone (page) != zone) -return false; - -return true; -} -#endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */ -void lruvec_init (struct lruvec *lruvec) {enum lru_list lru;
mm/vmstat.c +0 -4
@@ -1503,10 +1503,6 @@ static void pagetypeinfo_showblockcount_print(struct seq_file *m,if (!page)continue ; -/* Watch for unexpected holes punched in the memmap */ -if (!memmap_valid_within (pfn, page, zone)) -continue ; -if (page_zone (page) != zone)continue ;
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 9/13 arm, arm64: move free_unused_memmap() to generic mm
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
ARM and ARM64 free unused parts of the memory map just before the initialization of the page allocator. To allow holes in the memory map both architectures overload pfn_valid() and define HAVE_ARCH_PFN_VALID.
Allowing holes in the memory map for FLATMEM may be useful for small machines, such as ARC and m68k and will enable those architectures to cease using DISCONTIGMEM and still support more than one memory bank.
Move the functions that free unused memory map to generic mm and enable them in case HAVE_ARCH_PFN_VALID=y.
--- arch/Kconfig | 3 ++ arch/arm/Kconfig | 4 +-- arch/arm/mm/init.c | 78 ------------------------------------------ arch/arm64/Kconfig | 4 +-- arch/arm64/mm/init.c | 68 ------------------------------------- mm/memblock.c | 80 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 85 insertions(+), 152 deletions(-)
arch/Kconfig +3 -0
@@ -1028,6 +1028,9 @@ config HAVE_STATIC_CALL_INLINE bool depends on HAVE_STATIC_CALL +config HAVE_ARCH_PFN_VALID + bool + source "kernel/gcov/Kconfig" source "scripts/gcc-plugins/Kconfig"
arch/arm/Kconfig +1 -3
@@ -68,6 +68,7 @@ config ARM select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU select HAVE_ARCH_MMAP_RND_BITS if MMU + select HAVE_ARCH_PFN_VALID select HAVE_ARCH_SECCOMP select HAVE_ARCH_SECCOMP_FILTER if AEABI && !OABI_COMPAT select HAVE_ARCH_THREAD_STRUCT_WHITELIST
@@ -1488,9 +1489,6 @@ config ARCH_SPARSEMEM_ENABLE bool select SPARSEMEM_STATIC if SPARSEMEM -config HAVE_ARCH_PFN_VALID - def_bool y - config HIGHMEM bool "High Memory Support" depends on MMU
arch/arm/mm/init.c +0 -78
90 lines not on this page · raw message
arch/arm64/Kconfig +1 -3
@@ -138,6 +138,7 @@ config ARM64 select HAVE_ARCH_KGDB select HAVE_ARCH_MMAP_RND_BITS select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT + select HAVE_ARCH_PFN_VALID select HAVE_ARCH_PREL32_RELOCATIONS select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_STACKLEAK
@@ -1021,9 +1022,6 @@ config ARCH_SELECT_MEMORY_MODEL config ARCH_FLATMEM_ENABLE def_bool !NUMA -config HAVE_ARCH_PFN_VALID - def_bool y - config HW_PERF_EVENTS def_bool y depends on ARM_PMU
arch/arm64/mm/init.c +0 -68
80 lines not on this page · raw message
mm/memblock.c +80 -0
92 lines not on this page · raw message
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 10/13 arc: use FLATMEM with freeing of unused memory map instead of DISCONTIGMEM
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
Currently ARC uses DISCONTIGMEM to cope with sparse physical memory address space on systems with 2 memory banks. While DISCONTIGMEM avoids wasting memory on unpopulated memory map, it adds both memory and CPU overhead relatively to FLATMEM. Moreover, DISCONTINGMEM is generally considered deprecated.
The obvious replacement for DISCONTIGMEM would be SPARSEMEM, but it is also less efficient than FLATMEM in pfn_to_page() and page_to_pfn() conversions. Besides it requires tuning of SECTION_SIZE which is not trivial for possible ARC memory configuration.
Since the memory map for both banks is always allocated from the "lowmem" bank, it is possible to use FLATMEM for two-bank configuration and simply free the unused hole in the memory map. All is required for that is to provide ARC-specific pfn_valid() that will take into account actual physical memory configuration and define HAVE_ARCH_PFN_VALID.
The resulting kernel image configured with defconfig + HIGHMEM=y is smaller:
$ size a/vmlinux b/vmlinux text data bss dec hex filename 4673503 1245456 279756 6198715 5e95bb a/vmlinux 4658706 1246864 279756 6185326 5e616e b/vmlinux
$ ./scripts/bloat-o-meter a/vmlinux b/vmlinux add/remove: 28/30 grow/shrink: 42/399 up/down: 10986/-29025 (-18039) ... Total: Before=4709315, After=4691276, chg -0.38%
Booting nSIM with haps_ns.dts results in the following memory usage reports:
a:
Memory: 1559104K/1572864K available (3531K kernel code, 595K rwdata, 752K rodata, 136K init, 275K bss, 13760K reserved, 0K cma-reserved, 1048576K highmem)
b:
Memory: 1559112K/1572864K available (3519K kernel code, 594K rwdata, 752K rodata, 136K init, 280K bss, 13752K reserved, 0K cma-reserved, 1048576K highmem)
--- arch/arc/Kconfig | 3 ++- arch/arc/include/asm/page.h | 20 +++++++++++++++++--- arch/arc/mm/init.c | 29 ++++++++++++++++++++++------- 3 files changed, 41 insertions(+), 11 deletions(-)
arch/arc/Kconfig +2 -1
@@ -67,6 +67,7 @@ config GENERIC_CSUM config ARCH_DISCONTIGMEM_ENABLE def_bool n + depends on BROKEN config ARCH_FLATMEM_ENABLE def_bool y
@@ -506,7 +507,7 @@ config LINUX_RAM_BASE config HIGHMEM bool "High Memory Support" - select ARCH_DISCONTIGMEM_ENABLE + select HAVE_ARCH_PFN_VALID help With ARC 2G:2G address split, only upper 2G is directly addressable by kernel. Enable this to potentially allow access to rest of 2G and PAE
arch/arc/include/asm/page.h +17 -3
@@ -82,11 +82,25 @@ typedef pte_t * pgtable_t;*/ #define virt_to_pfn (kaddr) (__pa(kaddr) >> PAGE_SHIFT) -#define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_RAM_BASE) +/* +* When HIGHMEM is enabled we have holes in the memory map so we need +* pfn_valid() that takes into account the actual extents of the physical +* memory +*/ +#ifdef CONFIG_HIGHMEM + +extern unsigned long arch_pfn_offset; +#define ARCH_PFN_OFFSET arch_pfn_offset + +extern int pfn_valid (unsigned long pfn); +#define pfn_valid pfn_valid -#ifdef CONFIG_FLATMEM +#else /* CONFIG_HIGHMEM */ + +#define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_RAM_BASE)#define pfn_valid (pfn) (((pfn) - ARCH_PFN_OFFSET) < max_mapnr) -#endif + +#endif /* CONFIG_HIGHMEM */ /* * __pa, __va, virt_to_page (ALERT: deprecated, don't use them)
arch/arc/mm/init.c +22 -7
@@ -28,6 +28,8 @@ static unsigned long low_mem_sz;static unsigned long min_high_pfn, max_high_pfn;static phys_addr_t high_mem_start;static phys_addr_t high_mem_sz; +unsigned long arch_pfn_offset; +EXPORT_SYMBOL (arch_pfn_offset);#endif #ifdef CONFIG_DISCONTIGMEM
@@ -98,16 +100,11 @@ void __init setup_arch_memory(void) init_mm.brk = (unsigned long )_end;/* first page of system - kernel .vector starts here */ - min_low_pfn =ARCH_PFN_OFFSET ; + min_low_pfn =virt_to_pfn (CONFIG_LINUX_RAM_BASE );/* Last usable page of low mem */ max_low_pfn = max_pfn =PFN_DOWN (low_mem_start + low_mem_sz); -#ifdef CONFIG_FLATMEM -/* pfn_valid() uses this */ - max_mapnr = max_low_pfn - min_low_pfn; -#endif -/*------------- bootmem allocator setup -----------------------*/ /*
@@ -153,7 +150,9 @@ void __init setup_arch_memory(void)* DISCONTIGMEM in turns requires multiple nodes. node 0 above is * populated with normal memory zone while node 1 only has highmem */ +#ifdef CONFIG_DISCONTIGMEM node_set_online (1 ); +#endif min_high_pfn =PFN_DOWN (high_mem_start); max_high_pfn =PFN_DOWN (high_mem_start + high_mem_sz);
@@ -161,8 +160,15 @@ void __init setup_arch_memory(void) max_zone_pfn[ZONE_HIGHMEM ] = min_low_pfn; high_memory = (void *)(min_high_pfn <<PAGE_SHIFT ); + + arch_pfn_offset =min (min_low_pfn, min_high_pfn);kmap_init (); -#endif + +#else /* CONFIG_HIGHMEM */ +/* pfn_valid() uses this when FLATMEM=y and HIGHMEM=n */ + max_mapnr = max_low_pfn - min_low_pfn; + +#endif /* CONFIG_HIGHMEM */ free_area_init (max_zone_pfn); }
@@ -190,3 +196,12 @@ void __init mem_init(void)highmem_init ();mem_init_print_info (NULL ); } + +#ifdef CONFIG_HIGHMEM +int pfn_valid (unsigned long pfn) +{ +return (pfn >= min_high_pfn && pfn <= max_high_pfn) || + (pfn >= min_low_pfn && pfn <= max_low_pfn); +} +EXPORT_SYMBOL (pfn_valid); +#endif
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 11/13 m68k/mm: make node data and node setup depend on CONFIG_DISCONTIGMEM
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
The pg_data_t node structures and their initialization currently depends on !CONFIG_SINGLE_MEMORY_CHUNK. Since they are required only for DISCONTIGMEM make this dependency explicit and replace usage of CONFIG_SINGLE_MEMORY_CHUNK with CONFIG_DISCONTIGMEM where appropriate.
The CONFIG_SINGLE_MEMORY_CHUNK was implicitly disabled on the ColdFire MMU variant, although it always presumed a single memory bank. As there is no actual need for DISCONTIGMEM in this case, make sure that ColdFire MMU systems set CONFIG_SINGLE_MEMORY_CHUNK to 'y'.
--- arch/m68k/Kconfig.cpu | 6 +++--- arch/m68k/include/asm/page_mm.h | 2 +- arch/m68k/mm/init.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
arch/m68k/Kconfig.cpu +3 -3
@@ -20,6 +20,7 @@ choice config M68KCLASSIC bool "Classic M68K CPU family support" + select NEED_MULTIPLE_NODES if DISCONTIGMEM config COLDFIRE bool "Coldfire CPU family support"
@@ -373,8 +374,7 @@ config RMW_INSNS config SINGLE_MEMORY_CHUNK bool "Use one physical chunk of memory only" if ADVANCED && !SUN3 depends on MMU - default y if SUN3 - select NEED_MULTIPLE_NODES + default y if SUN3 || MMU_COLDFIRE help Ignore all but the first contiguous chunk of physical memory for VM purposes. This will save a few bytes kernel size and may speed up
@@ -406,7 +406,7 @@ config M68K_L2_CACHE config NODES_SHIFT int default "3" - depends on !SINGLE_MEMORY_CHUNK + depends on DISCONTIGMEM config CPU_HAS_NO_BITFIELDS bool
arch/m68k/include/asm/page_mm.h +1 -1
@@ -126,7 +126,7 @@ static inline void *__va(unsigned long x)extern int m68k_virt_to_node_shift; -#ifdef CONFIG_SINGLE_MEMORY_CHUNK +#ifndef CONFIG_DISCONTIGMEM #define __virt_to_node (addr) (&pg_data_map[0])#else extern struct pglist_data *pg_data_table[];
arch/m68k/mm/init.c +2 -2
@@ -47,14 +47,14 @@ EXPORT_SYMBOL(pg_data_map);int m68k_virt_to_node_shift; -#ifndef CONFIG_SINGLE_MEMORY_CHUNK +#ifdef CONFIG_DISCONTIGMEM pg_data_t *pg_data_table[65 ];EXPORT_SYMBOL (pg_data_table);#endif void __init m68k_setup_node (int node) { -#ifndef CONFIG_SINGLE_MEMORY_CHUNK +#ifdef CONFIG_DISCONTIGMEM struct m68k_mem_info *info = m68k_memory + node;int i, end;
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 12/13 m68k/mm: enable use of generic memory_model.h for !DISCONTIGMEM
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
The pg_data_map and pg_data_table arrays as well as page_to_pfn() and pfn_to_page() are required only for DISCONTIGMEM. Other memory models can use the generic definitions in asm-generic/memory_model.h.
--- arch/m68k/include/asm/page.h | 2 ++ arch/m68k/include/asm/page_mm.h | 5 +++++ arch/m68k/include/asm/virtconvert.h | 2 +- arch/m68k/mm/init.c | 6 +++--- 4 files changed, 11 insertions(+), 4 deletions(-)
arch/m68k/include/asm/page.h +2 -0
@@ -62,8 +62,10 @@ extern unsigned long _ramend;#include <asm/page_no.h> #endif +#ifdef CONFIG_DISCONTIGMEM #define __phys_to_pfn (paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))#define __pfn_to_phys (pfn) PFN_PHYS(pfn) +#endif #include <asm-generic/getorder.h>
arch/m68k/include/asm/page_mm.h +5 -0
@@ -153,6 +153,7 @@ static inline __attribute_const__ int __virt_to_node_shift(void)pfn_to_virt (page_to_pfn (page)); \ }) +#ifdef CONFIG_DISCONTIGMEM #define pfn_to_page (pfn) ({ \ unsigned long __pfn = (pfn); \ struct pglist_data *pgdat; \
@@ -165,6 +166,10 @@ static inline __attribute_const__ int __virt_to_node_shift(void) pgdat = &pg_data_map[page_to_nid (__p)]; \ ((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn; \ }) +#else +#define ARCH_PFN_OFFSET (m68k_memory[0].addr) +#include <asm-generic/memory_model.h> +#endif #define virt_addr_valid (kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)#define pfn_valid (pfn) virt_addr_valid(pfn_to_virt(pfn))
arch/m68k/include/asm/virtconvert.h +1 -1
@@ -31,7 +31,7 @@ static inline void *phys_to_virt(unsigned long address)/* Permanent address of a page. */ #if defined(CONFIG_MMU ) && defined(CONFIG_SINGLE_MEMORY_CHUNK )#define page_to_phys (page) \ - __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT)) + __pa(PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT))#else #define page_to_phys (page) (page_to_pfn(page) << PAGE_SHIFT)#endif
arch/m68k/mm/init.c +3 -3
@@ -42,12 +42,12 @@ EXPORT_SYMBOL(empty_zero_page);#ifdef CONFIG_MMU -pg_data_t pg_data_map[MAX_NUMNODES ]; -EXPORT_SYMBOL (pg_data_map); -int m68k_virt_to_node_shift;#ifdef CONFIG_DISCONTIGMEM +pg_data_t pg_data_map[MAX_NUMNODES ]; +EXPORT_SYMBOL (pg_data_map); +pg_data_t *pg_data_table[65 ];EXPORT_SYMBOL (pg_data_table);#endif
Signature · 1 line
2.28.0
Mike Rapoport
maintainerPATCH 13/13 m68k: deprecate DISCONTIGMEM
In reply to Mike RapoportFrom: Mike Rapoport <[email protected]>
DISCONTIGMEM was intended to provide more efficient support for systems with holes in their physical address space that FLATMEM did.
Yet, it's overhead in terms of the memory consumption seems to overweight the savings on the unused memory map.
For a ARAnyM system with 16 MBytes of FastRAM configured, the memory usage reported after page allocator initialization is
Memory: 23828K/30720K available (3206K kernel code, 535K rwdata, 936K rodata, 768K init, 193K bss, 6892K reserved, 0K cma-reserved)
and with DISCONTIGMEM disabled and with relatively large hole in the memory map it is:
Memory: 23864K/30720K available (3197K kernel code, 516K rwdata, 936K rodata, 764K init, 179K bss, 6856K reserved, 0K cma-reserved)
Moreover, since m68k already has custom pfn_valid() it is possible to define HAVE_ARCH_PFN_VALID to enable freeing of unused memory map. The minimal size of a hole that can be freed should not be less than MAX_ORDER_NR_PAGES so to achieve more substantial memory savings let m68k also define custom FORCE_MAX_ZONEORDER.
With FORCE_MAX_ZONEORDER set to 9 memory usage becomes:
Memory: 23880K/30720K available (3197K kernel code, 516K rwdata, 936K rodata, 764K init, 179K bss, 6840K reserved, 0K cma-reserved)
--- arch/m68k/Kconfig.cpu | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
arch/m68k/Kconfig.cpu +25 -1
@@ -21,6 +21,7 @@ choice config M68KCLASSIC bool "Classic M68K CPU family support" select NEED_MULTIPLE_NODES if DISCONTIGMEM + select HAVE_ARCH_PFN_VALID if FLATMEM && !SINGLE_MEMORY_CHUNK config COLDFIRE bool "Coldfire CPU family support"
@@ -378,11 +379,34 @@ config SINGLE_MEMORY_CHUNK help Ignore all but the first contiguous chunk of physical memory for VM purposes. This will save a few bytes kernel size and may speed up - some operations. Say N if not sure. + some operations. + When this option os set to N, you may want to lower "Maximum zone + order" to save memory that could be wasted for unused memory map. + Say N if not sure. config ARCH_DISCONTIGMEM_ENABLE + depends on BROKEN def_bool MMU && !SINGLE_MEMORY_CHUNK +config FORCE_MAX_ZONEORDER + int "Maximum zone order" if ADVANCED + depends on !SINGLE_MEMORY_CHUNK + default "11" + help + The kernel memory allocator divides physically contiguous memory + blocks into "zones", where each zone is a power of two number of + pages. This option selects the largest power of two that the kernel + keeps in the memory allocator. If you need to allocate very large + blocks of physically contiguous memory, then you may need to + increase this value. + + For systems that have holes in their physical address space this + value also defines the minimal size of the hole that allows + freeing unused memory map. + + This config option is actually maximum order plus one. For example, + a value of 11 means that the largest free memory block is 2^10 pages. + config 060_WRITETHROUGH bool "Use write-through caching for 68060 supervisor accesses" depends on ADVANCED && M68060
Signature · 1 line
2.28.0
Geert Uytterhoeven
maintainerRe: [PATCH 11/13] m68k/mm: make node data and node setup depend on CONFIG_DISCONTIGMEM
In reply to Mike RapoportHi Mike,
Quoted 7 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
The
pg_data_tnode structures and their initialization currently depends on !CONFIG_SINGLE_MEMORY_CHUNK. Since they are required only for DISCONTIGMEM make this dependency explicit and replace usage ofCONFIG_SINGLE_MEMORY_CHUNKwithCONFIG_DISCONTIGMEMwhere appropriate.
Quoted 6 lines
The
CONFIG_SINGLE_MEMORY_CHUNKwas implicitly disabled on the ColdFire MMU variant, although it always presumed a single memory bank. As there is no actual need for DISCONTIGMEM in this case, make sure that ColdFire MMU systems setCONFIG_SINGLE_MEMORY_CHUNKto 'y'.Signed-off-by Mike Rapoport <[email protected]>
Thanks for your patch!
Quoted 5 lines
--- arch/m68k/Kconfig.cpu | 6 +++--- arch/m68k/include/asm/page_mm.h | 2 +- arch/m68k/mm/init.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
Is there any specific reason you didn't convert the checks for CONFIG_SINGLE_MEMORY_CHUNK in arch/m68k/kernel/setup_mm.c and arch/m68k/include/asm/virtconvert.h?
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Mike Rapoport
maintainerRe: [PATCH 11/13] m68k/mm: make node data and node setup depend on CONFIG_DISCONTIGMEM
Hi Geert,
Quoted 19 lines · Geert Uytterhoeven
Hi Mike,
Quoted 7 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
The
pg_data_tnode structures and their initialization currently depends on !CONFIG_SINGLE_MEMORY_CHUNK. Since they are required only for DISCONTIGMEM make this dependency explicit and replace usage ofCONFIG_SINGLE_MEMORY_CHUNKwithCONFIG_DISCONTIGMEMwhere appropriate.Quoted 6 lines
The
CONFIG_SINGLE_MEMORY_CHUNKwas implicitly disabled on the ColdFire MMU variant, although it always presumed a single memory bank. As there is no actual need for DISCONTIGMEM in this case, make sure that ColdFire MMU systems setCONFIG_SINGLE_MEMORY_CHUNKto 'y'.Signed-off-by Mike Rapoport <[email protected]>Thanks for your patch!
Quoted 8 lines
Quoted 5 lines
--- arch/m68k/Kconfig.cpu | 6 +++--- arch/m68k/include/asm/page_mm.h | 2 +- arch/m68k/mm/init.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)Is there any specific reason you didn't convert the checks for
CONFIG_SINGLE_MEMORY_CHUNKinarch/m68k/kernel/setup_mm.c
In arch/m68k/kernel/setup_mm.c the CONFIG_SINGLE_MEMORY_CHUNK is needed for the case when a system has two banks, the kernel is loaded into the second bank and so the first bank cannot be used as normal memory. It does not matter what memory model will be used in this case.
Quoted 1 line
and
arch/m68k/include/asm/virtconvert.h?
I remember I had build errors and troubles with include file dependencies if I changed it there, but I might be mistaken. I'll recheck again.
Quoted 10 lines
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH 11/13] m68k/mm: make node data and node setup depend on CONFIG_DISCONTIGMEM
Hi Mike,
Quoted 26 lines · Mike Rapoport
Hi Geert,
Quoted 23 lines · Geert Uytterhoeven
Hi Mike,
Quoted 7 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
The
pg_data_tnode structures and their initialization currently depends on !CONFIG_SINGLE_MEMORY_CHUNK. Since they are required only for DISCONTIGMEM make this dependency explicit and replace usage ofCONFIG_SINGLE_MEMORY_CHUNKwithCONFIG_DISCONTIGMEMwhere appropriate.Quoted 6 lines
The
CONFIG_SINGLE_MEMORY_CHUNKwas implicitly disabled on the ColdFire MMU variant, although it always presumed a single memory bank. As there is no actual need for DISCONTIGMEM in this case, make sure that ColdFire MMU systems setCONFIG_SINGLE_MEMORY_CHUNKto 'y'.Signed-off-by Mike Rapoport <[email protected]>Thanks for your patch!
Quoted 5 lines
--- arch/m68k/Kconfig.cpu | 6 +++--- arch/m68k/include/asm/page_mm.h | 2 +- arch/m68k/mm/init.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
Quoted 6 lines
Quoted 2 lines
Is there any specific reason you didn't convert the checks for
CONFIG_SINGLE_MEMORY_CHUNKinarch/m68k/kernel/setup_mm.cIn
arch/m68k/kernel/setup_mm.ctheCONFIG_SINGLE_MEMORY_CHUNKis needed for the case when a system has two banks, the kernel is loaded into the second bank and so the first bank cannot be used as normal memory. It does not matter what memory model will be used in this case.
That case used to be detected just fine at run time (by dint of the second memory chunk having an address below the first; the chunk the kernel resides in is always listed first), even without using CONFIG_SINGLE_MEMORY_CHUNK.
Unless you changed that behaviour (and I see nothing in your patch that would indicate that), this is still true.
Converting the check as Geert suggested, without also adding a test for out-of-order memory bank addresses, would implicitly treat DISCONTIGMEM as SINGLE_MEMORY_CHUNK, regardless of bank ordering. I don't think that is what we really want?
Cheers,
Michael
Quoted 17 lines
Quoted 2 lines
and
arch/m68k/include/asm/virtconvert.h?I remember I had build errors and troubles with include file dependencies if I changed it there, but I might be mistaken. I'll recheck again.
Quoted 10 lines
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Mike Rapoport
maintainerRe: [PATCH 11/13] m68k/mm: make node data and node setup depend on CONFIG_DISCONTIGMEM
Quoted 37 lines · Michael Schmitz
Hi Mike,
Quoted 26 lines · Mike Rapoport
Hi Geert,
Quoted 23 lines · Geert Uytterhoeven
Hi Mike,
Quoted 7 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
The
pg_data_tnode structures and their initialization currently depends on !CONFIG_SINGLE_MEMORY_CHUNK. Since they are required only for DISCONTIGMEM make this dependency explicit and replace usage ofCONFIG_SINGLE_MEMORY_CHUNKwithCONFIG_DISCONTIGMEMwhere appropriate.Quoted 6 lines
The
CONFIG_SINGLE_MEMORY_CHUNKwas implicitly disabled on the ColdFire MMU variant, although it always presumed a single memory bank. As there is no actual need for DISCONTIGMEM in this case, make sure that ColdFire MMU systems setCONFIG_SINGLE_MEMORY_CHUNKto 'y'.Signed-off-by Mike Rapoport <[email protected]>Thanks for your patch!
Quoted 5 lines
--- arch/m68k/Kconfig.cpu | 6 +++--- arch/m68k/include/asm/page_mm.h | 2 +- arch/m68k/mm/init.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)Quoted 6 lines
Quoted 2 lines
Is there any specific reason you didn't convert the checks for
CONFIG_SINGLE_MEMORY_CHUNKinarch/m68k/kernel/setup_mm.cIn
arch/m68k/kernel/setup_mm.ctheCONFIG_SINGLE_MEMORY_CHUNKis needed for the case when a system has two banks, the kernel is loaded into the second bank and so the first bank cannot be used as normal memory. It does not matter what memory model will be used in this case.
Quoted 3 lines
That case used to be detected just fine at run time (by dint of the second memory chunk having an address below the first; the chunk the kernel resides in is always listed first), even without using
CONFIG_SINGLE_MEMORY_CHUNK.
Right, CONFIG_SINGLE_MEMORY_CHUNK in arch/m68k/kernel/setup_mm.c is used to force using a single bank of memory regardless of run time detection.
Quoted 7 lines
Unless you changed that behaviour (and I see nothing in your patch that would indicate that), this is still true.
Converting the check as Geert suggested, without also adding a test for out-of-order memory bank addresses, would implicitly treat DISCONTIGMEM as
SINGLE_MEMORY_CHUNK, regardless of bank ordering. I don't think that is what we really want?
It is in a way the case now when !SINGLE_MEMORY_CHUNK == DISCONTIGMEM. So forcing SIGNLE_MEMORY_CHUNK at compile time would also mean forcing FLATMEM.
After these changes I think SINGLE_MEMORY_CHUNK is not needed at all.
Quoted 21 lines
Cheers,
Michael
Quoted 16 lines
Quoted 2 lines
and
arch/m68k/include/asm/virtconvert.h?I remember I had build errors and troubles with include file dependencies if I changed it there, but I might be mistaken. I'll recheck again.
Quoted 10 lines
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Signature · 2 lines
Sincerely yours, Mike.
Mike Rapoport
maintainerRe: [PATCH 11/13] m68k/mm: make node data and node setup depend on CONFIG_DISCONTIGMEM
In reply to Mike RapoportQuoted 36 lines · Mike Rapoport
Hi Geert,
Quoted 19 lines · Geert Uytterhoeven
Hi Mike,
Quoted 7 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
The
pg_data_tnode structures and their initialization currently depends on !CONFIG_SINGLE_MEMORY_CHUNK. Since they are required only for DISCONTIGMEM make this dependency explicit and replace usage ofCONFIG_SINGLE_MEMORY_CHUNKwithCONFIG_DISCONTIGMEMwhere appropriate.Quoted 6 lines
The
CONFIG_SINGLE_MEMORY_CHUNKwas implicitly disabled on the ColdFire MMU variant, although it always presumed a single memory bank. As there is no actual need for DISCONTIGMEM in this case, make sure that ColdFire MMU systems setCONFIG_SINGLE_MEMORY_CHUNKto 'y'.Signed-off-by Mike Rapoport <[email protected]>Thanks for your patch!
Quoted 8 lines
Quoted 5 lines
--- arch/m68k/Kconfig.cpu | 6 +++--- arch/m68k/include/asm/page_mm.h | 2 +- arch/m68k/mm/init.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)Is there any specific reason you didn't convert the checks for
CONFIG_SINGLE_MEMORY_CHUNKinarch/m68k/kernel/setup_mm.cIn
arch/m68k/kernel/setup_mm.ctheCONFIG_SINGLE_MEMORY_CHUNKis needed for the case when a system has two banks, the kernel is loaded into the second bank and so the first bank cannot be used as normal memory. It does not matter what memory model will be used in this case.
Quoted 5 lines
Quoted 1 line
and
arch/m68k/include/asm/virtconvert.h?I remember I had build errors and troubles with include file dependencies if I changed it there, but I might be mistaken. I'll recheck again.
There indeed was an issue with SINGLE_MEMORY_CHUNK that selected NEED_MULTIPLE_NODES for some reason.
With that fixed and removed CONFIG_SINGLE_MEMORY_CHUNK in arch/m68k/include/asm/virtconvert.h I'm going to send v2 soon.
I've kept CONFIG_SINGLE_MEMORY_CHUNK for now for backwards compatibility with the plan to remove it along with DISCONTIGMEM.
Quoted 14 lines
Quoted 10 lines
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus TorvaldsSignature · 2 lines
Sincerely yours, Mike.
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH 07/13] ia64: make SPARSEMEM default and disable DISCONTIGMEM
In reply to Mike RapoportQuoted 10 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
SPARSEMEM memory model suitable for systems with large holes in their phyiscal memory layout. With
SPARSEMEM_VMEMMAPenabled it providespfn_to_page()andpage_to_pfn()as fast as FLATMEM.Make it the default memory model for IA-64 and disable DISCONTIGMEM which is considered obsolete for quite some time.
Signed-off-by Mike Rapoport <[email protected]>
This patch results in
include/linux/mmzone.h:1156:2: error: #error Allocator MAX_ORDER exceeds SECTION_SIZE
1156 | #error Allocator MAX_ORDER exceeds SECTION_SIZE
when building ia64:defconfig.
Also, PAGE_SHIFT is not defined, though I don't know if that is related.
Reverting the patch fixes the problem for me.
Guenter
---
bisect log:
# bad: [3cc2bd440f2171f093b3a8480a4b54d8c270ed38] Add linux-next specific files for 20201211 # good: [0477e92881850d44910a7e94fc2c46f96faa131f] Linux 5.10-rc7
git bisect start 'HEAD' 'v5.10-rc7'
# good: [0a701401d4e29d9e73f0f3cc02179fc6c9191646] Merge remote-tracking branch 'crypto/master' git bisect good 0a701401d4e29d9e73f0f3cc02179fc6c9191646
# good: [6fd39ad603b113e9c68180b9138084710c036e34] Merge remote-tracking branch 'spi/for-next' git bisect good 6fd39ad603b113e9c68180b9138084710c036e34
# good: [c96b2eec436e87b8c673213b203559bed9e551b9] Merge remote-tracking branch 'vfio/next' git bisect good c96b2eec436e87b8c673213b203559bed9e551b9
# good: [4f2e7f6a2ce4e621b77e59c8763549fa8bee7b4b] Merge remote-tracking branch 'gpio/for-next' git bisect good 4f2e7f6a2ce4e621b77e59c8763549fa8bee7b4b
# good: [5ee06b21caaeb37a1ff5143e8ce91b376fe73dc2] swiotlb.h: add "inline" to swiotlb_adjust_size git bisect good 5ee06b21caaeb37a1ff5143e8ce91b376fe73dc2
# bad: [46aa09d885ce303efd6444def783ec575a5b57ee] mm, page_poison: remove CONFIG_PAGE_POISONING_ZERO git bisect bad 46aa09d885ce303efd6444def783ec575a5b57ee
# good: [3b77356d530bfd93e2450c063718292aa435eede] mm: mmap_lock: add tracepoints around lock acquisition git bisect good 3b77356d530bfd93e2450c063718292aa435eede
# bad: [e0287fb91c006d12bed9e6fbfc7fe661ad7f9647] mm,hwpoison: disable pcplists before grabbing a refcount git bisect bad e0287fb91c006d12bed9e6fbfc7fe661ad7f9647
# bad: [94d171d065be406a2407f0d723afe14c05526283] ia64: make SPARSEMEM default and disable DISCONTIGMEM git bisect bad 94d171d065be406a2407f0d723afe14c05526283
# good: [7499e1e91e18a285274e9b761ba2abf21e4343fa] mm/vmalloc: use free_vm_area() if an allocation fails git bisect good 7499e1e91e18a285274e9b761ba2abf21e4343fa
# good: [eba50fff503fa6d6e20679509a1a960c3e003d22] lib/test_kasan.c: add workqueue test case git bisect good eba50fff503fa6d6e20679509a1a960c3e003d22
# good: [e343d6ff702aaae6181448a38ff85cf201b011ba] ia64: remove 'ifdef CONFIG_ZONE_DMA32' statements git bisect good e343d6ff702aaae6181448a38ff85cf201b011ba
# good: [a0bfb938ae29239a3f13f6a6a4ef41c3c7f0c84c] ia64: split virtual map initialization out of paging_init() git bisect good a0bfb938ae29239a3f13f6a6a4ef41c3c7f0c84c
# good: [0e791e5138cde9b96d34ba68136fd26bb97f81e5] ia64: forbid using VIRTUAL_MEM_MAP with FLATMEM git bisect good 0e791e5138cde9b96d34ba68136fd26bb97f81e5
# first bad commit: [94d171d065be406a2407f0d723afe14c05526283] ia64: make SPARSEMEM default and disable DISCONTIGMEM
Mike Rapoport
maintainerRe: [PATCH 07/13] ia64: make SPARSEMEM default and disable DISCONTIGMEM
Quoted 12 lines · Guenter Roeck
Quoted 10 lines · Mike Rapoport
From: Mike Rapoport <[email protected]>
SPARSEMEM memory model suitable for systems with large holes in their phyiscal memory layout. With
SPARSEMEM_VMEMMAPenabled it providespfn_to_page()andpage_to_pfn()as fast as FLATMEM.Make it the default memory model for IA-64 and disable DISCONTIGMEM which is considered obsolete for quite some time.
Signed-off-by Mike Rapoport <[email protected]>
Quoted 8 lines
This patch results in
include/linux/mmzone.h:1156:2: error: #error AllocatorMAX_ORDERexceedsSECTION_SIZE
1156 | #error AllocatorMAX_ORDERexceedsSECTION_SIZEwhen building ia64:defconfig.
Also,
PAGE_SHIFTis not defined, though I don't know if that is related.
This is realated as sparesemem.h on ia64 needs PAGE_SHIFT for SECTION_SIZE and it is not there.
This fixes the build for me (the patch is vs v5.10-rc7-mmots-2020-12-11-14-43)
arch/ia64/include/asm/sparsemem.h +2 -0
@@ -3,6 +3,8 @@#define _ASM_IA64_SPARSEMEM_H#ifdef CONFIG_SPARSEMEM +#include <asm/page.h> +/* * SECTION_SIZE_BITS 2^N: how big each section will be * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
Quoted 40 lines
Reverting the patch fixes the problem for me.
Guenter
---
bisect log:# bad: [
3cc2bd440f2171f093b3a8480a4b54d8c270ed38] Add linux-next specific files for 20201211 # good: [0477e92881850d44910a7e94fc2c46f96faa131f] Linux 5.10-rc7
git bisect start 'HEAD' 'v5.10-rc7'
# good: [0a701401d4e29d9e73f0f3cc02179fc6c9191646] Merge remote-tracking branch 'crypto/master' git bisect good0a701401d4e29d9e73f0f3cc02179fc6c9191646
# good: [6fd39ad603b113e9c68180b9138084710c036e34] Merge remote-tracking branch 'spi/for-next' git bisect good6fd39ad603b113e9c68180b9138084710c036e34
# good: [c96b2eec436e87b8c673213b203559bed9e551b9] Merge remote-tracking branch 'vfio/next' git bisect goodc96b2eec436e87b8c673213b203559bed9e551b9
# good: [4f2e7f6a2ce4e621b77e59c8763549fa8bee7b4b] Merge remote-tracking branch 'gpio/for-next' git bisect good4f2e7f6a2ce4e621b77e59c8763549fa8bee7b4b
# good: [5ee06b21caaeb37a1ff5143e8ce91b376fe73dc2]swiotlb.h: add "inline" toswiotlb_adjust_sizegit bisect good5ee06b21caaeb37a1ff5143e8ce91b376fe73dc2
# bad: [46aa09d885ce303efd6444def783ec575a5b57ee] mm,page_poison: removeCONFIG_PAGE_POISONING_ZEROgit bisect bad46aa09d885ce303efd6444def783ec575a5b57ee
# good: [3b77356d530bfd93e2450c063718292aa435eede] mm:mmap_lock: add tracepoints around lock acquisition git bisect good3b77356d530bfd93e2450c063718292aa435eede
# bad: [e0287fb91c006d12bed9e6fbfc7fe661ad7f9647] mm,hwpoison: disable pcplists before grabbing a refcount git bisect bade0287fb91c006d12bed9e6fbfc7fe661ad7f9647
# bad: [94d171d065be406a2407f0d723afe14c05526283] ia64: make SPARSEMEM default and disable DISCONTIGMEM git bisect bad94d171d065be406a2407f0d723afe14c05526283
# good: [7499e1e91e18a285274e9b761ba2abf21e4343fa] mm/vmalloc: usefree_vm_area()if an allocation fails git bisect good7499e1e91e18a285274e9b761ba2abf21e4343fa
# good: [eba50fff503fa6d6e20679509a1a960c3e003d22]lib/test_kasan.c: add workqueue test case git bisect goodeba50fff503fa6d6e20679509a1a960c3e003d22
# good: [e343d6ff702aaae6181448a38ff85cf201b011ba] ia64: remove 'ifdefCONFIG_ZONE_DMA32' statements git bisect goode343d6ff702aaae6181448a38ff85cf201b011ba
# good: [a0bfb938ae29239a3f13f6a6a4ef41c3c7f0c84c] ia64: split virtual map initialization out ofpaging_init()git bisect gooda0bfb938ae29239a3f13f6a6a4ef41c3c7f0c84c
# good: [0e791e5138cde9b96d34ba68136fd26bb97f81e5] ia64: forbid usingVIRTUAL_MEM_MAPwith FLATMEM git bisect good0e791e5138cde9b96d34ba68136fd26bb97f81e5# first bad commit: [94d171d065be406a2407f0d723afe14c05526283] ia64: make SPARSEMEM default and disable DISCONTIGMEM
Signature · 2 lines
Sincerely yours, Mike.