Kconfig 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227
  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. config ZPOOL
  10. bool
  11. menuconfig SWAP
  12. bool "Support for paging of anonymous memory (swap)"
  13. depends on MMU && BLOCK && !ARCH_NO_SWAP
  14. default y
  15. help
  16. This option allows you to choose whether you want to have support
  17. for so called swap devices or swap files in your kernel that are
  18. used to provide more virtual memory than the actual RAM present
  19. in your computer. If unsure say Y.
  20. config ZSWAP
  21. bool "Compressed cache for swap pages"
  22. depends on SWAP
  23. select FRONTSWAP
  24. select CRYPTO
  25. select ZPOOL
  26. help
  27. A lightweight compressed cache for swap pages. It takes
  28. pages that are in the process of being swapped out and attempts to
  29. compress them into a dynamically allocated RAM-based memory pool.
  30. This can result in a significant I/O reduction on swap device and,
  31. in the case where decompressing from RAM is faster than swap device
  32. reads, can also improve workload performance.
  33. config ZSWAP_DEFAULT_ON
  34. bool "Enable the compressed cache for swap pages by default"
  35. depends on ZSWAP
  36. help
  37. If selected, the compressed cache for swap pages will be enabled
  38. at boot, otherwise it will be disabled.
  39. The selection made here can be overridden by using the kernel
  40. command line 'zswap.enabled=' option.
  41. choice
  42. prompt "Default compressor"
  43. depends on ZSWAP
  44. default ZSWAP_COMPRESSOR_DEFAULT_LZO
  45. help
  46. Selects the default compression algorithm for the compressed cache
  47. for swap pages.
  48. For an overview what kind of performance can be expected from
  49. a particular compression algorithm please refer to the benchmarks
  50. available at the following LWN page:
  51. https://lwn.net/Articles/751795/
  52. If in doubt, select 'LZO'.
  53. The selection made here can be overridden by using the kernel
  54. command line 'zswap.compressor=' option.
  55. config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
  56. bool "Deflate"
  57. select CRYPTO_DEFLATE
  58. help
  59. Use the Deflate algorithm as the default compression algorithm.
  60. config ZSWAP_COMPRESSOR_DEFAULT_LZO
  61. bool "LZO"
  62. select CRYPTO_LZO
  63. help
  64. Use the LZO algorithm as the default compression algorithm.
  65. config ZSWAP_COMPRESSOR_DEFAULT_842
  66. bool "842"
  67. select CRYPTO_842
  68. help
  69. Use the 842 algorithm as the default compression algorithm.
  70. config ZSWAP_COMPRESSOR_DEFAULT_LZ4
  71. bool "LZ4"
  72. select CRYPTO_LZ4
  73. help
  74. Use the LZ4 algorithm as the default compression algorithm.
  75. config ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
  76. bool "LZ4HC"
  77. select CRYPTO_LZ4HC
  78. help
  79. Use the LZ4HC algorithm as the default compression algorithm.
  80. config ZSWAP_COMPRESSOR_DEFAULT_ZSTD
  81. bool "zstd"
  82. select CRYPTO_ZSTD
  83. help
  84. Use the zstd algorithm as the default compression algorithm.
  85. endchoice
  86. config ZSWAP_COMPRESSOR_DEFAULT
  87. string
  88. depends on ZSWAP
  89. default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
  90. default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
  91. default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
  92. default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
  93. default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
  94. default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
  95. default ""
  96. choice
  97. prompt "Default allocator"
  98. depends on ZSWAP
  99. default ZSWAP_ZPOOL_DEFAULT_ZBUD
  100. help
  101. Selects the default allocator for the compressed cache for
  102. swap pages.
  103. The default is 'zbud' for compatibility, however please do
  104. read the description of each of the allocators below before
  105. making a right choice.
  106. The selection made here can be overridden by using the kernel
  107. command line 'zswap.zpool=' option.
  108. config ZSWAP_ZPOOL_DEFAULT_ZBUD
  109. bool "zbud"
  110. select ZBUD
  111. help
  112. Use the zbud allocator as the default allocator.
  113. config ZSWAP_ZPOOL_DEFAULT_Z3FOLD
  114. bool "z3fold"
  115. select Z3FOLD
  116. help
  117. Use the z3fold allocator as the default allocator.
  118. config ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
  119. bool "zsmalloc"
  120. select ZSMALLOC
  121. help
  122. Use the zsmalloc allocator as the default allocator.
  123. endchoice
  124. config ZSWAP_ZPOOL_DEFAULT
  125. string
  126. depends on ZSWAP
  127. default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD
  128. default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD
  129. default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
  130. default ""
  131. config ZBUD
  132. tristate "2:1 compression allocator (zbud)"
  133. depends on ZSWAP
  134. help
  135. A special purpose allocator for storing compressed pages.
  136. It is designed to store up to two compressed pages per physical
  137. page. While this design limits storage density, it has simple and
  138. deterministic reclaim properties that make it preferable to a higher
  139. density approach when reclaim will be used.
  140. config Z3FOLD
  141. tristate "3:1 compression allocator (z3fold)"
  142. depends on ZSWAP
  143. help
  144. A special purpose allocator for storing compressed pages.
  145. It is designed to store up to three compressed pages per physical
  146. page. It is a ZBUD derivative so the simplicity and determinism are
  147. still there.
  148. config ZSMALLOC
  149. tristate
  150. prompt "N:1 compression allocator (zsmalloc)" if ZSWAP
  151. depends on MMU
  152. help
  153. zsmalloc is a slab-based memory allocator designed to store
  154. pages of various compression levels efficiently. It achieves
  155. the highest storage density with the least amount of fragmentation.
  156. config ZSMALLOC_STAT
  157. bool "Export zsmalloc statistics"
  158. depends on ZSMALLOC
  159. select DEBUG_FS
  160. help
  161. This option enables code in the zsmalloc to collect various
  162. statistics about what's happening in zsmalloc and exports that
  163. information to userspace via debugfs.
  164. If unsure, say N.
  165. menu "SLAB allocator options"
  166. choice
  167. prompt "Choose SLAB allocator"
  168. default SLUB
  169. help
  170. This option allows to select a slab allocator.
  171. config SLAB
  172. bool "SLAB"
  173. depends on !PREEMPT_RT
  174. select HAVE_HARDENED_USERCOPY_ALLOCATOR
  175. help
  176. The regular slab allocator that is established and known to work
  177. well in all environments. It organizes cache hot objects in
  178. per cpu and per node queues.
  179. config SLUB
  180. bool "SLUB (Unqueued Allocator)"
  181. select HAVE_HARDENED_USERCOPY_ALLOCATOR
  182. help
  183. SLUB is a slab allocator that minimizes cache line usage
  184. instead of managing queues of cached objects (SLAB approach).
  185. Per cpu caching is realized using slabs of objects instead
  186. of queues of objects. SLUB can use memory efficiently
  187. and has enhanced diagnostics. SLUB is the default choice for
  188. a slab allocator.
  189. config SLOB
  190. depends on EXPERT
  191. bool "SLOB (Simple Allocator)"
  192. depends on !PREEMPT_RT
  193. help
  194. SLOB replaces the stock allocator with a drastically simpler
  195. allocator. SLOB is generally more space efficient but
  196. does not perform as well on large systems.
  197. endchoice
  198. config SLAB_MERGE_DEFAULT
  199. bool "Allow slab caches to be merged"
  200. default y
  201. depends on SLAB || SLUB
  202. help
  203. For reduced kernel memory fragmentation, slab caches can be
  204. merged when they share the same size and other characteristics.
  205. This carries a risk of kernel heap overflows being able to
  206. overwrite objects from merged caches (and more easily control
  207. cache layout), which makes such heap attacks easier to exploit
  208. by attackers. By keeping caches unmerged, these kinds of exploits
  209. can usually only damage objects in the same cache. To disable
  210. merging at runtime, "slab_nomerge" can be passed on the kernel
  211. command line.
  212. config SLAB_FREELIST_RANDOM
  213. bool "Randomize slab freelist"
  214. depends on SLAB || SLUB
  215. help
  216. Randomizes the freelist order used on creating new pages. This
  217. security feature reduces the predictability of the kernel slab
  218. allocator against heap overflows.
  219. config SLAB_FREELIST_HARDENED
  220. bool "Harden slab freelist metadata"
  221. depends on SLAB || SLUB
  222. help
  223. Many kernel heap attacks try to target slab cache metadata and
  224. other infrastructure. This options makes minor performance
  225. sacrifices to harden the kernel slab allocator against common
  226. freelist exploit methods. Some slab implementations have more
  227. sanity-checking than others. This option is most effective with
  228. CONFIG_SLUB.
  229. config SLUB_STATS
  230. default n
  231. bool "Enable SLUB performance statistics"
  232. depends on SLUB && SYSFS
  233. help
  234. SLUB statistics are useful to debug SLUBs allocation behavior in
  235. order find ways to optimize the allocator. This should never be
  236. enabled for production use since keeping statistics slows down
  237. the allocator by a few percentage points. The slabinfo command
  238. supports the determination of the most active slabs to figure
  239. out which slabs are relevant to a particular load.
  240. Try running: slabinfo -DA
  241. config SLUB_CPU_PARTIAL
  242. default y
  243. depends on SLUB && SMP
  244. bool "SLUB per cpu partial cache"
  245. help
  246. Per cpu partial caches accelerate objects allocation and freeing
  247. that is local to a processor at the price of more indeterminism
  248. in the latency of the free. On overflow these caches will be cleared
  249. which requires the taking of locks that may cause latency spikes.
  250. Typically one would choose no for a realtime system.
  251. endmenu # SLAB allocator options
  252. config SHUFFLE_PAGE_ALLOCATOR
  253. bool "Page allocator randomization"
  254. default SLAB_FREELIST_RANDOM && ACPI_NUMA
  255. help
  256. Randomization of the page allocator improves the average
  257. utilization of a direct-mapped memory-side-cache. See section
  258. 5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
  259. 6.2a specification for an example of how a platform advertises
  260. the presence of a memory-side-cache. There are also incidental
  261. security benefits as it reduces the predictability of page
  262. allocations to compliment SLAB_FREELIST_RANDOM, but the
  263. default granularity of shuffling on the "MAX_ORDER - 1" i.e,
  264. 10th order of pages is selected based on cache utilization
  265. benefits on x86.
  266. While the randomization improves cache utilization it may
  267. negatively impact workloads on platforms without a cache. For
  268. this reason, by default, the randomization is enabled only
  269. after runtime detection of a direct-mapped memory-side-cache.
  270. Otherwise, the randomization may be force enabled with the
  271. 'page_alloc.shuffle' kernel command line parameter.
  272. Say Y if unsure.
  273. config COMPAT_BRK
  274. bool "Disable heap randomization"
  275. default y
  276. help
  277. Randomizing heap placement makes heap exploits harder, but it
  278. also breaks ancient binaries (including anything libc5 based).
  279. This option changes the bootup default to heap randomization
  280. disabled, and can be overridden at runtime by setting
  281. /proc/sys/kernel/randomize_va_space to 2.
  282. On non-ancient distros (post-2000 ones) N is usually a safe choice.
  283. config MMAP_ALLOW_UNINITIALIZED
  284. bool "Allow mmapped anonymous memory to be uninitialized"
  285. depends on EXPERT && !MMU
  286. default n
  287. help
  288. Normally, and according to the Linux spec, anonymous memory obtained
  289. from mmap() has its contents cleared before it is passed to
  290. userspace. Enabling this config option allows you to request that
  291. mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
  292. providing a huge performance boost. If this option is not enabled,
  293. then the flag will be ignored.
  294. This is taken advantage of by uClibc's malloc(), and also by
  295. ELF-FDPIC binfmt's brk and stack allocator.
  296. Because of the obvious security issues, this option should only be
  297. enabled on embedded devices where you control what is run in
  298. userspace. Since that isn't generally a problem on no-MMU systems,
  299. it is normally safe to say Y here.
  300. See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
  301. config SELECT_MEMORY_MODEL
  302. def_bool y
  303. depends on ARCH_SELECT_MEMORY_MODEL
  304. choice
  305. prompt "Memory model"
  306. depends on SELECT_MEMORY_MODEL
  307. default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
  308. default FLATMEM_MANUAL
  309. help
  310. This option allows you to change some of the ways that
  311. Linux manages its memory internally. Most users will
  312. only have one option here selected by the architecture
  313. configuration. This is normal.
  314. config FLATMEM_MANUAL
  315. bool "Flat Memory"
  316. depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
  317. help
  318. This option is best suited for non-NUMA systems with
  319. flat address space. The FLATMEM is the most efficient
  320. system in terms of performance and resource consumption
  321. and it is the best option for smaller systems.
  322. For systems that have holes in their physical address
  323. spaces and for features like NUMA and memory hotplug,
  324. choose "Sparse Memory".
  325. If unsure, choose this option (Flat Memory) over any other.
  326. config SPARSEMEM_MANUAL
  327. bool "Sparse Memory"
  328. depends on ARCH_SPARSEMEM_ENABLE
  329. help
  330. This will be the only option for some systems, including
  331. memory hot-plug systems. This is normal.
  332. This option provides efficient support for systems with
  333. holes is their physical address space and allows memory
  334. hot-plug and hot-remove.
  335. If unsure, choose "Flat Memory" over this option.
  336. endchoice
  337. config SPARSEMEM
  338. def_bool y
  339. depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
  340. config FLATMEM
  341. def_bool y
  342. depends on !SPARSEMEM || FLATMEM_MANUAL
  343. #
  344. # SPARSEMEM_EXTREME (which is the default) does some bootmem
  345. # allocations when sparse_init() is called. If this cannot
  346. # be done on your architecture, select this option. However,
  347. # statically allocating the mem_section[] array can potentially
  348. # consume vast quantities of .bss, so be careful.
  349. #
  350. # This option will also potentially produce smaller runtime code
  351. # with gcc 3.4 and later.
  352. #
  353. config SPARSEMEM_STATIC
  354. bool
  355. #
  356. # Architecture platforms which require a two level mem_section in SPARSEMEM
  357. # must select this option. This is usually for architecture platforms with
  358. # an extremely sparse physical address space.
  359. #
  360. config SPARSEMEM_EXTREME
  361. def_bool y
  362. depends on SPARSEMEM && !SPARSEMEM_STATIC
  363. config SPARSEMEM_VMEMMAP_ENABLE
  364. bool
  365. config SPARSEMEM_VMEMMAP
  366. bool "Sparse Memory virtual memmap"
  367. depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
  368. default y
  369. help
  370. SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
  371. pfn_to_page and page_to_pfn operations. This is the most
  372. efficient option when sufficient kernel resources are available.
  373. config HAVE_MEMBLOCK_PHYS_MAP
  374. bool
  375. config HAVE_FAST_GUP
  376. depends on MMU
  377. bool
  378. # Don't discard allocated memory used to track "memory" and "reserved" memblocks
  379. # after early boot, so it can still be used to test for validity of memory.
  380. # Also, memblocks are updated with memory hot(un)plug.
  381. config ARCH_KEEP_MEMBLOCK
  382. bool
  383. # Keep arch NUMA mapping infrastructure post-init.
  384. config NUMA_KEEP_MEMINFO
  385. bool
  386. config MEMORY_ISOLATION
  387. bool
  388. # IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked
  389. # IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via
  390. # /dev/mem.
  391. config EXCLUSIVE_SYSTEM_RAM
  392. def_bool y
  393. depends on !DEVMEM || STRICT_DEVMEM
  394. #
  395. # Only be set on architectures that have completely implemented memory hotplug
  396. # feature. If you are not sure, don't touch it.
  397. #
  398. config HAVE_BOOTMEM_INFO_NODE
  399. def_bool n
  400. config ARCH_ENABLE_MEMORY_HOTPLUG
  401. bool
  402. config ARCH_ENABLE_MEMORY_HOTREMOVE
  403. bool
  404. # eventually, we can have this option just 'select SPARSEMEM'
  405. menuconfig MEMORY_HOTPLUG
  406. bool "Memory hotplug"
  407. select MEMORY_ISOLATION
  408. depends on SPARSEMEM
  409. depends on ARCH_ENABLE_MEMORY_HOTPLUG
  410. depends on 64BIT
  411. select NUMA_KEEP_MEMINFO if NUMA
  412. if MEMORY_HOTPLUG
  413. config MEMORY_HOTPLUG_DEFAULT_ONLINE
  414. bool "Online the newly added memory blocks by default"
  415. depends on MEMORY_HOTPLUG
  416. help
  417. This option sets the default policy setting for memory hotplug
  418. onlining policy (/sys/devices/system/memory/auto_online_blocks) which
  419. determines what happens to newly added memory regions. Policy setting
  420. can always be changed at runtime.
  421. See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
  422. Say Y here if you want all hot-plugged memory blocks to appear in
  423. 'online' state by default.
  424. Say N here if you want the default policy to keep all hot-plugged
  425. memory blocks in 'offline' state.
  426. config MEMORY_HOTREMOVE
  427. bool "Allow for memory hot remove"
  428. select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
  429. depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
  430. depends on MIGRATION
  431. config MHP_MEMMAP_ON_MEMORY
  432. def_bool y
  433. depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
  434. depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
  435. config MEMORY_HOTPLUG_SUBSECTIONS
  436. bool "Allow memory to be mapped at a subsection granularity"
  437. depends on MEMORY_HOTPLUG
  438. help
  439. The default functions used for adding memory, add_memory(), only maps
  440. memory at 128 MB chunks and has a 256 KB overhead in the page table
  441. space it consumes (assuming the logical mapping is not using block
  442. mappings). For low memory environments where we don't want to map
  443. large amounts of memory, we add downstream functions that add and
  444. remove memory on a subsection-size granularity.
  445. If unsure, say N.
  446. endif # MEMORY_HOTPLUG
  447. # Heavily threaded applications may benefit from splitting the mm-wide
  448. # page_table_lock, so that faults on different parts of the user address
  449. # space can be handled with less contention: split it at this NR_CPUS.
  450. # Default to 4 for wider testing, though 8 might be more appropriate.
  451. # ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
  452. # PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
  453. # SPARC32 allocates multiple pte tables within a single page, and therefore
  454. # a per-page lock leads to problems when multiple tables need to be locked
  455. # at the same time (e.g. copy_page_range()).
  456. # DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
  457. #
  458. config SPLIT_PTLOCK_CPUS
  459. int
  460. default "999999" if !MMU
  461. default "999999" if ARM && !CPU_CACHE_VIPT
  462. default "999999" if PARISC && !PA20
  463. default "999999" if SPARC32
  464. default "4"
  465. config ARCH_ENABLE_SPLIT_PMD_PTLOCK
  466. bool
  467. #
  468. # support for memory balloon
  469. config MEMORY_BALLOON
  470. bool
  471. #
  472. # support for memory relinquish
  473. config MEMORY_RELINQUISH
  474. def_bool y
  475. depends on ARCH_HAS_MEM_RELINQUISH
  476. depends on MEMORY_BALLOON || PAGE_REPORTING
  477. #
  478. # support for memory balloon compaction
  479. config BALLOON_COMPACTION
  480. bool "Allow for balloon memory compaction/migration"
  481. def_bool y
  482. depends on COMPACTION && MEMORY_BALLOON
  483. help
  484. Memory fragmentation introduced by ballooning might reduce
  485. significantly the number of 2MB contiguous memory blocks that can be
  486. used within a guest, thus imposing performance penalties associated
  487. with the reduced number of transparent huge pages that could be used
  488. by the guest workload. Allowing the compaction & migration for memory
  489. pages enlisted as being part of memory balloon devices avoids the
  490. scenario aforementioned and helps improving memory defragmentation.
  491. #
  492. # support for memory compaction
  493. config COMPACTION
  494. bool "Allow for memory compaction"
  495. def_bool y
  496. select MIGRATION
  497. depends on MMU
  498. help
  499. Compaction is the only memory management component to form
  500. high order (larger physically contiguous) memory blocks
  501. reliably. The page allocator relies on compaction heavily and
  502. the lack of the feature can lead to unexpected OOM killer
  503. invocations for high order memory requests. You shouldn't
  504. disable this option unless there really is a strong reason for
  505. it and then we would be really interested to hear about that at
  506. [email protected].
  507. config COMPACT_UNEVICTABLE_DEFAULT
  508. int
  509. depends on COMPACTION
  510. default 0 if PREEMPT_RT
  511. default 1
  512. #
  513. # support for free page reporting
  514. config PAGE_REPORTING
  515. bool "Free page reporting"
  516. def_bool n
  517. help
  518. Free page reporting allows for the incremental acquisition of
  519. free pages from the buddy allocator for the purpose of reporting
  520. those pages to another entity, such as a hypervisor, so that the
  521. memory can be freed within the host for other uses.
  522. #
  523. # support for page migration
  524. #
  525. config MIGRATION
  526. bool "Page migration"
  527. def_bool y
  528. depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
  529. help
  530. Allows the migration of the physical location of pages of processes
  531. while the virtual addresses are not changed. This is useful in
  532. two situations. The first is on NUMA systems to put pages nearer
  533. to the processors accessing. The second is when allocating huge
  534. pages as migration can relocate pages to satisfy a huge page
  535. allocation instead of reclaiming.
  536. config DEVICE_MIGRATION
  537. def_bool MIGRATION && ZONE_DEVICE
  538. config ARCH_ENABLE_HUGEPAGE_MIGRATION
  539. bool
  540. config ARCH_ENABLE_THP_MIGRATION
  541. bool
  542. config HUGETLB_PAGE_SIZE_VARIABLE
  543. def_bool n
  544. help
  545. Allows the pageblock_order value to be dynamic instead of just standard
  546. HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
  547. on a platform.
  548. Note that the pageblock_order cannot exceed MAX_ORDER - 1 and will be
  549. clamped down to MAX_ORDER - 1.
  550. config CONTIG_ALLOC
  551. def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
  552. config PHYS_ADDR_T_64BIT
  553. def_bool 64BIT
  554. config BOUNCE
  555. bool "Enable bounce buffers"
  556. default y
  557. depends on BLOCK && MMU && HIGHMEM
  558. help
  559. Enable bounce buffers for devices that cannot access the full range of
  560. memory available to the CPU. Enabled by default when HIGHMEM is
  561. selected, but you may say n to override this.
  562. config MMU_NOTIFIER
  563. bool
  564. select SRCU
  565. select INTERVAL_TREE
  566. config KSM
  567. bool "Enable KSM for page merging"
  568. depends on MMU
  569. select XXHASH
  570. help
  571. Enable Kernel Samepage Merging: KSM periodically scans those areas
  572. of an application's address space that an app has advised may be
  573. mergeable. When it finds pages of identical content, it replaces
  574. the many instances by a single page with that content, so
  575. saving memory until one or another app needs to modify the content.
  576. Recommended for use with KVM, or with other duplicative applications.
  577. See Documentation/mm/ksm.rst for more information: KSM is inactive
  578. until a program has madvised that an area is MADV_MERGEABLE, and
  579. root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
  580. config DEFAULT_MMAP_MIN_ADDR
  581. int "Low address space to protect from user allocation"
  582. depends on MMU
  583. default 4096
  584. help
  585. This is the portion of low virtual memory which should be protected
  586. from userspace allocation. Keeping a user from writing to low pages
  587. can help reduce the impact of kernel NULL pointer bugs.
  588. For most ia64, ppc64 and x86 users with lots of address space
  589. a value of 65536 is reasonable and should cause no problems.
  590. On arm and other archs it should not be higher than 32768.
  591. Programs which use vm86 functionality or have some need to map
  592. this low address space will need CAP_SYS_RAWIO or disable this
  593. protection by setting the value to 0.
  594. This value can be changed after boot using the
  595. /proc/sys/vm/mmap_min_addr tunable.
  596. config ARCH_SUPPORTS_MEMORY_FAILURE
  597. bool
  598. config MEMORY_FAILURE
  599. depends on MMU
  600. depends on ARCH_SUPPORTS_MEMORY_FAILURE
  601. bool "Enable recovery from hardware memory errors"
  602. select MEMORY_ISOLATION
  603. select RAS
  604. help
  605. Enables code to recover from some memory failures on systems
  606. with MCA recovery. This allows a system to continue running
  607. even when some of its memory has uncorrected errors. This requires
  608. special hardware support and typically ECC memory.
  609. config HWPOISON_INJECT
  610. tristate "HWPoison pages injector"
  611. depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
  612. select PROC_PAGE_MONITOR
  613. config NOMMU_INITIAL_TRIM_EXCESS
  614. int "Turn on mmap() excess space trimming before booting"
  615. depends on !MMU
  616. default 1
  617. help
  618. The NOMMU mmap() frequently needs to allocate large contiguous chunks
  619. of memory on which to store mappings, but it can only ask the system
  620. allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
  621. more than it requires. To deal with this, mmap() is able to trim off
  622. the excess and return it to the allocator.
  623. If trimming is enabled, the excess is trimmed off and returned to the
  624. system allocator, which can cause extra fragmentation, particularly
  625. if there are a lot of transient processes.
  626. If trimming is disabled, the excess is kept, but not used, which for
  627. long-term mappings means that the space is wasted.
  628. Trimming can be dynamically controlled through a sysctl option
  629. (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
  630. excess pages there must be before trimming should occur, or zero if
  631. no trimming is to occur.
  632. This option specifies the initial value of this option. The default
  633. of 1 says that all excess pages should be trimmed.
  634. See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
  635. config ARCH_WANT_GENERAL_HUGETLB
  636. bool
  637. config ARCH_WANTS_THP_SWAP
  638. def_bool n
  639. menuconfig TRANSPARENT_HUGEPAGE
  640. bool "Transparent Hugepage Support"
  641. depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
  642. select COMPACTION
  643. select XARRAY_MULTI
  644. help
  645. Transparent Hugepages allows the kernel to use huge pages and
  646. huge tlb transparently to the applications whenever possible.
  647. This feature can improve computing performance to certain
  648. applications by speeding up page faults during memory
  649. allocation, by reducing the number of tlb misses and by speeding
  650. up the pagetable walking.
  651. If memory constrained on embedded, you may want to say N.
  652. if TRANSPARENT_HUGEPAGE
  653. choice
  654. prompt "Transparent Hugepage Support sysfs defaults"
  655. depends on TRANSPARENT_HUGEPAGE
  656. default TRANSPARENT_HUGEPAGE_ALWAYS
  657. help
  658. Selects the sysfs defaults for Transparent Hugepage Support.
  659. config TRANSPARENT_HUGEPAGE_ALWAYS
  660. bool "always"
  661. help
  662. Enabling Transparent Hugepage always, can increase the
  663. memory footprint of applications without a guaranteed
  664. benefit but it will work automatically for all applications.
  665. config TRANSPARENT_HUGEPAGE_MADVISE
  666. bool "madvise"
  667. help
  668. Enabling Transparent Hugepage madvise, will only provide a
  669. performance improvement benefit to the applications using
  670. madvise(MADV_HUGEPAGE) but it won't risk to increase the
  671. memory footprint of applications without a guaranteed
  672. benefit.
  673. endchoice
  674. config THP_SWAP
  675. def_bool y
  676. depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP
  677. help
  678. Swap transparent huge pages in one piece, without splitting.
  679. XXX: For now, swap cluster backing transparent huge page
  680. will be split after swapout.
  681. For selection by architectures with reasonable THP sizes.
  682. config READ_ONLY_THP_FOR_FS
  683. bool "Read-only THP for filesystems (EXPERIMENTAL)"
  684. depends on TRANSPARENT_HUGEPAGE && SHMEM
  685. help
  686. Allow khugepaged to put read-only file-backed pages in THP.
  687. This is marked experimental because it is a new feature. Write
  688. support of file THPs will be developed in the next few release
  689. cycles.
  690. endif # TRANSPARENT_HUGEPAGE
  691. #
  692. # UP and nommu archs use km based percpu allocator
  693. #
  694. config NEED_PER_CPU_KM
  695. depends on !SMP || !MMU
  696. bool
  697. default y
  698. config NEED_PER_CPU_EMBED_FIRST_CHUNK
  699. bool
  700. config NEED_PER_CPU_PAGE_FIRST_CHUNK
  701. bool
  702. config USE_PERCPU_NUMA_NODE_ID
  703. bool
  704. config HAVE_SETUP_PER_CPU_AREA
  705. bool
  706. config CLEANCACHE
  707. bool "Enable cleancache driver to cache clean pages if tmem is present"
  708. help
  709. Cleancache can be thought of as a page-granularity victim cache
  710. for clean pages that the kernel's pageframe replacement algorithm
  711. (PFRA) would like to keep around, but can't since there isn't enough
  712. memory. So when the PFRA "evicts" a page, it first attempts to use
  713. cleancache code to put the data contained in that page into
  714. "transcendent memory", memory that is not directly accessible or
  715. addressable by the kernel and is of unknown and possibly
  716. time-varying size. And when a cleancache-enabled
  717. filesystem wishes to access a page in a file on disk, it first
  718. checks cleancache to see if it already contains it; if it does,
  719. the page is copied into the kernel and a disk access is avoided.
  720. When a transcendent memory driver is available (such as zcache or
  721. Xen transcendent memory), a significant I/O reduction
  722. may be achieved. When none is available, all cleancache calls
  723. are reduced to a single pointer-compare-against-NULL resulting
  724. in a negligible performance hit.
  725. If unsure, say Y to enable cleancache
  726. config FRONTSWAP
  727. bool
  728. config CMA
  729. bool "Contiguous Memory Allocator"
  730. depends on MMU
  731. select MIGRATION
  732. select MEMORY_ISOLATION
  733. help
  734. This enables the Contiguous Memory Allocator which allows other
  735. subsystems to allocate big physically-contiguous blocks of memory.
  736. CMA reserves a region of memory and allows only movable pages to
  737. be allocated from it. This way, the kernel can use the memory for
  738. pagecache and when a subsystem requests for contiguous area, the
  739. allocated pages are migrated away to serve the contiguous request.
  740. If unsure, say "n".
  741. config CMA_DEBUG
  742. bool "CMA debug messages (DEVELOPMENT)"
  743. depends on DEBUG_KERNEL && CMA
  744. help
  745. Turns on debug messages in CMA. This produces KERN_DEBUG
  746. messages for every CMA call as well as various messages while
  747. processing calls such as dma_alloc_from_contiguous().
  748. This option does not affect warning and error messages.
  749. config CMA_DEBUGFS
  750. bool "CMA debugfs interface"
  751. depends on CMA && DEBUG_FS
  752. help
  753. Turns on the DebugFS interface for CMA.
  754. config CMA_SYSFS
  755. bool "CMA information through sysfs interface"
  756. depends on CMA && SYSFS
  757. help
  758. This option exposes some sysfs attributes to get information
  759. from CMA.
  760. config CMA_AREAS
  761. int "Maximum count of the CMA areas"
  762. depends on CMA
  763. default 19 if NUMA
  764. default 7
  765. help
  766. CMA allows to create CMA areas for particular purpose, mainly,
  767. used as device private area. This parameter sets the maximum
  768. number of CMA area in the system.
  769. If unsure, leave the default value "7" in UMA and "19" in NUMA.
  770. config MEM_SOFT_DIRTY
  771. bool "Track memory changes"
  772. depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
  773. select PROC_PAGE_MONITOR
  774. help
  775. This option enables memory changes tracking by introducing a
  776. soft-dirty bit on pte-s. This bit it set when someone writes
  777. into a page just as regular dirty bit, but unlike the latter
  778. it can be cleared by hands.
  779. See Documentation/admin-guide/mm/soft-dirty.rst for more details.
  780. config GENERIC_EARLY_IOREMAP
  781. bool
  782. config STACK_MAX_DEFAULT_SIZE_MB
  783. int "Default maximum user stack size for 32-bit processes (MB)"
  784. default 100
  785. range 8 2048
  786. depends on STACK_GROWSUP && (!64BIT || COMPAT)
  787. help
  788. This is the maximum stack size in Megabytes in the VM layout of 32-bit
  789. user processes when the stack grows upwards (currently only on parisc
  790. arch) when the RLIMIT_STACK hard limit is unlimited.
  791. A sane initial value is 100 MB.
  792. config DEFERRED_STRUCT_PAGE_INIT
  793. bool "Defer initialisation of struct pages to kthreads"
  794. depends on SPARSEMEM
  795. depends on !NEED_PER_CPU_KM
  796. depends on 64BIT
  797. select PADATA
  798. help
  799. Ordinarily all struct pages are initialised during early boot in a
  800. single thread. On very large machines this can take a considerable
  801. amount of time. If this option is set, large machines will bring up
  802. a subset of memmap at boot and then initialise the rest in parallel.
  803. This has a potential performance impact on tasks running early in the
  804. lifetime of the system until these kthreads finish the
  805. initialisation.
  806. config PAGE_IDLE_FLAG
  807. bool
  808. select PAGE_EXTENSION if !64BIT
  809. help
  810. This adds PG_idle and PG_young flags to 'struct page'. PTE Accessed
  811. bit writers can set the state of the bit in the flags so that PTE
  812. Accessed bit readers may avoid disturbance.
  813. config IDLE_PAGE_TRACKING
  814. bool "Enable idle page tracking"
  815. depends on SYSFS && MMU
  816. select PAGE_IDLE_FLAG
  817. help
  818. This feature allows to estimate the amount of user pages that have
  819. not been touched during a given period of time. This information can
  820. be useful to tune memory cgroup limits and/or for job placement
  821. within a compute cluster.
  822. See Documentation/admin-guide/mm/idle_page_tracking.rst for
  823. more details.
  824. config ARCH_HAS_CACHE_LINE_SIZE
  825. bool
  826. config ARCH_HAS_CURRENT_STACK_POINTER
  827. bool
  828. help
  829. In support of HARDENED_USERCOPY performing stack variable lifetime
  830. checking, an architecture-agnostic way to find the stack pointer
  831. is needed. Once an architecture defines an unsigned long global
  832. register alias named "current_stack_pointer", this config can be
  833. selected.
  834. config ARCH_HAS_PTE_DEVMAP
  835. bool
  836. config ARCH_HAS_ZONE_DMA_SET
  837. bool
  838. config ZONE_DMA
  839. bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
  840. default y if ARM64 || X86
  841. config ZONE_DMA32
  842. bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
  843. depends on !X86_32
  844. default y if ARM64
  845. config ZONE_DEVICE
  846. bool "Device memory (pmem, HMM, etc...) hotplug support"
  847. depends on MEMORY_HOTPLUG
  848. depends on MEMORY_HOTREMOVE
  849. depends on SPARSEMEM_VMEMMAP
  850. depends on ARCH_HAS_PTE_DEVMAP
  851. select XARRAY_MULTI
  852. help
  853. Device memory hotplug support allows for establishing pmem,
  854. or other device driver discovered memory regions, in the
  855. memmap. This allows pfn_to_page() lookups of otherwise
  856. "device-physical" addresses which is needed for using a DAX
  857. mapping in an O_DIRECT operation, among other things.
  858. If FS_DAX is enabled, then say Y.
  859. #
  860. # Helpers to mirror range of the CPU page tables of a process into device page
  861. # tables.
  862. #
  863. config HMM_MIRROR
  864. bool
  865. depends on MMU
  866. config GET_FREE_REGION
  867. depends on SPARSEMEM
  868. bool
  869. config DEVICE_PRIVATE
  870. bool "Unaddressable device memory (GPU memory, ...)"
  871. depends on ZONE_DEVICE
  872. select GET_FREE_REGION
  873. help
  874. Allows creation of struct pages to represent unaddressable device
  875. memory; i.e., memory that is only accessible from the device (or
  876. group of devices). You likely also want to select HMM_MIRROR.
  877. config VMAP_PFN
  878. bool
  879. config ARCH_USES_HIGH_VMA_FLAGS
  880. bool
  881. config ARCH_HAS_PKEYS
  882. bool
  883. config VM_EVENT_COUNTERS
  884. default y
  885. bool "Enable VM event counters for /proc/vmstat" if EXPERT
  886. help
  887. VM event counters are needed for event counts to be shown.
  888. This option allows the disabling of the VM event counters
  889. on EXPERT systems. /proc/vmstat will only show page counts
  890. if VM event counters are disabled.
  891. config PERCPU_STATS
  892. bool "Collect percpu memory statistics"
  893. help
  894. This feature collects and exposes statistics via debugfs. The
  895. information includes global and per chunk statistics, which can
  896. be used to help understand percpu memory usage.
  897. config GUP_TEST
  898. bool "Enable infrastructure for get_user_pages()-related unit tests"
  899. depends on DEBUG_FS
  900. help
  901. Provides /sys/kernel/debug/gup_test, which in turn provides a way
  902. to make ioctl calls that can launch kernel-based unit tests for
  903. the get_user_pages*() and pin_user_pages*() family of API calls.
  904. These tests include benchmark testing of the _fast variants of
  905. get_user_pages*() and pin_user_pages*(), as well as smoke tests of
  906. the non-_fast variants.
  907. There is also a sub-test that allows running dump_page() on any
  908. of up to eight pages (selected by command line args) within the
  909. range of user-space addresses. These pages are either pinned via
  910. pin_user_pages*(), or pinned via get_user_pages*(), as specified
  911. by other command line arguments.
  912. See tools/testing/selftests/vm/gup_test.c
  913. comment "GUP_TEST needs to have DEBUG_FS enabled"
  914. depends on !GUP_TEST && !DEBUG_FS
  915. config GUP_GET_PTE_LOW_HIGH
  916. bool
  917. config ARCH_HAS_PTE_SPECIAL
  918. bool
  919. #
  920. # Some architectures require a special hugepage directory format that is
  921. # required to support multiple hugepage sizes. For example a4fe3ce76
  922. # "powerpc/mm: Allow more flexible layouts for hugepage pagetables"
  923. # introduced it on powerpc. This allows for a more flexible hugepage
  924. # pagetable layouts.
  925. #
  926. config ARCH_HAS_HUGEPD
  927. bool
  928. config MAPPING_DIRTY_HELPERS
  929. bool
  930. config KMAP_LOCAL
  931. bool
  932. config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
  933. bool
  934. # struct io_mapping based helper. Selected by drivers that need them
  935. config IO_MAPPING
  936. bool
  937. # Some architectures want callbacks for all IO mappings in order to
  938. # track the physical addresses that get used as devices.
  939. config ARCH_HAS_IOREMAP_PHYS_HOOKS
  940. bool
  941. config SECRETMEM
  942. def_bool ARCH_HAS_SET_DIRECT_MAP && !EMBEDDED
  943. config ANON_VMA_NAME
  944. bool "Anonymous VMA name support"
  945. depends on PROC_FS && ADVISE_SYSCALLS && MMU
  946. help
  947. Allow naming anonymous virtual memory areas.
  948. This feature allows assigning names to virtual memory areas. Assigned
  949. names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
  950. and help identifying individual anonymous memory areas.
  951. Assigning a name to anonymous virtual memory area might prevent that
  952. area from being merged with adjacent virtual memory areas due to the
  953. difference in their name.
  954. config USERFAULTFD
  955. bool "Enable userfaultfd() system call"
  956. depends on MMU
  957. help
  958. Enable the userfaultfd() system call that allows to intercept and
  959. handle page faults in userland.
  960. config HAVE_ARCH_USERFAULTFD_WP
  961. bool
  962. help
  963. Arch has userfaultfd write protection support
  964. config HAVE_ARCH_USERFAULTFD_MINOR
  965. bool
  966. help
  967. Arch has userfaultfd minor fault support
  968. config PTE_MARKER
  969. bool
  970. help
  971. Allows to create marker PTEs for file-backed memory.
  972. config PTE_MARKER_UFFD_WP
  973. bool "Userfaultfd write protection support for shmem/hugetlbfs"
  974. default y
  975. depends on HAVE_ARCH_USERFAULTFD_WP
  976. select PTE_MARKER
  977. help
  978. Allows to create marker PTEs for userfaultfd write protection
  979. purposes. It is required to enable userfaultfd write protection on
  980. file-backed memory types like shmem and hugetlbfs.
  981. # multi-gen LRU {
  982. config LRU_GEN
  983. bool "Multi-Gen LRU"
  984. depends on MMU
  985. # make sure folio->flags has enough spare bits
  986. depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
  987. help
  988. A high performance LRU implementation to overcommit memory. See
  989. Documentation/admin-guide/mm/multigen_lru.rst for details.
  990. config LRU_GEN_ENABLED
  991. bool "Enable by default"
  992. depends on LRU_GEN
  993. help
  994. This option enables the multi-gen LRU by default.
  995. config LRU_GEN_STATS
  996. bool "Full stats for debugging"
  997. depends on LRU_GEN
  998. help
  999. Do not enable this option unless you plan to look at historical stats
  1000. from evicted generations for debugging purpose.
  1001. This option has a per-memcg and per-node memory overhead.
  1002. # }
  1003. config ARCH_SUPPORTS_PER_VMA_LOCK
  1004. def_bool n
  1005. config PER_VMA_LOCK
  1006. def_bool y
  1007. depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP
  1008. help
  1009. Allow per-vma locking during page fault handling.
  1010. This feature allows locking each virtual memory area separately when
  1011. handling page faults instead of taking mmap_lock.
  1012. config LOCK_MM_AND_FIND_VMA
  1013. bool
  1014. depends on !STACK_GROWSUP
  1015. source "mm/damon/Kconfig"
  1016. config HUGEPAGE_POOL
  1017. bool "hugepage pool management"
  1018. default y
  1019. depends on !HIGHMEM
  1020. depends on !NEED_MULTIPLE_NODES
  1021. depends on TRANSPARENT_HUGEPAGE
  1022. help
  1023. Enable this to provide 2MB hugepage to THP anon, ION, and GPU memory
  1024. allocation requests efficiently.
  1025. endmenu