@@ -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+
10811164config 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
10881169config 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
0 commit comments