Skip to content

Commit 65d287c

Browse files
committed
Merge tag 'asm-generic-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic
Pull asm-generic updates from Arnd Bergmann: "Just two small updates this time: - A series I did to unify the definition of PAGE_SIZE through Kconfig, intended to help with a vdso rework that needs the constant but cannot include the normal kernel headers when building the compat VDSO on arm64 and potentially others - a patch from Yan Zhao to remove the pfn_to_virt() definitions from a couple of architectures after finding they were both incorrect and entirely unused" * tag 'asm-generic-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: arch: define CONFIG_PAGE_SIZE_*KB on all architectures arch: simplify architecture specific page size configuration arch: consolidate existing CONFIG_PAGE_SIZE_*KB definitions mm: Remove broken pfn_to_virt() on arch csky/hexagon/openrisc
2 parents 3efa10e + 5394f1e commit 65d287c

File tree

47 files changed

+187
-254
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+187
-254
lines changed

arch/Kconfig

Lines changed: 92 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,17 +1078,107 @@ config HAVE_ARCH_COMPAT_MMAP_BASES
10781078
and vice-versa 32-bit applications to call 64-bit mmap().
10791079
Required for applications doing different bitness syscalls.
10801080

1081+
config HAVE_PAGE_SIZE_4KB
1082+
bool
1083+
1084+
config HAVE_PAGE_SIZE_8KB
1085+
bool
1086+
1087+
config HAVE_PAGE_SIZE_16KB
1088+
bool
1089+
1090+
config HAVE_PAGE_SIZE_32KB
1091+
bool
1092+
1093+
config HAVE_PAGE_SIZE_64KB
1094+
bool
1095+
1096+
config HAVE_PAGE_SIZE_256KB
1097+
bool
1098+
1099+
choice
1100+
prompt "MMU page size"
1101+
1102+
config PAGE_SIZE_4KB
1103+
bool "4KiB pages"
1104+
depends on HAVE_PAGE_SIZE_4KB
1105+
help
1106+
This option select the standard 4KiB Linux page size and the only
1107+
available option on many architectures. Using 4KiB page size will
1108+
minimize memory consumption and is therefore recommended for low
1109+
memory systems.
1110+
Some software that is written for x86 systems makes incorrect
1111+
assumptions about the page size and only runs on 4KiB pages.
1112+
1113+
config PAGE_SIZE_8KB
1114+
bool "8KiB pages"
1115+
depends on HAVE_PAGE_SIZE_8KB
1116+
help
1117+
This option is the only supported page size on a few older
1118+
processors, and can be slightly faster than 4KiB pages.
1119+
1120+
config PAGE_SIZE_16KB
1121+
bool "16KiB pages"
1122+
depends on HAVE_PAGE_SIZE_16KB
1123+
help
1124+
This option is usually a good compromise between memory
1125+
consumption and performance for typical desktop and server
1126+
workloads, often saving a level of page table lookups compared
1127+
to 4KB pages as well as reducing TLB pressure and overhead of
1128+
per-page operations in the kernel at the expense of a larger
1129+
page cache.
1130+
1131+
config PAGE_SIZE_32KB
1132+
bool "32KiB pages"
1133+
depends on HAVE_PAGE_SIZE_32KB
1134+
help
1135+
Using 32KiB page size will result in slightly higher performance
1136+
kernel at the price of higher memory consumption compared to
1137+
16KiB pages. This option is available only on cnMIPS cores.
1138+
Note that you will need a suitable Linux distribution to
1139+
support this.
1140+
1141+
config PAGE_SIZE_64KB
1142+
bool "64KiB pages"
1143+
depends on HAVE_PAGE_SIZE_64KB
1144+
help
1145+
Using 64KiB page size will result in slightly higher performance
1146+
kernel at the price of much higher memory consumption compared to
1147+
4KiB or 16KiB pages.
1148+
This is not suitable for general-purpose workloads but the
1149+
better performance may be worth the cost for certain types of
1150+
supercomputing or database applications that work mostly with
1151+
large in-memory data rather than small files.
1152+
1153+
config PAGE_SIZE_256KB
1154+
bool "256KiB pages"
1155+
depends on HAVE_PAGE_SIZE_256KB
1156+
help
1157+
256KiB pages have little practical value due to their extreme
1158+
memory usage. The kernel will only be able to run applications
1159+
that have been compiled with '-zmax-page-size' set to 256KiB
1160+
(the default is 64KiB or 4KiB on most architectures).
1161+
1162+
endchoice
1163+
10811164
config PAGE_SIZE_LESS_THAN_64KB
10821165
def_bool y
1083-
depends on !ARM64_64K_PAGES
10841166
depends on !PAGE_SIZE_64KB
1085-
depends on !PARISC_PAGE_SIZE_64KB
10861167
depends on PAGE_SIZE_LESS_THAN_256KB
10871168

10881169
config PAGE_SIZE_LESS_THAN_256KB
10891170
def_bool y
10901171
depends on !PAGE_SIZE_256KB
10911172

1173+
config PAGE_SHIFT
1174+
int
1175+
default 12 if PAGE_SIZE_4KB
1176+
default 13 if PAGE_SIZE_8KB
1177+
default 14 if PAGE_SIZE_16KB
1178+
default 15 if PAGE_SIZE_32KB
1179+
default 16 if PAGE_SIZE_64KB
1180+
default 18 if PAGE_SIZE_256KB
1181+
10921182
# This allows to use a set of generic functions to determine mmap base
10931183
# address by giving priority to top-down scheme only if the process
10941184
# is not in legacy mode (compat task, unlimited stack size or

arch/alpha/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ config ALPHA
1414
select PCI_DOMAINS if PCI
1515
select PCI_SYSCALL if PCI
1616
select HAVE_ASM_MODVERSIONS
17+
select HAVE_PAGE_SIZE_8KB
1718
select HAVE_PCSPKR_PLATFORM
1819
select HAVE_PERF_EVENTS
1920
select NEED_DMA_MAP_STATE

arch/alpha/include/asm/page.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <asm/pal.h>
77

88
/* PAGE_SHIFT determines the page size */
9-
#define PAGE_SHIFT 13
9+
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
1010
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
1111
#define PAGE_MASK (~(PAGE_SIZE-1))
1212

arch/arc/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,17 @@ choice
284284

285285
config ARC_PAGE_SIZE_8K
286286
bool "8KB"
287+
select HAVE_PAGE_SIZE_8KB
287288
help
288289
Choose between 8k vs 16k
289290

290291
config ARC_PAGE_SIZE_16K
292+
select HAVE_PAGE_SIZE_16KB
291293
bool "16KB"
292294

293295
config ARC_PAGE_SIZE_4K
294296
bool "4KB"
297+
select HAVE_PAGE_SIZE_4KB
295298
depends on ARC_MMU_V3 || ARC_MMU_V4
296299

297300
endchoice

arch/arc/include/uapi/asm/page.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
#include <linux/const.h>
1414

1515
/* PAGE_SHIFT determines the page size */
16-
#if defined(CONFIG_ARC_PAGE_SIZE_16K)
17-
#define PAGE_SHIFT 14
18-
#elif defined(CONFIG_ARC_PAGE_SIZE_4K)
19-
#define PAGE_SHIFT 12
16+
#ifdef __KERNEL__
17+
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
2018
#else
2119
/*
2220
* Default 8k

arch/arm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ config ARM
116116
select HAVE_MOD_ARCH_SPECIFIC
117117
select HAVE_NMI
118118
select HAVE_OPTPROBES if !THUMB2_KERNEL
119+
select HAVE_PAGE_SIZE_4KB
119120
select HAVE_PCI if MMU
120121
select HAVE_PERF_EVENTS
121122
select HAVE_PERF_REGS

arch/arm/include/asm/page.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#define _ASMARM_PAGE_H
99

1010
/* PAGE_SHIFT determines the page size */
11-
#define PAGE_SHIFT 12
11+
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
1212
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
1313
#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
1414

arch/arm64/Kconfig

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -277,27 +277,21 @@ config 64BIT
277277
config MMU
278278
def_bool y
279279

280-
config ARM64_PAGE_SHIFT
281-
int
282-
default 16 if ARM64_64K_PAGES
283-
default 14 if ARM64_16K_PAGES
284-
default 12
285-
286280
config ARM64_CONT_PTE_SHIFT
287281
int
288-
default 5 if ARM64_64K_PAGES
289-
default 7 if ARM64_16K_PAGES
282+
default 5 if PAGE_SIZE_64KB
283+
default 7 if PAGE_SIZE_16KB
290284
default 4
291285

292286
config ARM64_CONT_PMD_SHIFT
293287
int
294-
default 5 if ARM64_64K_PAGES
295-
default 5 if ARM64_16K_PAGES
288+
default 5 if PAGE_SIZE_64KB
289+
default 5 if PAGE_SIZE_16KB
296290
default 4
297291

298292
config ARCH_MMAP_RND_BITS_MIN
299-
default 14 if ARM64_64K_PAGES
300-
default 16 if ARM64_16K_PAGES
293+
default 14 if PAGE_SIZE_64KB
294+
default 16 if PAGE_SIZE_16KB
301295
default 18
302296

303297
# max bits determined by the following formula:
@@ -1259,18 +1253,21 @@ choice
12591253

12601254
config ARM64_4K_PAGES
12611255
bool "4KB"
1256+
select HAVE_PAGE_SIZE_4KB
12621257
help
12631258
This feature enables 4KB pages support.
12641259

12651260
config ARM64_16K_PAGES
12661261
bool "16KB"
1262+
select HAVE_PAGE_SIZE_16KB
12671263
help
12681264
The system will use 16KB pages support. AArch32 emulation
12691265
requires applications compiled with 16K (or a multiple of 16K)
12701266
aligned segments.
12711267

12721268
config ARM64_64K_PAGES
12731269
bool "64KB"
1270+
select HAVE_PAGE_SIZE_64KB
12741271
help
12751272
This feature enables 64KB pages support (4KB by default)
12761273
allowing only two levels of page tables and faster TLB
@@ -1291,19 +1288,19 @@ choice
12911288

12921289
config ARM64_VA_BITS_36
12931290
bool "36-bit" if EXPERT
1294-
depends on ARM64_16K_PAGES
1291+
depends on PAGE_SIZE_16KB
12951292

12961293
config ARM64_VA_BITS_39
12971294
bool "39-bit"
1298-
depends on ARM64_4K_PAGES
1295+
depends on PAGE_SIZE_4KB
12991296

13001297
config ARM64_VA_BITS_42
13011298
bool "42-bit"
1302-
depends on ARM64_64K_PAGES
1299+
depends on PAGE_SIZE_64KB
13031300

13041301
config ARM64_VA_BITS_47
13051302
bool "47-bit"
1306-
depends on ARM64_16K_PAGES
1303+
depends on PAGE_SIZE_16KB
13071304

13081305
config ARM64_VA_BITS_48
13091306
bool "48-bit"

arch/arm64/include/asm/page-def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <linux/const.h>
1212

1313
/* PAGE_SHIFT determines the page size */
14-
#define PAGE_SHIFT CONFIG_ARM64_PAGE_SHIFT
14+
#define PAGE_SHIFT CONFIG_PAGE_SHIFT
1515
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
1616
#define PAGE_MASK (~(PAGE_SIZE-1))
1717

arch/csky/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ config CSKY
8989
select HAVE_KPROBES if !CPU_CK610
9090
select HAVE_KPROBES_ON_FTRACE if !CPU_CK610
9191
select HAVE_KRETPROBES if !CPU_CK610
92+
select HAVE_PAGE_SIZE_4KB
9293
select HAVE_PERF_EVENTS
9394
select HAVE_PERF_REGS
9495
select HAVE_PERF_USER_STACK_DUMP

0 commit comments

Comments
 (0)