arc: add sparsemem support
v2 cover arc: add sparsemem support
From: Mike Rapoport <[email protected]>
Hi,
It took me a while to get back to it, but better late than never :)
This patch adds SPARSEMEM support as an alternative to DISCONTIGMEM in the case when there are two DRAM banks populated.
I've verified that it boots on nsim, but I could not find a way to make nsim emulate two memory banks.
There is slight improvement in the resulting kernel size for nsim_700_defconfig with CONFIG_HIGHMEM=y.
If sparse actually works on a system with 2 DRAM banks and does not introduce performance regression, I suggest to update this patch to replace DISCONTIGMEM with SPARSEMEM on arc.
$ size discontig/vmlinux sparse/vmlinux text data bss dec hex filename 3894379 1093092 244932 5232403 4fd713 discontig/vmlinux 3879040 1093964 244956 5217960 4f9ea8 sparse/vmlinux
$ ./scripts/bloat-o-meter ~/tmp/arc/discontig/vmlinux ~/tmp/arc/sparse/vmlinux add/remove: 35/23 grow/shrink: 35/384 up/down: 8110/-26438 (-18328) ... Total: Before=4282217, After=4263889, chg -0.43%
Mike Rapoport (1):
arc: add sparsemem support
arch/arc/Kconfig | 10 ++++++++++ arch/arc/include/asm/sparsemem.h | 13 +++++++++++++ arch/arc/mm/init.c | 7 ++++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 arch/arc/include/asm/sparsemem.h
Signature · 1 line
2.26.2
PATCH v2 1/1 arc: add sparsemem support
From: Mike Rapoport <[email protected]>
--- arch/arc/Kconfig | 10 ++++++++++ arch/arc/include/asm/sparsemem.h | 13 +++++++++++++ arch/arc/mm/init.c | 7 ++++++- 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 arch/arc/include/asm/sparsemem.h
arch/arc/Kconfig +10 -0
@@ -49,6 +49,7 @@ config ARC select PCI_SYSCALL if PCI select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING select HAVE_ARCH_JUMP_LABEL if ISA_ARCV2 && !CPU_ENDIAN_BE32 + select SPARSEMEM_STATIC if SPARSEMEM config ARCH_HAS_CACHE_LINE_SIZE def_bool y
@@ -68,8 +69,15 @@ config GENERIC_CSUM config ARCH_DISCONTIGMEM_ENABLE def_bool n +config ARCH_SPARSEMEM_ENABLE + def_bool n + config ARCH_FLATMEM_ENABLE def_bool y + depends on !HIGHMEM + +config ARCH_SELECT_MEMORY_MODEL + def_bool n config MMU def_bool y
@@ -509,6 +517,8 @@ config LINUX_RAM_BASE config HIGHMEM bool "High Memory Support" select ARCH_DISCONTIGMEM_ENABLE + select ARCH_SPARSEMEM_ENABLE + select ARCH_SELECT_MEMORY_MODEL 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/sparsemem.h new file +13 -0
@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _ASM_ARC_SPARSEMEM_H +#define _ASM_ARC_SPARSEMEM_H + +#ifdef CONFIG_ARC_HAS_PAE40 +#define MAX_PHYSMEM_BITS 40 +#define SECTION_SIZE_BITS 32 +#else +#define MAX_PHYSMEM_BITS 32 +#define SECTION_SIZE_BITS 31 +#endif + +#endif /* _ASM_ARC_SPARSEMEM_H */
arch/arc/mm/init.c +6 -1
@@ -153,7 +153,12 @@ 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 ); +#elif defined(CONFIG_SPARSEMEM ) +memblocks_present (); +sparse_init (); +#endif min_high_pfn =PFN_DOWN (high_mem_start); max_high_pfn =PFN_DOWN (high_mem_start + high_mem_sz);
@@ -162,7 +167,7 @@ void __init setup_arch_memory(void) high_memory = (void *)(min_high_pfn <<PAGE_SHIFT );kmap_init (); -#endif +#endif /* CONFIG_HIGHMEM */ free_area_init (max_zone_pfn); }
Signature · 7 lines
2.26.2 _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc