Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

microblaze: Allow PAGE_SIZE configuration

Allow developer to configure memory page size at compile time.
Larger pages can improve performance on some workloads.

Based on PowerPC code.

Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>

authored by

Steven J. Magnani and committed by
Michal Simek
ba9c4f88 0d9ec762

+50 -11
+30
arch/microblaze/Kconfig
··· 223 223 hex "Size of user task space" if TASK_SIZE_BOOL 224 224 default "0x80000000" 225 225 226 + choice 227 + prompt "Page size" 228 + default MICROBLAZE_4K_PAGES 229 + depends on ADVANCED_OPTIONS && !MMU 230 + help 231 + Select the kernel logical page size. Increasing the page size 232 + will reduce software overhead at each page boundary, allow 233 + hardware prefetch mechanisms to be more effective, and allow 234 + larger dma transfers increasing IO efficiency and reducing 235 + overhead. However the utilization of memory will increase. 236 + For example, each cached file will using a multiple of the 237 + page size to hold its contents and the difference between the 238 + end of file and the end of page is wasted. 239 + 240 + If unsure, choose 4K_PAGES. 241 + 242 + config MICROBLAZE_4K_PAGES 243 + bool "4k page size" 244 + 245 + config MICROBLAZE_8K_PAGES 246 + bool "8k page size" 247 + 248 + config MICROBLAZE_16K_PAGES 249 + bool "16k page size" 250 + 251 + config MICROBLAZE_32K_PAGES 252 + bool "32k page size" 253 + 254 + endchoice 255 + 226 256 endmenu 227 257 228 258 source "mm/Kconfig"
+1 -1
arch/microblaze/include/asm/elf.h
··· 77 77 #define ELF_DATA ELFDATA2MSB 78 78 #endif 79 79 80 - #define ELF_EXEC_PAGESIZE 4096 80 + #define ELF_EXEC_PAGESIZE PAGE_SIZE 81 81 82 82 83 83 #define ELF_CORE_COPY_REGS(_dest, _regs) \
+10 -2
arch/microblaze/include/asm/page.h
··· 23 23 #ifdef __KERNEL__ 24 24 25 25 /* PAGE_SHIFT determines the page size */ 26 - #define PAGE_SHIFT (12) 27 - #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 26 + #if defined(CONFIG_MICROBLAZE_32K_PAGES) 27 + #define PAGE_SHIFT 15 28 + #elif defined(CONFIG_MICROBLAZE_16K_PAGES) 29 + #define PAGE_SHIFT 14 30 + #elif defined(CONFIG_MICROBLAZE_8K_PAGES) 31 + #define PAGE_SHIFT 13 32 + #else 33 + #define PAGE_SHIFT 12 34 + #endif 35 + #define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT) 28 36 #define PAGE_MASK (~(PAGE_SIZE-1)) 29 37 30 38 #define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))
+1
arch/microblaze/kernel/cpu/mb.c
··· 126 126 cpuinfo.pvr_user1, 127 127 cpuinfo.pvr_user2); 128 128 129 + count += seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE); 129 130 return 0; 130 131 } 131 132
+2 -2
arch/microblaze/kernel/head.S
··· 43 43 .global empty_zero_page 44 44 .align 12 45 45 empty_zero_page: 46 - .space 4096 46 + .space PAGE_SIZE 47 47 .global swapper_pg_dir 48 48 swapper_pg_dir: 49 - .space 4096 49 + .space PAGE_SIZE 50 50 51 51 #endif /* CONFIG_MMU */ 52 52
+6 -6
arch/microblaze/kernel/vmlinux.lds.S
··· 55 55 */ 56 56 .sdata2 : AT(ADDR(.sdata2) - LOAD_OFFSET) { 57 57 _ssrw = .; 58 - . = ALIGN(4096); /* page aligned when MMU used - origin 0x8 */ 58 + . = ALIGN(PAGE_SIZE); /* page aligned when MMU used */ 59 59 *(.sdata2) 60 60 . = ALIGN(8); 61 61 _essrw = .; ··· 70 70 /* Reserve some low RAM for r0 based memory references */ 71 71 . = ALIGN(0x4) ; 72 72 r0_ram = . ; 73 - . = . + 4096; /* a page should be enough */ 73 + . = . + PAGE_SIZE; /* a page should be enough */ 74 74 75 75 /* Under the microblaze ABI, .sdata and .sbss must be contiguous */ 76 76 . = ALIGN(8); ··· 120 120 121 121 __init_end_before_initramfs = .; 122 122 123 - .init.ramfs ALIGN(4096) : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { 123 + .init.ramfs ALIGN(PAGE_SIZE) : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { 124 124 __initramfs_start = .; 125 125 *(.init.ramfs) 126 126 __initramfs_end = .; ··· 132 132 * so that __init_end == __bss_start. This will make image.elf 133 133 * consistent with the image.bin 134 134 */ 135 - /* . = ALIGN(4096); */ 135 + /* . = ALIGN(PAGE_SIZE); */ 136 136 } 137 137 __init_end = .; 138 138 139 - .bss ALIGN (4096) : AT(ADDR(.bss) - LOAD_OFFSET) { 139 + .bss ALIGN (PAGE_SIZE) : AT(ADDR(.bss) - LOAD_OFFSET) { 140 140 /* page aligned when MMU used */ 141 141 __bss_start = . ; 142 142 *(.bss*) ··· 145 145 __bss_stop = . ; 146 146 _ebss = . ; 147 147 } 148 - . = ALIGN(4096); 148 + . = ALIGN(PAGE_SIZE); 149 149 _end = .; 150 150 151 151 DISCARDS