Kconfig 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. menu "Memory Management options"
  3. #
  4. # For some reason microblaze and nios2 hard code SWAP=n. Hopefully we can
  5. # add proper SWAP support to them, in which case this can be remove.
  6. #
  7. config ARCH_NO_SWAP
  8. bool
  9. menuconfig SWAP
  10. bool "Support for paging of anonymous memory (swap)"
  11. depends on MMU && BLOCK && !ARCH_NO_SWAP
  12. default y
  13. help
  14. This option allows you to choose whether you want to have support
  15. for so called swap devices or swap files in your kernel that are
  16. used to provide more virtual memory than the actual RAM present
  17. in your computer. If unsure say Y.
  18. config ZSWAP
  19. bool "Compressed cache for swap pages"
  20. depends on SWAP
  21. select CRYPTO
  22. select ZSMALLOC
  23. help
  24. A lightweight compressed cache for swap pages. It takes
  25. pages that are in the process of being swapped out and attempts to
  26. compress them into a dynamically allocated RAM-based memory pool.
  27. This can result in a significant I/O reduction on swap device and,
  28. in the case where decompressing from RAM is faster than swap device
  29. reads, can also improve workload performance.
  30. config ZSWAP_DEFAULT_ON
  31. bool "Enable the compressed cache for swap pages by default"
  32. depends on ZSWAP
  33. help
  34. If selected, the compressed cache for swap pages will be enabled
  35. at boot, otherwise it will be disabled.
  36. The selection made here can be overridden by using the kernel
  37. command line 'zswap.enabled=' option.
  38. config ZSWAP_SHRINKER_DEFAULT_ON
  39. bool "Shrink the zswap pool on memory pressure"
  40. depends on ZSWAP
  41. default n
  42. help
  43. If selected, the zswap shrinker will be enabled, and the pages
  44. stored in the zswap pool will become available for reclaim (i.e
  45. written back to the backing swap device) on memory pressure.
  46. This means that zswap writeback could happen even if the pool is
  47. not yet full, or the cgroup zswap limit has not been reached,
  48. reducing the chance that cold pages will reside in the zswap pool
  49. and consume memory indefinitely.
  50. choice
  51. prompt "Default compressor"
  52. depends on ZSWAP
  53. default ZSWAP_COMPRESSOR_DEFAULT_LZO
  54. help
  55. Selects the default compression algorithm for the compressed cache
  56. for swap pages.
  57. For an overview what kind of performance can be expected from
  58. a particular compression algorithm please refer to the benchmarks
  59. available at the following LWN page:
  60. https://lwn.net/Articles/751795/
  61. If in doubt, select 'LZO'.
  62. The selection made here can be overridden by using the kernel
  63. command line 'zswap.compressor=' option.
  64. config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
  65. bool "Deflate"
  66. select CRYPTO_DEFLATE
  67. help
  68. Use the Deflate algorithm as the default compression algorithm.
  69. config ZSWAP_COMPRESSOR_DEFAULT_LZO
  70. bool "LZO"
  71. select CRYPTO_LZO
  72. help
  73. Use the LZO algorithm as the default compression algorithm.
  74. config ZSWAP_COMPRESSOR_DEFAULT_842
  75. bool "842"
  76. select CRYPTO_842
  77. help
  78. Use the 842 algorithm as the default compression algorithm.
  79. config ZSWAP_COMPRESSOR_DEFAULT_LZ4
  80. bool "LZ4"
  81. select CRYPTO_LZ4
  82. help
  83. Use the LZ4 algorithm as the default compression algorithm.
  84. config ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
  85. bool "LZ4HC"
  86. select CRYPTO_LZ4HC
  87. help
  88. Use the LZ4HC algorithm as the default compression algorithm.
  89. config ZSWAP_COMPRESSOR_DEFAULT_ZSTD
  90. bool "zstd"
  91. select CRYPTO_ZSTD
  92. help
  93. Use the zstd algorithm as the default compression algorithm.
  94. endchoice
  95. config ZSWAP_COMPRESSOR_DEFAULT
  96. string
  97. depends on ZSWAP
  98. default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
  99. default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
  100. default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
  101. default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
  102. default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
  103. default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
  104. default ""
  105. config ZSMALLOC
  106. tristate
  107. if ZSMALLOC
  108. menu "Zsmalloc allocator options"
  109. depends on ZSMALLOC
  110. comment "Zsmalloc is a common backend allocator for zswap & zram"
  111. config ZSMALLOC_STAT
  112. bool "Export zsmalloc statistics"
  113. select DEBUG_FS
  114. help
  115. This option enables code in the zsmalloc to collect various
  116. statistics about what's happening in zsmalloc and exports that
  117. information to userspace via debugfs.
  118. If unsure, say N.
  119. config ZSMALLOC_CHAIN_SIZE
  120. int "Maximum number of physical pages per-zspage"
  121. default 8
  122. range 4 16
  123. help
  124. This option sets the upper limit on the number of physical pages
  125. that a zmalloc page (zspage) can consist of. The optimal zspage
  126. chain size is calculated for each size class during the
  127. initialization of the pool.
  128. Changing this option can alter the characteristics of size classes,
  129. such as the number of pages per zspage and the number of objects
  130. per zspage. This can also result in different configurations of
  131. the pool, as zsmalloc merges size classes with similar
  132. characteristics.
  133. For more information, see zsmalloc documentation.
  134. endmenu
  135. endif
  136. menu "Slab allocator options"
  137. config SLUB
  138. def_bool y
  139. select IRQ_WORK
  140. config KVFREE_RCU_BATCHED
  141. def_bool y
  142. depends on !SLUB_TINY && !TINY_RCU
  143. config SLUB_TINY
  144. bool "Configure for minimal memory footprint"
  145. depends on EXPERT && !COMPILE_TEST
  146. select SLAB_MERGE_DEFAULT
  147. help
  148. Configures the slab allocator in a way to achieve minimal memory
  149. footprint, sacrificing scalability, debugging and other features.
  150. This is intended only for the smallest system that had used the
  151. SLOB allocator and is not recommended for systems with more than
  152. 16MB RAM.
  153. If unsure, say N.
  154. config SLAB_MERGE_DEFAULT
  155. bool "Allow slab caches to be merged"
  156. default y
  157. help
  158. For reduced kernel memory fragmentation, slab caches can be
  159. merged when they share the same size and other characteristics.
  160. This carries a risk of kernel heap overflows being able to
  161. overwrite objects from merged caches (and more easily control
  162. cache layout), which makes such heap attacks easier to exploit
  163. by attackers. By keeping caches unmerged, these kinds of exploits
  164. can usually only damage objects in the same cache. To disable
  165. merging at runtime, "slab_nomerge" can be passed on the kernel
  166. command line.
  167. config SLAB_FREELIST_RANDOM
  168. bool "Randomize slab freelist"
  169. depends on !SLUB_TINY
  170. help
  171. Randomizes the freelist order used on creating new pages. This
  172. security feature reduces the predictability of the kernel slab
  173. allocator against heap overflows.
  174. config SLAB_FREELIST_HARDENED
  175. bool "Harden slab freelist metadata"
  176. depends on !SLUB_TINY
  177. help
  178. Many kernel heap attacks try to target slab cache metadata and
  179. other infrastructure. This options makes minor performance
  180. sacrifices to harden the kernel slab allocator against common
  181. freelist exploit methods.
  182. config SLAB_BUCKETS
  183. bool "Support allocation from separate kmalloc buckets"
  184. depends on !SLUB_TINY
  185. default SLAB_FREELIST_HARDENED
  186. help
  187. Kernel heap attacks frequently depend on being able to create
  188. specifically-sized allocations with user-controlled contents
  189. that will be allocated into the same kmalloc bucket as a
  190. target object. To avoid sharing these allocation buckets,
  191. provide an explicitly separated set of buckets to be used for
  192. user-controlled allocations. This may very slightly increase
  193. memory fragmentation, though in practice it's only a handful
  194. of extra pages since the bulk of user-controlled allocations
  195. are relatively long-lived.
  196. If unsure, say Y.
  197. config SLUB_STATS
  198. default n
  199. bool "Enable performance statistics"
  200. depends on SYSFS && !SLUB_TINY
  201. help
  202. The statistics are useful to debug slab allocation behavior in
  203. order find ways to optimize the allocator. This should never be
  204. enabled for production use since keeping statistics slows down
  205. the allocator by a few percentage points. The slabinfo command
  206. supports the determination of the most active slabs to figure
  207. out which slabs are relevant to a particular load.
  208. Try running: slabinfo -DA
  209. config RANDOM_KMALLOC_CACHES
  210. default n
  211. depends on !SLUB_TINY
  212. bool "Randomize slab caches for normal kmalloc"
  213. help
  214. A hardening feature that creates multiple copies of slab caches for
  215. normal kmalloc allocation and makes kmalloc randomly pick one based
  216. on code address, which makes the attackers more difficult to spray
  217. vulnerable memory objects on the heap for the purpose of exploiting
  218. memory vulnerabilities.
  219. Currently the number of copies is set to 16, a reasonably large value
  220. that effectively diverges the memory objects allocated for different
  221. subsystems or modules into different caches, at the expense of a
  222. limited degree of memory and CPU overhead that relates to hardware and
  223. system workload.
  224. endmenu # Slab allocator options
  225. config SHUFFLE_PAGE_ALLOCATOR
  226. bool "Page allocator randomization"
  227. default SLAB_FREELIST_RANDOM && ACPI_NUMA
  228. help
  229. Randomization of the page allocator improves the average
  230. utilization of a direct-mapped memory-side-cache. See section
  231. 5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
  232. 6.2a specification for an example of how a platform advertises
  233. the presence of a memory-side-cache. There are also incidental
  234. security benefits as it reduces the predictability of page
  235. allocations to compliment SLAB_FREELIST_RANDOM, but the
  236. default granularity of shuffling on the MAX_PAGE_ORDER i.e, 10th
  237. order of pages is selected based on cache utilization benefits
  238. on x86.
  239. While the randomization improves cache utilization it may
  240. negatively impact workloads on platforms without a cache. For
  241. this reason, by default, the randomization is not enabled even
  242. if SHUFFLE_PAGE_ALLOCATOR=y. The randomization may be force enabled
  243. with the 'page_alloc.shuffle' kernel command line parameter.
  244. Say Y if unsure.
  245. config COMPAT_BRK
  246. bool "Disable heap randomization"
  247. default y
  248. help
  249. Randomizing heap placement makes heap exploits harder, but it
  250. also breaks ancient binaries (including anything libc5 based).
  251. This option changes the bootup default to heap randomization
  252. disabled, and can be overridden at runtime by setting
  253. /proc/sys/kernel/randomize_va_space to 2.
  254. On non-ancient distros (post-2000 ones) N is usually a safe choice.
  255. config MMAP_ALLOW_UNINITIALIZED
  256. bool "Allow mmapped anonymous memory to be uninitialized"
  257. depends on EXPERT && !MMU
  258. default n
  259. help
  260. Normally, and according to the Linux spec, anonymous memory obtained
  261. from mmap() has its contents cleared before it is passed to
  262. userspace. Enabling this config option allows you to request that
  263. mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
  264. providing a huge performance boost. If this option is not enabled,
  265. then the flag will be ignored.
  266. This is taken advantage of by uClibc's malloc(), and also by
  267. ELF-FDPIC binfmt's brk and stack allocator.
  268. Because of the obvious security issues, this option should only be
  269. enabled on embedded devices where you control what is run in
  270. userspace. Since that isn't generally a problem on no-MMU systems,
  271. it is normally safe to say Y here.
  272. See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
  273. config SELECT_MEMORY_MODEL
  274. def_bool y
  275. depends on ARCH_SELECT_MEMORY_MODEL
  276. choice
  277. prompt "Memory model"
  278. depends on SELECT_MEMORY_MODEL
  279. default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
  280. default FLATMEM_MANUAL
  281. help
  282. This option allows you to change some of the ways that
  283. Linux manages its memory internally. Most users will
  284. only have one option here selected by the architecture
  285. configuration. This is normal.
  286. config FLATMEM_MANUAL
  287. bool "Flat Memory"
  288. depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
  289. help
  290. This option is best suited for non-NUMA systems with
  291. flat address space. The FLATMEM is the most efficient
  292. system in terms of performance and resource consumption
  293. and it is the best option for smaller systems.
  294. For systems that have holes in their physical address
  295. spaces and for features like NUMA and memory hotplug,
  296. choose "Sparse Memory".
  297. If unsure, choose this option (Flat Memory) over any other.
  298. config SPARSEMEM_MANUAL
  299. bool "Sparse Memory"
  300. depends on ARCH_SPARSEMEM_ENABLE
  301. help
  302. This will be the only option for some systems, including
  303. memory hot-plug systems. This is normal.
  304. This option provides efficient support for systems with
  305. holes is their physical address space and allows memory
  306. hot-plug and hot-remove.
  307. If unsure, choose "Flat Memory" over this option.
  308. endchoice
  309. config SPARSEMEM
  310. def_bool y
  311. depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
  312. config FLATMEM
  313. def_bool y
  314. depends on !SPARSEMEM || FLATMEM_MANUAL
  315. #
  316. # SPARSEMEM_EXTREME (which is the default) does some bootmem
  317. # allocations when sparse_init() is called. If this cannot
  318. # be done on your architecture, select this option. However,
  319. # statically allocating the mem_section[] array can potentially
  320. # consume vast quantities of .bss, so be careful.
  321. #
  322. # This option will also potentially produce smaller runtime code
  323. # with gcc 3.4 and later.
  324. #
  325. config SPARSEMEM_STATIC
  326. bool
  327. #
  328. # Architecture platforms which require a two level mem_section in SPARSEMEM
  329. # must select this option. This is usually for architecture platforms with
  330. # an extremely sparse physical address space.
  331. #
  332. config SPARSEMEM_EXTREME
  333. def_bool y
  334. depends on SPARSEMEM && !SPARSEMEM_STATIC
  335. config SPARSEMEM_VMEMMAP_ENABLE
  336. bool
  337. config SPARSEMEM_VMEMMAP
  338. def_bool y
  339. depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
  340. help
  341. SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
  342. pfn_to_page and page_to_pfn operations. This is the most
  343. efficient option when sufficient kernel resources are available.
  344. config SPARSEMEM_VMEMMAP_PREINIT
  345. bool
  346. #
  347. # Select this config option from the architecture Kconfig, if it is preferred
  348. # to enable the feature of HugeTLB/dev_dax vmemmap optimization.
  349. #
  350. config ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
  351. bool
  352. config ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
  353. bool
  354. config ARCH_WANT_HUGETLB_VMEMMAP_PREINIT
  355. bool
  356. config HAVE_MEMBLOCK_PHYS_MAP
  357. bool
  358. config HAVE_GUP_FAST
  359. depends on MMU
  360. bool
  361. # Enable memblock support for scratch memory which is needed for kexec handover
  362. config MEMBLOCK_KHO_SCRATCH
  363. bool
  364. # Don't discard allocated memory used to track "memory" and "reserved" memblocks
  365. # after early boot, so it can still be used to test for validity of memory.
  366. # Also, memblocks are updated with memory hot(un)plug.
  367. config ARCH_KEEP_MEMBLOCK
  368. bool
  369. # Keep arch NUMA mapping infrastructure post-init.
  370. config NUMA_KEEP_MEMINFO
  371. bool
  372. config MEMORY_ISOLATION
  373. bool
  374. # IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked
  375. # IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via
  376. # /dev/mem.
  377. config EXCLUSIVE_SYSTEM_RAM
  378. def_bool y
  379. depends on !DEVMEM || STRICT_DEVMEM
  380. #
  381. # Only be set on architectures that have completely implemented memory hotplug
  382. # feature. If you are not sure, don't touch it.
  383. #
  384. config HAVE_BOOTMEM_INFO_NODE
  385. def_bool n
  386. config ARCH_ENABLE_MEMORY_HOTPLUG
  387. bool
  388. config ARCH_ENABLE_MEMORY_HOTREMOVE
  389. bool
  390. # eventually, we can have this option just 'select SPARSEMEM'
  391. menuconfig MEMORY_HOTPLUG
  392. bool "Memory hotplug"
  393. select MEMORY_ISOLATION
  394. depends on SPARSEMEM
  395. depends on ARCH_ENABLE_MEMORY_HOTPLUG
  396. depends on 64BIT
  397. select NUMA_KEEP_MEMINFO if NUMA
  398. if MEMORY_HOTPLUG
  399. choice
  400. prompt "Memory Hotplug Default Online Type"
  401. default MHP_DEFAULT_ONLINE_TYPE_OFFLINE
  402. help
  403. Default memory type for hotplugged memory.
  404. This option sets the default policy setting for memory hotplug
  405. onlining policy (/sys/devices/system/memory/auto_online_blocks) which
  406. determines what happens to newly added memory regions. Policy setting
  407. can always be changed at runtime.
  408. The default is 'offline'.
  409. Select offline to defer onlining to drivers and user policy.
  410. Select auto to let the kernel choose what zones to utilize.
  411. Select online_kernel to generally allow kernel usage of this memory.
  412. Select online_movable to generally disallow kernel usage of this memory.
  413. Example kernel usage would be page structs and page tables.
  414. See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
  415. config MHP_DEFAULT_ONLINE_TYPE_OFFLINE
  416. bool "offline"
  417. help
  418. Hotplugged memory will not be onlined by default.
  419. Choose this for systems with drivers and user policy that
  420. handle onlining of hotplug memory policy.
  421. config MHP_DEFAULT_ONLINE_TYPE_ONLINE_AUTO
  422. bool "auto"
  423. help
  424. Select this if you want the kernel to automatically online
  425. hotplugged memory into the zone it thinks is reasonable.
  426. This memory may be utilized for kernel data.
  427. config MHP_DEFAULT_ONLINE_TYPE_ONLINE_KERNEL
  428. bool "kernel"
  429. help
  430. Select this if you want the kernel to automatically online
  431. hotplugged memory into a zone capable of being used for kernel
  432. data. This typically means ZONE_NORMAL.
  433. config MHP_DEFAULT_ONLINE_TYPE_ONLINE_MOVABLE
  434. bool "movable"
  435. help
  436. Select this if you want the kernel to automatically online
  437. hotplug memory into ZONE_MOVABLE. This memory will generally
  438. not be utilized for kernel data.
  439. This should only be used when the admin knows sufficient
  440. ZONE_NORMAL memory is available to describe hotplug memory,
  441. otherwise hotplug memory may fail to online. For example,
  442. sufficient kernel-capable memory (ZONE_NORMAL) must be
  443. available to allocate page structs to describe ZONE_MOVABLE.
  444. endchoice
  445. config MEMORY_HOTREMOVE
  446. bool "Allow for memory hot remove"
  447. select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
  448. depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
  449. depends on MIGRATION
  450. config MHP_MEMMAP_ON_MEMORY
  451. def_bool y
  452. depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
  453. depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
  454. endif # MEMORY_HOTPLUG
  455. config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
  456. bool
  457. # Heavily threaded applications may benefit from splitting the mm-wide
  458. # page_table_lock, so that faults on different parts of the user address
  459. # space can be handled with less contention: split it at this NR_CPUS.
  460. # Default to 4 for wider testing, though 8 might be more appropriate.
  461. # ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
  462. # PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
  463. # SPARC32 allocates multiple pte tables within a single page, and therefore
  464. # a per-page lock leads to problems when multiple tables need to be locked
  465. # at the same time (e.g. copy_page_range()).
  466. # DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
  467. #
  468. config SPLIT_PTE_PTLOCKS
  469. def_bool y
  470. depends on MMU
  471. depends on SMP
  472. depends on NR_CPUS >= 4
  473. depends on !ARM || CPU_CACHE_VIPT
  474. depends on !PARISC || PA20
  475. depends on !SPARC32
  476. config ARCH_ENABLE_SPLIT_PMD_PTLOCK
  477. bool
  478. config SPLIT_PMD_PTLOCKS
  479. def_bool y
  480. depends on SPLIT_PTE_PTLOCKS && ARCH_ENABLE_SPLIT_PMD_PTLOCK
  481. #
  482. # support for memory balloon
  483. config BALLOON
  484. bool
  485. #
  486. # support for memory balloon page migration
  487. config BALLOON_MIGRATION
  488. bool "Allow for balloon memory migration"
  489. default y
  490. depends on MIGRATION && BALLOON
  491. help
  492. Allow for migration of pages inflated in a memory balloon such that
  493. they can be allocated from memory areas only available for movable
  494. allocations (e.g., ZONE_MOVABLE, CMA) and such that they can be
  495. migrated for memory defragmentation purposes by memory compaction.
  496. #
  497. # support for memory compaction
  498. config COMPACTION
  499. bool "Allow for memory compaction"
  500. default y
  501. select MIGRATION
  502. depends on MMU
  503. help
  504. Compaction is the only memory management component to form
  505. high order (larger physically contiguous) memory blocks
  506. reliably. The page allocator relies on compaction heavily and
  507. the lack of the feature can lead to unexpected OOM killer
  508. invocations for high order memory requests. You shouldn't
  509. disable this option unless there really is a strong reason for
  510. it and then we would be really interested to hear about that at
  511. linux-mm@kvack.org.
  512. config COMPACT_UNEVICTABLE_DEFAULT
  513. int
  514. depends on COMPACTION
  515. default 0 if PREEMPT_RT
  516. default 1
  517. #
  518. # support for free page reporting
  519. config PAGE_REPORTING
  520. bool "Free page reporting"
  521. help
  522. Free page reporting allows for the incremental acquisition of
  523. free pages from the buddy allocator for the purpose of reporting
  524. those pages to another entity, such as a hypervisor, so that the
  525. memory can be freed within the host for other uses.
  526. #
  527. # support for page migration
  528. #
  529. config MIGRATION
  530. bool "Page migration"
  531. default y
  532. depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
  533. help
  534. Allows the migration of the physical location of pages of processes
  535. while the virtual addresses are not changed. This is useful in
  536. two situations. The first is on NUMA systems to put pages nearer
  537. to the processors accessing. The second is when allocating huge
  538. pages as migration can relocate pages to satisfy a huge page
  539. allocation instead of reclaiming.
  540. config DEVICE_MIGRATION
  541. def_bool MIGRATION && ZONE_DEVICE
  542. config ARCH_ENABLE_HUGEPAGE_MIGRATION
  543. bool
  544. config ARCH_ENABLE_THP_MIGRATION
  545. bool
  546. config HUGETLB_PAGE_SIZE_VARIABLE
  547. def_bool n
  548. help
  549. Allows the pageblock_order value to be dynamic instead of just standard
  550. HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
  551. on a platform.
  552. Note that the pageblock_order cannot exceed MAX_PAGE_ORDER and will be
  553. clamped down to MAX_PAGE_ORDER.
  554. config CONTIG_ALLOC
  555. def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
  556. config PCP_BATCH_SCALE_MAX
  557. int "Maximum scale factor of PCP (Per-CPU pageset) batch allocate/free"
  558. default 5
  559. range 0 6
  560. help
  561. In page allocator, PCP (Per-CPU pageset) is refilled and drained in
  562. batches. The batch number is scaled automatically to improve page
  563. allocation/free throughput. But too large scale factor may hurt
  564. latency. This option sets the upper limit of scale factor to limit
  565. the maximum latency.
  566. config PHYS_ADDR_T_64BIT
  567. def_bool 64BIT
  568. config MMU_NOTIFIER
  569. bool
  570. select INTERVAL_TREE
  571. config KSM
  572. bool "Enable KSM for page merging"
  573. depends on MMU
  574. select XXHASH
  575. help
  576. Enable Kernel Samepage Merging: KSM periodically scans those areas
  577. of an application's address space that an app has advised may be
  578. mergeable. When it finds pages of identical content, it replaces
  579. the many instances by a single page with that content, so
  580. saving memory until one or another app needs to modify the content.
  581. Recommended for use with KVM, or with other duplicative applications.
  582. See Documentation/mm/ksm.rst for more information: KSM is inactive
  583. until a program has madvised that an area is MADV_MERGEABLE, and
  584. root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
  585. config DEFAULT_MMAP_MIN_ADDR
  586. int "Low address space to protect from user allocation"
  587. depends on MMU
  588. default 4096
  589. help
  590. This is the portion of low virtual memory which should be protected
  591. from userspace allocation. Keeping a user from writing to low pages
  592. can help reduce the impact of kernel NULL pointer bugs.
  593. For most arm64, ppc64 and x86 users with lots of address space
  594. a value of 65536 is reasonable and should cause no problems.
  595. On arm and other archs it should not be higher than 32768.
  596. Programs which use vm86 functionality or have some need to map
  597. this low address space will need CAP_SYS_RAWIO or disable this
  598. protection by setting the value to 0.
  599. This value can be changed after boot using the
  600. /proc/sys/vm/mmap_min_addr tunable.
  601. config ARCH_SUPPORTS_MEMORY_FAILURE
  602. bool
  603. config MEMORY_FAILURE
  604. depends on MMU
  605. depends on ARCH_SUPPORTS_MEMORY_FAILURE
  606. bool "Enable recovery from hardware memory errors"
  607. select INTERVAL_TREE
  608. help
  609. Enables code to recover from some memory failures on systems
  610. with MCA recovery. This allows a system to continue running
  611. even when some of its memory has uncorrected errors. This requires
  612. special hardware support and typically ECC memory.
  613. config HWPOISON_INJECT
  614. tristate "HWPoison pages injector"
  615. depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
  616. select PROC_PAGE_MONITOR
  617. config NOMMU_INITIAL_TRIM_EXCESS
  618. int "Turn on mmap() excess space trimming before booting"
  619. depends on !MMU
  620. default 1
  621. help
  622. The NOMMU mmap() frequently needs to allocate large contiguous chunks
  623. of memory on which to store mappings, but it can only ask the system
  624. allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
  625. more than it requires. To deal with this, mmap() is able to trim off
  626. the excess and return it to the allocator.
  627. If trimming is enabled, the excess is trimmed off and returned to the
  628. system allocator, which can cause extra fragmentation, particularly
  629. if there are a lot of transient processes.
  630. If trimming is disabled, the excess is kept, but not used, which for
  631. long-term mappings means that the space is wasted.
  632. Trimming can be dynamically controlled through a sysctl option
  633. (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
  634. excess pages there must be before trimming should occur, or zero if
  635. no trimming is to occur.
  636. This option specifies the initial value of this option. The default
  637. of 1 says that all excess pages should be trimmed.
  638. See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
  639. config ARCH_WANT_GENERAL_HUGETLB
  640. bool
  641. config ARCH_WANTS_THP_SWAP
  642. def_bool n
  643. config PERSISTENT_HUGE_ZERO_FOLIO
  644. bool "Allocate a PMD sized folio for zeroing"
  645. depends on TRANSPARENT_HUGEPAGE
  646. help
  647. Enable this option to reduce the runtime refcounting overhead
  648. of the huge zero folio and expand the places in the kernel
  649. that can use huge zero folios. For instance, block I/O benefits
  650. from access to large folios for zeroing memory.
  651. With this option enabled, the huge zero folio is allocated
  652. once and never freed. One full huge page's worth of memory shall
  653. be used.
  654. Say Y if your system has lots of memory. Say N if you are
  655. memory constrained.
  656. config MM_ID
  657. def_bool n
  658. menuconfig TRANSPARENT_HUGEPAGE
  659. bool "Transparent Hugepage Support"
  660. depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
  661. select COMPACTION
  662. select XARRAY_MULTI
  663. select MM_ID
  664. help
  665. Transparent Hugepages allows the kernel to use huge pages and
  666. huge tlb transparently to the applications whenever possible.
  667. This feature can improve computing performance to certain
  668. applications by speeding up page faults during memory
  669. allocation, by reducing the number of tlb misses and by speeding
  670. up the pagetable walking.
  671. If memory constrained on embedded, you may want to say N.
  672. if TRANSPARENT_HUGEPAGE
  673. choice
  674. prompt "Transparent Hugepage Support sysfs defaults"
  675. depends on TRANSPARENT_HUGEPAGE
  676. default TRANSPARENT_HUGEPAGE_ALWAYS
  677. help
  678. Selects the sysfs defaults for Transparent Hugepage Support.
  679. config TRANSPARENT_HUGEPAGE_ALWAYS
  680. bool "always"
  681. help
  682. Enabling Transparent Hugepage always, can increase the
  683. memory footprint of applications without a guaranteed
  684. benefit but it will work automatically for all applications.
  685. config TRANSPARENT_HUGEPAGE_MADVISE
  686. bool "madvise"
  687. help
  688. Enabling Transparent Hugepage madvise, will only provide a
  689. performance improvement benefit to the applications using
  690. madvise(MADV_HUGEPAGE) but it won't risk to increase the
  691. memory footprint of applications without a guaranteed
  692. benefit.
  693. config TRANSPARENT_HUGEPAGE_NEVER
  694. bool "never"
  695. help
  696. Disable Transparent Hugepage by default. It can still be
  697. enabled at runtime via sysfs.
  698. endchoice
  699. choice
  700. prompt "Shmem hugepage allocation defaults"
  701. depends on TRANSPARENT_HUGEPAGE
  702. default TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER
  703. help
  704. Selects the hugepage allocation policy defaults for
  705. the internal shmem mount.
  706. The selection made here can be overridden by using the kernel
  707. command line 'transparent_hugepage_shmem=' option.
  708. config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER
  709. bool "never"
  710. help
  711. Disable hugepage allocation for shmem mount by default. It can
  712. still be enabled with the kernel command line
  713. 'transparent_hugepage_shmem=' option or at runtime via sysfs
  714. knob. Note that madvise(MADV_COLLAPSE) can still cause
  715. transparent huge pages to be obtained even if this mode is
  716. specified.
  717. config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ALWAYS
  718. bool "always"
  719. help
  720. Always attempt to allocate hugepage for shmem mount, can
  721. increase the memory footprint of applications without a
  722. guaranteed benefit but it will work automatically for all
  723. applications.
  724. config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_WITHIN_SIZE
  725. bool "within_size"
  726. help
  727. Enable hugepage allocation for shmem mount if the allocation
  728. will be fully within the i_size. This configuration also takes
  729. into account any madvise(MADV_HUGEPAGE) hints that may be
  730. provided by the applications.
  731. config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ADVISE
  732. bool "advise"
  733. help
  734. Enable hugepage allocation for the shmem mount exclusively when
  735. applications supply the madvise(MADV_HUGEPAGE) hint.
  736. This ensures that hugepages are used only in response to explicit
  737. requests from applications.
  738. endchoice
  739. choice
  740. prompt "Tmpfs hugepage allocation defaults"
  741. depends on TRANSPARENT_HUGEPAGE
  742. default TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER
  743. help
  744. Selects the hugepage allocation policy defaults for
  745. the tmpfs mount.
  746. The selection made here can be overridden by using the kernel
  747. command line 'transparent_hugepage_tmpfs=' option.
  748. config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER
  749. bool "never"
  750. help
  751. Disable hugepage allocation for tmpfs mount by default. It can
  752. still be enabled with the kernel command line
  753. 'transparent_hugepage_tmpfs=' option. Note that
  754. madvise(MADV_COLLAPSE) can still cause transparent huge pages
  755. to be obtained even if this mode is specified.
  756. config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ALWAYS
  757. bool "always"
  758. help
  759. Always attempt to allocate hugepage for tmpfs mount, can
  760. increase the memory footprint of applications without a
  761. guaranteed benefit but it will work automatically for all
  762. applications.
  763. config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_WITHIN_SIZE
  764. bool "within_size"
  765. help
  766. Enable hugepage allocation for tmpfs mount if the allocation
  767. will be fully within the i_size. This configuration also takes
  768. into account any madvise(MADV_HUGEPAGE) hints that may be
  769. provided by the applications.
  770. config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ADVISE
  771. bool "advise"
  772. help
  773. Enable hugepage allocation for the tmpfs mount exclusively when
  774. applications supply the madvise(MADV_HUGEPAGE) hint.
  775. This ensures that hugepages are used only in response to explicit
  776. requests from applications.
  777. endchoice
  778. config THP_SWAP
  779. def_bool y
  780. depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT
  781. help
  782. Swap transparent huge pages in one piece, without splitting.
  783. XXX: For now, swap cluster backing transparent huge page
  784. will be split after swapout.
  785. For selection by architectures with reasonable THP sizes.
  786. config READ_ONLY_THP_FOR_FS
  787. bool "Read-only THP for filesystems (EXPERIMENTAL)"
  788. depends on TRANSPARENT_HUGEPAGE
  789. help
  790. Allow khugepaged to put read-only file-backed pages in THP.
  791. This is marked experimental because it is a new feature. Write
  792. support of file THPs will be developed in the next few release
  793. cycles.
  794. config NO_PAGE_MAPCOUNT
  795. bool "No per-page mapcount (EXPERIMENTAL)"
  796. help
  797. Do not maintain per-page mapcounts for pages part of larger
  798. allocations, such as transparent huge pages.
  799. When this config option is enabled, some interfaces that relied on
  800. this information will rely on less-precise per-allocation information
  801. instead: for example, using the average per-page mapcount in such
  802. a large allocation instead of the per-page mapcount.
  803. EXPERIMENTAL because the impact of some changes is still unclear.
  804. endif # TRANSPARENT_HUGEPAGE
  805. # simple helper to make the code a bit easier to read
  806. config PAGE_MAPCOUNT
  807. def_bool !NO_PAGE_MAPCOUNT
  808. #
  809. # The architecture supports pgtable leaves that is larger than PAGE_SIZE
  810. #
  811. config PGTABLE_HAS_HUGE_LEAVES
  812. def_bool TRANSPARENT_HUGEPAGE || HUGETLB_PAGE
  813. #
  814. # We can end up creating gigantic folio.
  815. #
  816. config HAVE_GIGANTIC_FOLIOS
  817. def_bool (HUGETLB_PAGE && ARCH_HAS_GIGANTIC_PAGE) || \
  818. (ZONE_DEVICE && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
  819. config ASYNC_KERNEL_PGTABLE_FREE
  820. def_bool n
  821. # TODO: Allow to be enabled without THP
  822. config ARCH_SUPPORTS_HUGE_PFNMAP
  823. def_bool n
  824. depends on TRANSPARENT_HUGEPAGE
  825. config ARCH_SUPPORTS_PMD_PFNMAP
  826. def_bool y
  827. depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE
  828. config ARCH_SUPPORTS_PUD_PFNMAP
  829. def_bool y
  830. depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
  831. #
  832. # Architectures that always use weak definitions for percpu
  833. # variables in modules should set this.
  834. #
  835. config ARCH_MODULE_NEEDS_WEAK_PER_CPU
  836. bool
  837. #
  838. # UP and nommu archs use km based percpu allocator
  839. #
  840. config NEED_PER_CPU_KM
  841. depends on !SMP || !MMU
  842. bool
  843. default y
  844. config NEED_PER_CPU_EMBED_FIRST_CHUNK
  845. bool
  846. config NEED_PER_CPU_PAGE_FIRST_CHUNK
  847. bool
  848. config USE_PERCPU_NUMA_NODE_ID
  849. bool
  850. config HAVE_SETUP_PER_CPU_AREA
  851. bool
  852. config CMA
  853. bool "Contiguous Memory Allocator"
  854. depends on MMU
  855. select MIGRATION
  856. select MEMORY_ISOLATION
  857. help
  858. This enables the Contiguous Memory Allocator which allows other
  859. subsystems to allocate big physically-contiguous blocks of memory.
  860. CMA reserves a region of memory and allows only movable pages to
  861. be allocated from it. This way, the kernel can use the memory for
  862. pagecache and when a subsystem requests for contiguous area, the
  863. allocated pages are migrated away to serve the contiguous request.
  864. If unsure, say "n".
  865. config CMA_DEBUGFS
  866. bool "CMA debugfs interface"
  867. depends on CMA && DEBUG_FS
  868. help
  869. Turns on the DebugFS interface for CMA.
  870. config CMA_SYSFS
  871. bool "CMA information through sysfs interface"
  872. depends on CMA && SYSFS
  873. help
  874. This option exposes some sysfs attributes to get information
  875. from CMA.
  876. config CMA_AREAS
  877. int "Maximum count of the CMA areas"
  878. depends on CMA
  879. default 20 if NUMA
  880. default 8
  881. help
  882. CMA allows to create CMA areas for particular purpose, mainly,
  883. used as device private area. This parameter sets the maximum
  884. number of CMA area in the system.
  885. If unsure, leave the default value "8" in UMA and "20" in NUMA.
  886. #
  887. # Select this config option from the architecture Kconfig, if available, to set
  888. # the max page order for physically contiguous allocations.
  889. #
  890. config ARCH_FORCE_MAX_ORDER
  891. int
  892. #
  893. # When ARCH_FORCE_MAX_ORDER is not defined,
  894. # the default page block order is MAX_PAGE_ORDER (10) as per
  895. # include/linux/mmzone.h.
  896. #
  897. config PAGE_BLOCK_MAX_ORDER
  898. int "Page Block Order Upper Limit"
  899. range 1 10 if ARCH_FORCE_MAX_ORDER = 0
  900. default 10 if ARCH_FORCE_MAX_ORDER = 0
  901. range 1 ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0
  902. default ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0
  903. help
  904. The page block order refers to the power of two number of pages that
  905. are physically contiguous and can have a migrate type associated to
  906. them. The maximum size of the page block order is at least limited by
  907. ARCH_FORCE_MAX_ORDER/MAX_PAGE_ORDER.
  908. This config adds a new upper limit of default page block
  909. order when the page block order is required to be smaller than
  910. ARCH_FORCE_MAX_ORDER/MAX_PAGE_ORDER or other limits
  911. (see include/linux/pageblock-flags.h for details).
  912. Reducing pageblock order can negatively impact THP generation
  913. success rate. If your workloads use THP heavily, please use this
  914. option with caution.
  915. Don't change if unsure.
  916. config MEM_SOFT_DIRTY
  917. bool "Track memory changes"
  918. depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
  919. select PROC_PAGE_MONITOR
  920. help
  921. This option enables memory changes tracking by introducing a
  922. soft-dirty bit on pte-s. This bit it set when someone writes
  923. into a page just as regular dirty bit, but unlike the latter
  924. it can be cleared by hands.
  925. See Documentation/admin-guide/mm/soft-dirty.rst for more details.
  926. config GENERIC_EARLY_IOREMAP
  927. bool
  928. config STACK_MAX_DEFAULT_SIZE_MB
  929. int "Default maximum user stack size for 32-bit processes (MB)"
  930. default 100
  931. range 8 2048
  932. depends on STACK_GROWSUP && (!64BIT || COMPAT)
  933. help
  934. This is the maximum stack size in Megabytes in the VM layout of 32-bit
  935. user processes when the stack grows upwards (currently only on parisc
  936. arch) when the RLIMIT_STACK hard limit is unlimited.
  937. A sane initial value is 100 MB.
  938. config DEFERRED_STRUCT_PAGE_INIT
  939. bool "Defer initialisation of struct pages to kthreads"
  940. depends on SPARSEMEM
  941. depends on !NEED_PER_CPU_KM
  942. depends on 64BIT
  943. depends on !KMSAN
  944. select PADATA
  945. help
  946. Ordinarily all struct pages are initialised during early boot in a
  947. single thread. On very large machines this can take a considerable
  948. amount of time. If this option is set, large machines will bring up
  949. a subset of memmap at boot and then initialise the rest in parallel.
  950. This has a potential performance impact on tasks running early in the
  951. lifetime of the system until these kthreads finish the
  952. initialisation.
  953. config PAGE_IDLE_FLAG
  954. bool
  955. select PAGE_EXTENSION if !64BIT
  956. help
  957. This adds PG_idle and PG_young flags to 'struct page'. PTE Accessed
  958. bit writers can set the state of the bit in the flags so that PTE
  959. Accessed bit readers may avoid disturbance.
  960. config IDLE_PAGE_TRACKING
  961. bool "Enable idle page tracking"
  962. depends on SYSFS && MMU
  963. select PAGE_IDLE_FLAG
  964. help
  965. This feature allows to estimate the amount of user pages that have
  966. not been touched during a given period of time. This information can
  967. be useful to tune memory cgroup limits and/or for job placement
  968. within a compute cluster.
  969. See Documentation/admin-guide/mm/idle_page_tracking.rst for
  970. more details.
  971. # Architectures which implement cpu_dcache_is_aliasing() to query
  972. # whether the data caches are aliased (VIVT or VIPT with dcache
  973. # aliasing) need to select this.
  974. config ARCH_HAS_CPU_CACHE_ALIASING
  975. bool
  976. config ARCH_HAS_CACHE_LINE_SIZE
  977. bool
  978. config ARCH_HAS_CURRENT_STACK_POINTER
  979. bool
  980. help
  981. In support of HARDENED_USERCOPY performing stack variable lifetime
  982. checking, an architecture-agnostic way to find the stack pointer
  983. is needed. Once an architecture defines an unsigned long global
  984. register alias named "current_stack_pointer", this config can be
  985. selected.
  986. config ARCH_HAS_ZONE_DMA_SET
  987. bool
  988. config ZONE_DMA
  989. bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
  990. default y if ARM64 || X86
  991. config ZONE_DMA32
  992. bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
  993. depends on !X86_32
  994. default y if ARM64
  995. config ZONE_DEVICE
  996. bool "Device memory (pmem, HMM, etc...) hotplug support"
  997. depends on MEMORY_HOTPLUG
  998. depends on MEMORY_HOTREMOVE
  999. depends on SPARSEMEM_VMEMMAP
  1000. select XARRAY_MULTI
  1001. help
  1002. Device memory hotplug support allows for establishing pmem,
  1003. or other device driver discovered memory regions, in the
  1004. memmap. This allows pfn_to_page() lookups of otherwise
  1005. "device-physical" addresses which is needed for DAX, PCI_P2PDMA, and
  1006. DEVICE_PRIVATE features among others.
  1007. Enabling this option will reduce the entropy of x86 KASLR memory
  1008. regions. For example - on a 46 bit system, the entropy goes down
  1009. from 16 bits to 15 bits. The actual reduction in entropy depends
  1010. on the physical address bits, on processor features, kernel config
  1011. (5 level page table) and physical memory present on the system.
  1012. #
  1013. # Helpers to mirror range of the CPU page tables of a process into device page
  1014. # tables.
  1015. #
  1016. config HMM_MIRROR
  1017. bool
  1018. depends on MMU
  1019. config GET_FREE_REGION
  1020. bool
  1021. config DEVICE_PRIVATE
  1022. bool "Unaddressable device memory (GPU memory, ...)"
  1023. depends on ZONE_DEVICE
  1024. select GET_FREE_REGION
  1025. help
  1026. Allows creation of struct pages to represent unaddressable device
  1027. memory; i.e., memory that is only accessible from the device (or
  1028. group of devices). You likely also want to select HMM_MIRROR.
  1029. config VMAP_PFN
  1030. bool
  1031. config ARCH_USES_HIGH_VMA_FLAGS
  1032. bool
  1033. config ARCH_HAS_PKEYS
  1034. bool
  1035. config ARCH_USES_PG_ARCH_2
  1036. bool
  1037. config ARCH_USES_PG_ARCH_3
  1038. bool
  1039. config VM_EVENT_COUNTERS
  1040. default y
  1041. bool "Enable VM event counters for /proc/vmstat" if EXPERT
  1042. help
  1043. VM event counters are needed for event counts to be shown.
  1044. This option allows the disabling of the VM event counters
  1045. on EXPERT systems. /proc/vmstat will only show page counts
  1046. if VM event counters are disabled.
  1047. config PERCPU_STATS
  1048. bool "Collect percpu memory statistics"
  1049. help
  1050. This feature collects and exposes statistics via debugfs. The
  1051. information includes global and per chunk statistics, which can
  1052. be used to help understand percpu memory usage.
  1053. config GUP_TEST
  1054. bool "Enable infrastructure for get_user_pages()-related unit tests"
  1055. depends on DEBUG_FS
  1056. help
  1057. Provides /sys/kernel/debug/gup_test, which in turn provides a way
  1058. to make ioctl calls that can launch kernel-based unit tests for
  1059. the get_user_pages*() and pin_user_pages*() family of API calls.
  1060. These tests include benchmark testing of the _fast variants of
  1061. get_user_pages*() and pin_user_pages*(), as well as smoke tests of
  1062. the non-_fast variants.
  1063. There is also a sub-test that allows running dump_page() on any
  1064. of up to eight pages (selected by command line args) within the
  1065. range of user-space addresses. These pages are either pinned via
  1066. pin_user_pages*(), or pinned via get_user_pages*(), as specified
  1067. by other command line arguments.
  1068. See tools/testing/selftests/mm/gup_test.c
  1069. comment "GUP_TEST needs to have DEBUG_FS enabled"
  1070. depends on !GUP_TEST && !DEBUG_FS
  1071. config GUP_GET_PXX_LOW_HIGH
  1072. bool
  1073. config DMAPOOL_TEST
  1074. tristate "Enable a module to run time tests on dma_pool"
  1075. depends on HAS_DMA
  1076. help
  1077. Provides a test module that will allocate and free many blocks of
  1078. various sizes and report how long it takes. This is intended to
  1079. provide a consistent way to measure how changes to the
  1080. dma_pool_alloc/free routines affect performance.
  1081. config ARCH_HAS_PTE_SPECIAL
  1082. bool
  1083. config MAPPING_DIRTY_HELPERS
  1084. bool
  1085. config KMAP_LOCAL
  1086. bool
  1087. config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
  1088. bool
  1089. config MEMFD_CREATE
  1090. bool "Enable memfd_create() system call" if EXPERT
  1091. config SECRETMEM
  1092. default y
  1093. bool "Enable memfd_secret() system call" if EXPERT
  1094. depends on ARCH_HAS_SET_DIRECT_MAP
  1095. help
  1096. Enable the memfd_secret() system call with the ability to create
  1097. memory areas visible only in the context of the owning process and
  1098. not mapped to other processes and other kernel page tables.
  1099. config ANON_VMA_NAME
  1100. bool "Anonymous VMA name support"
  1101. depends on PROC_FS && ADVISE_SYSCALLS && MMU
  1102. help
  1103. Allow naming anonymous virtual memory areas.
  1104. This feature allows assigning names to virtual memory areas. Assigned
  1105. names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
  1106. and help identifying individual anonymous memory areas.
  1107. Assigning a name to anonymous virtual memory area might prevent that
  1108. area from being merged with adjacent virtual memory areas due to the
  1109. difference in their name.
  1110. config HAVE_ARCH_USERFAULTFD_WP
  1111. bool
  1112. help
  1113. Arch has userfaultfd write protection support
  1114. config HAVE_ARCH_USERFAULTFD_MINOR
  1115. bool
  1116. help
  1117. Arch has userfaultfd minor fault support
  1118. menuconfig USERFAULTFD
  1119. bool "Enable userfaultfd() system call"
  1120. depends on MMU
  1121. help
  1122. Enable the userfaultfd() system call that allows to intercept and
  1123. handle page faults in userland.
  1124. if USERFAULTFD
  1125. config PTE_MARKER_UFFD_WP
  1126. bool "Userfaultfd write protection support for shmem/hugetlbfs"
  1127. default y
  1128. depends on HAVE_ARCH_USERFAULTFD_WP
  1129. help
  1130. Allows to create marker PTEs for userfaultfd write protection
  1131. purposes. It is required to enable userfaultfd write protection on
  1132. file-backed memory types like shmem and hugetlbfs.
  1133. endif # USERFAULTFD
  1134. # multi-gen LRU {
  1135. config LRU_GEN
  1136. bool "Multi-Gen LRU"
  1137. depends on MMU
  1138. # make sure folio->flags has enough spare bits
  1139. depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
  1140. help
  1141. A high performance LRU implementation to overcommit memory. See
  1142. Documentation/admin-guide/mm/multigen_lru.rst for details.
  1143. config LRU_GEN_ENABLED
  1144. bool "Enable by default"
  1145. depends on LRU_GEN
  1146. help
  1147. This option enables the multi-gen LRU by default.
  1148. config LRU_GEN_STATS
  1149. bool "Full stats for debugging"
  1150. depends on LRU_GEN
  1151. help
  1152. Do not enable this option unless you plan to look at historical stats
  1153. from evicted generations for debugging purpose.
  1154. This option has a per-memcg and per-node memory overhead.
  1155. config LRU_GEN_WALKS_MMU
  1156. def_bool y
  1157. depends on LRU_GEN && ARCH_HAS_HW_PTE_YOUNG
  1158. # }
  1159. config ARCH_SUPPORTS_PER_VMA_LOCK
  1160. def_bool n
  1161. config PER_VMA_LOCK
  1162. def_bool y
  1163. depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP
  1164. help
  1165. Allow per-vma locking during page fault handling.
  1166. This feature allows locking each virtual memory area separately when
  1167. handling page faults instead of taking mmap_lock.
  1168. config LOCK_MM_AND_FIND_VMA
  1169. bool
  1170. depends on !STACK_GROWSUP
  1171. config IOMMU_MM_DATA
  1172. bool
  1173. config EXECMEM
  1174. bool
  1175. config NUMA_MEMBLKS
  1176. bool
  1177. config NUMA_EMU
  1178. bool "NUMA emulation"
  1179. depends on NUMA_MEMBLKS
  1180. depends on X86 || GENERIC_ARCH_NUMA
  1181. help
  1182. Enable NUMA emulation. A flat machine will be split
  1183. into virtual nodes when booted with "numa=fake=N", where N is the
  1184. number of nodes. This is only useful for debugging.
  1185. config ARCH_HAS_USER_SHADOW_STACK
  1186. bool
  1187. help
  1188. The architecture has hardware support for userspace shadow call
  1189. stacks (eg, x86 CET, arm64 GCS or RISC-V Zicfiss).
  1190. config HAVE_ARCH_TLB_REMOVE_TABLE
  1191. def_bool n
  1192. config PT_RECLAIM
  1193. def_bool y
  1194. depends on MMU_GATHER_RCU_TABLE_FREE && !HAVE_ARCH_TLB_REMOVE_TABLE
  1195. help
  1196. Try to reclaim empty user page table pages in paths other than munmap
  1197. and exit_mmap path.
  1198. Note: now only empty user PTE page table pages will be reclaimed.
  1199. config FIND_NORMAL_PAGE
  1200. def_bool n
  1201. config ARCH_HAS_LAZY_MMU_MODE
  1202. bool
  1203. help
  1204. The architecture uses the lazy MMU mode. This allows changes to
  1205. MMU-related architectural state to be deferred until the mode is
  1206. exited. See <linux/pgtable.h> for details.
  1207. config LAZY_MMU_MODE_KUNIT_TEST
  1208. tristate "KUnit tests for the lazy MMU mode" if !KUNIT_ALL_TESTS
  1209. depends on ARCH_HAS_LAZY_MMU_MODE
  1210. depends on KUNIT
  1211. default KUNIT_ALL_TESTS
  1212. help
  1213. Enable this option to check that the lazy MMU mode interface behaves
  1214. as expected. Only tests for the generic interface are included (not
  1215. architecture-specific behaviours).
  1216. If unsure, say N.
  1217. source "mm/damon/Kconfig"
  1218. endmenu