1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only 259e0b520SChristoph Hellwig 359e0b520SChristoph Hellwigmenu "Memory Management options" 459e0b520SChristoph Hellwig 57b42f104SJohannes Weiner# 67b42f104SJohannes Weiner# For some reason microblaze and nios2 hard code SWAP=n. Hopefully we can 77b42f104SJohannes Weiner# add proper SWAP support to them, in which case this can be remove. 87b42f104SJohannes Weiner# 97b42f104SJohannes Weinerconfig ARCH_NO_SWAP 107b42f104SJohannes Weiner bool 117b42f104SJohannes Weiner 12b3fbd58fSJohannes Weinerconfig ZPOOL 13b3fbd58fSJohannes Weiner bool 14b3fbd58fSJohannes Weiner 15519bcb79SJohannes Weinermenuconfig SWAP 167b42f104SJohannes Weiner bool "Support for paging of anonymous memory (swap)" 177b42f104SJohannes Weiner depends on MMU && BLOCK && !ARCH_NO_SWAP 187b42f104SJohannes Weiner default y 197b42f104SJohannes Weiner help 207b42f104SJohannes Weiner This option allows you to choose whether you want to have support 217b42f104SJohannes Weiner for so called swap devices or swap files in your kernel that are 227b42f104SJohannes Weiner used to provide more virtual memory than the actual RAM present 237b42f104SJohannes Weiner in your computer. If unsure say Y. 247b42f104SJohannes Weiner 25519bcb79SJohannes Weinerconfig ZSWAP 26fcab9b44SDavid Heidelberg bool "Compressed cache for swap pages" 27b3fbd58fSJohannes Weiner depends on SWAP 28b3fbd58fSJohannes Weiner select CRYPTO 29519bcb79SJohannes Weiner select ZPOOL 30519bcb79SJohannes Weiner help 31519bcb79SJohannes Weiner A lightweight compressed cache for swap pages. It takes 32519bcb79SJohannes Weiner pages that are in the process of being swapped out and attempts to 33519bcb79SJohannes Weiner compress them into a dynamically allocated RAM-based memory pool. 34519bcb79SJohannes Weiner This can result in a significant I/O reduction on swap device and, 351a44131dSSophia Gabriella in the case where decompressing from RAM is faster than swap device 36519bcb79SJohannes Weiner reads, can also improve workload performance. 37519bcb79SJohannes Weiner 38b3fbd58fSJohannes Weinerconfig ZSWAP_DEFAULT_ON 39b3fbd58fSJohannes Weiner bool "Enable the compressed cache for swap pages by default" 40b3fbd58fSJohannes Weiner depends on ZSWAP 41b3fbd58fSJohannes Weiner help 42b3fbd58fSJohannes Weiner If selected, the compressed cache for swap pages will be enabled 43b3fbd58fSJohannes Weiner at boot, otherwise it will be disabled. 44b3fbd58fSJohannes Weiner 45b3fbd58fSJohannes Weiner The selection made here can be overridden by using the kernel 46b3fbd58fSJohannes Weiner command line 'zswap.enabled=' option. 47b3fbd58fSJohannes Weiner 48b9c91c43SYosry Ahmedconfig ZSWAP_EXCLUSIVE_LOADS_DEFAULT_ON 49b9c91c43SYosry Ahmed bool "Invalidate zswap entries when pages are loaded" 50b9c91c43SYosry Ahmed depends on ZSWAP 51b9c91c43SYosry Ahmed help 52b9c91c43SYosry Ahmed If selected, exclusive loads for zswap will be enabled at boot, 53b9c91c43SYosry Ahmed otherwise it will be disabled. 54b9c91c43SYosry Ahmed 55b9c91c43SYosry Ahmed If exclusive loads are enabled, when a page is loaded from zswap, 56b9c91c43SYosry Ahmed the zswap entry is invalidated at once, as opposed to leaving it 57b9c91c43SYosry Ahmed in zswap until the swap entry is freed. 58b9c91c43SYosry Ahmed 59b9c91c43SYosry Ahmed This avoids having two copies of the same page in memory 60b9c91c43SYosry Ahmed (compressed and uncompressed) after faulting in a page from zswap. 61b9c91c43SYosry Ahmed The cost is that if the page was never dirtied and needs to be 62b9c91c43SYosry Ahmed swapped out again, it will be re-compressed. 63b9c91c43SYosry Ahmed 64b5ba474fSNhat Phamconfig ZSWAP_SHRINKER_DEFAULT_ON 65b5ba474fSNhat Pham bool "Shrink the zswap pool on memory pressure" 66b5ba474fSNhat Pham depends on ZSWAP 67b5ba474fSNhat Pham default n 68b5ba474fSNhat Pham help 69b5ba474fSNhat Pham If selected, the zswap shrinker will be enabled, and the pages 70b5ba474fSNhat Pham stored in the zswap pool will become available for reclaim (i.e 71b5ba474fSNhat Pham written back to the backing swap device) on memory pressure. 72b5ba474fSNhat Pham 73b5ba474fSNhat Pham This means that zswap writeback could happen even if the pool is 74b5ba474fSNhat Pham not yet full, or the cgroup zswap limit has not been reached, 75b5ba474fSNhat Pham reducing the chance that cold pages will reside in the zswap pool 76b5ba474fSNhat Pham and consume memory indefinitely. 77b5ba474fSNhat Pham 78519bcb79SJohannes Weinerchoice 79b3fbd58fSJohannes Weiner prompt "Default compressor" 80519bcb79SJohannes Weiner depends on ZSWAP 81519bcb79SJohannes Weiner default ZSWAP_COMPRESSOR_DEFAULT_LZO 82519bcb79SJohannes Weiner help 83519bcb79SJohannes Weiner Selects the default compression algorithm for the compressed cache 84519bcb79SJohannes Weiner for swap pages. 85519bcb79SJohannes Weiner 86519bcb79SJohannes Weiner For an overview what kind of performance can be expected from 87519bcb79SJohannes Weiner a particular compression algorithm please refer to the benchmarks 88519bcb79SJohannes Weiner available at the following LWN page: 89519bcb79SJohannes Weiner https://lwn.net/Articles/751795/ 90519bcb79SJohannes Weiner 91519bcb79SJohannes Weiner If in doubt, select 'LZO'. 92519bcb79SJohannes Weiner 93519bcb79SJohannes Weiner The selection made here can be overridden by using the kernel 94519bcb79SJohannes Weiner command line 'zswap.compressor=' option. 95519bcb79SJohannes Weiner 96519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_DEFLATE 97519bcb79SJohannes Weiner bool "Deflate" 98519bcb79SJohannes Weiner select CRYPTO_DEFLATE 99519bcb79SJohannes Weiner help 100519bcb79SJohannes Weiner Use the Deflate algorithm as the default compression algorithm. 101519bcb79SJohannes Weiner 102519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZO 103519bcb79SJohannes Weiner bool "LZO" 104519bcb79SJohannes Weiner select CRYPTO_LZO 105519bcb79SJohannes Weiner help 106519bcb79SJohannes Weiner Use the LZO algorithm as the default compression algorithm. 107519bcb79SJohannes Weiner 108519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_842 109519bcb79SJohannes Weiner bool "842" 110519bcb79SJohannes Weiner select CRYPTO_842 111519bcb79SJohannes Weiner help 112519bcb79SJohannes Weiner Use the 842 algorithm as the default compression algorithm. 113519bcb79SJohannes Weiner 114519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4 115519bcb79SJohannes Weiner bool "LZ4" 116519bcb79SJohannes Weiner select CRYPTO_LZ4 117519bcb79SJohannes Weiner help 118519bcb79SJohannes Weiner Use the LZ4 algorithm as the default compression algorithm. 119519bcb79SJohannes Weiner 120519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4HC 121519bcb79SJohannes Weiner bool "LZ4HC" 122519bcb79SJohannes Weiner select CRYPTO_LZ4HC 123519bcb79SJohannes Weiner help 124519bcb79SJohannes Weiner Use the LZ4HC algorithm as the default compression algorithm. 125519bcb79SJohannes Weiner 126519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_ZSTD 127519bcb79SJohannes Weiner bool "zstd" 128519bcb79SJohannes Weiner select CRYPTO_ZSTD 129519bcb79SJohannes Weiner help 130519bcb79SJohannes Weiner Use the zstd algorithm as the default compression algorithm. 131519bcb79SJohannes Weinerendchoice 132519bcb79SJohannes Weiner 133519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT 134519bcb79SJohannes Weiner string 135519bcb79SJohannes Weiner depends on ZSWAP 136519bcb79SJohannes Weiner default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE 137519bcb79SJohannes Weiner default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO 138519bcb79SJohannes Weiner default "842" if ZSWAP_COMPRESSOR_DEFAULT_842 139519bcb79SJohannes Weiner default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4 140519bcb79SJohannes Weiner default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC 141519bcb79SJohannes Weiner default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD 142519bcb79SJohannes Weiner default "" 143519bcb79SJohannes Weiner 144519bcb79SJohannes Weinerchoice 145b3fbd58fSJohannes Weiner prompt "Default allocator" 146519bcb79SJohannes Weiner depends on ZSWAP 14764d4d49cSNhat Pham default ZSWAP_ZPOOL_DEFAULT_ZSMALLOC if MMU 148519bcb79SJohannes Weiner default ZSWAP_ZPOOL_DEFAULT_ZBUD 149519bcb79SJohannes Weiner help 150519bcb79SJohannes Weiner Selects the default allocator for the compressed cache for 151519bcb79SJohannes Weiner swap pages. 152519bcb79SJohannes Weiner The default is 'zbud' for compatibility, however please do 153519bcb79SJohannes Weiner read the description of each of the allocators below before 154519bcb79SJohannes Weiner making a right choice. 155519bcb79SJohannes Weiner 156519bcb79SJohannes Weiner The selection made here can be overridden by using the kernel 157519bcb79SJohannes Weiner command line 'zswap.zpool=' option. 158519bcb79SJohannes Weiner 159519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_ZBUD 160519bcb79SJohannes Weiner bool "zbud" 161519bcb79SJohannes Weiner select ZBUD 162519bcb79SJohannes Weiner help 163519bcb79SJohannes Weiner Use the zbud allocator as the default allocator. 164519bcb79SJohannes Weiner 165519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_Z3FOLD 166519bcb79SJohannes Weiner bool "z3fold" 167519bcb79SJohannes Weiner select Z3FOLD 168519bcb79SJohannes Weiner help 169519bcb79SJohannes Weiner Use the z3fold allocator as the default allocator. 170519bcb79SJohannes Weiner 171519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_ZSMALLOC 172519bcb79SJohannes Weiner bool "zsmalloc" 173519bcb79SJohannes Weiner select ZSMALLOC 174519bcb79SJohannes Weiner help 175519bcb79SJohannes Weiner Use the zsmalloc allocator as the default allocator. 176519bcb79SJohannes Weinerendchoice 177519bcb79SJohannes Weiner 178519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT 179519bcb79SJohannes Weiner string 180519bcb79SJohannes Weiner depends on ZSWAP 181519bcb79SJohannes Weiner default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD 182519bcb79SJohannes Weiner default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD 183519bcb79SJohannes Weiner default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC 184519bcb79SJohannes Weiner default "" 185519bcb79SJohannes Weiner 186519bcb79SJohannes Weinerconfig ZBUD 187b3fbd58fSJohannes Weiner tristate "2:1 compression allocator (zbud)" 188b3fbd58fSJohannes Weiner depends on ZSWAP 189519bcb79SJohannes Weiner help 190519bcb79SJohannes Weiner A special purpose allocator for storing compressed pages. 191519bcb79SJohannes Weiner It is designed to store up to two compressed pages per physical 192519bcb79SJohannes Weiner page. While this design limits storage density, it has simple and 193519bcb79SJohannes Weiner deterministic reclaim properties that make it preferable to a higher 194519bcb79SJohannes Weiner density approach when reclaim will be used. 195519bcb79SJohannes Weiner 196519bcb79SJohannes Weinerconfig Z3FOLD 197b3fbd58fSJohannes Weiner tristate "3:1 compression allocator (z3fold)" 198b3fbd58fSJohannes Weiner depends on ZSWAP 199519bcb79SJohannes Weiner help 200519bcb79SJohannes Weiner A special purpose allocator for storing compressed pages. 201519bcb79SJohannes Weiner It is designed to store up to three compressed pages per physical 202519bcb79SJohannes Weiner page. It is a ZBUD derivative so the simplicity and determinism are 203519bcb79SJohannes Weiner still there. 204519bcb79SJohannes Weiner 205519bcb79SJohannes Weinerconfig ZSMALLOC 206b3fbd58fSJohannes Weiner tristate 207b3fbd58fSJohannes Weiner prompt "N:1 compression allocator (zsmalloc)" if ZSWAP 208519bcb79SJohannes Weiner depends on MMU 209519bcb79SJohannes Weiner help 210519bcb79SJohannes Weiner zsmalloc is a slab-based memory allocator designed to store 211b3fbd58fSJohannes Weiner pages of various compression levels efficiently. It achieves 212b3fbd58fSJohannes Weiner the highest storage density with the least amount of fragmentation. 213519bcb79SJohannes Weiner 214519bcb79SJohannes Weinerconfig ZSMALLOC_STAT 215519bcb79SJohannes Weiner bool "Export zsmalloc statistics" 216519bcb79SJohannes Weiner depends on ZSMALLOC 217519bcb79SJohannes Weiner select DEBUG_FS 218519bcb79SJohannes Weiner help 219519bcb79SJohannes Weiner This option enables code in the zsmalloc to collect various 220519bcb79SJohannes Weiner statistics about what's happening in zsmalloc and exports that 221519bcb79SJohannes Weiner information to userspace via debugfs. 222519bcb79SJohannes Weiner If unsure, say N. 223519bcb79SJohannes Weiner 2244ff93b29SSergey Senozhatskyconfig ZSMALLOC_CHAIN_SIZE 2254ff93b29SSergey Senozhatsky int "Maximum number of physical pages per-zspage" 226b46402faSSergey Senozhatsky default 8 2274ff93b29SSergey Senozhatsky range 4 16 2284ff93b29SSergey Senozhatsky depends on ZSMALLOC 2294ff93b29SSergey Senozhatsky help 2304ff93b29SSergey Senozhatsky This option sets the upper limit on the number of physical pages 2314ff93b29SSergey Senozhatsky that a zmalloc page (zspage) can consist of. The optimal zspage 2324ff93b29SSergey Senozhatsky chain size is calculated for each size class during the 2334ff93b29SSergey Senozhatsky initialization of the pool. 2344ff93b29SSergey Senozhatsky 2354ff93b29SSergey Senozhatsky Changing this option can alter the characteristics of size classes, 2364ff93b29SSergey Senozhatsky such as the number of pages per zspage and the number of objects 2374ff93b29SSergey Senozhatsky per zspage. This can also result in different configurations of 2384ff93b29SSergey Senozhatsky the pool, as zsmalloc merges size classes with similar 2394ff93b29SSergey Senozhatsky characteristics. 2404ff93b29SSergey Senozhatsky 2414ff93b29SSergey Senozhatsky For more information, see zsmalloc documentation. 2424ff93b29SSergey Senozhatsky 243519bcb79SJohannes Weinermenu "SLAB allocator options" 244519bcb79SJohannes Weiner 2457b42f104SJohannes Weinerchoice 2467b42f104SJohannes Weiner prompt "Choose SLAB allocator" 2477b42f104SJohannes Weiner default SLUB 2487b42f104SJohannes Weiner help 2497b42f104SJohannes Weiner This option allows to select a slab allocator. 2507b42f104SJohannes Weiner 251eb07c4f3SVlastimil Babkaconfig SLAB_DEPRECATED 252eb07c4f3SVlastimil Babka bool "SLAB (DEPRECATED)" 2537b42f104SJohannes Weiner depends on !PREEMPT_RT 2547b42f104SJohannes Weiner help 255eb07c4f3SVlastimil Babka Deprecated and scheduled for removal in a few cycles. Replaced by 256eb07c4f3SVlastimil Babka SLUB. 257eb07c4f3SVlastimil Babka 258eb07c4f3SVlastimil Babka If you cannot migrate to SLUB, please contact linux-mm@kvack.org 259eb07c4f3SVlastimil Babka and the people listed in the SLAB ALLOCATOR section of MAINTAINERS 260eb07c4f3SVlastimil Babka file, explaining why. 261eb07c4f3SVlastimil Babka 2627b42f104SJohannes Weiner The regular slab allocator that is established and known to work 2637b42f104SJohannes Weiner well in all environments. It organizes cache hot objects in 2647b42f104SJohannes Weiner per cpu and per node queues. 2657b42f104SJohannes Weiner 2667b42f104SJohannes Weinerconfig SLUB 2677b42f104SJohannes Weiner bool "SLUB (Unqueued Allocator)" 2687b42f104SJohannes Weiner help 2697b42f104SJohannes Weiner SLUB is a slab allocator that minimizes cache line usage 2707b42f104SJohannes Weiner instead of managing queues of cached objects (SLAB approach). 2717b42f104SJohannes Weiner Per cpu caching is realized using slabs of objects instead 2727b42f104SJohannes Weiner of queues of objects. SLUB can use memory efficiently 2737b42f104SJohannes Weiner and has enhanced diagnostics. SLUB is the default choice for 2747b42f104SJohannes Weiner a slab allocator. 2757b42f104SJohannes Weiner 2767b42f104SJohannes Weinerendchoice 2777b42f104SJohannes Weiner 278eb07c4f3SVlastimil Babkaconfig SLAB 279eb07c4f3SVlastimil Babka bool 280eb07c4f3SVlastimil Babka default y 281eb07c4f3SVlastimil Babka depends on SLAB_DEPRECATED 282eb07c4f3SVlastimil Babka 283e240e53aSVlastimil Babkaconfig SLUB_TINY 284e240e53aSVlastimil Babka bool "Configure SLUB for minimal memory footprint" 285e240e53aSVlastimil Babka depends on SLUB && EXPERT 286e240e53aSVlastimil Babka select SLAB_MERGE_DEFAULT 287e240e53aSVlastimil Babka help 288e240e53aSVlastimil Babka Configures the SLUB allocator in a way to achieve minimal memory 289e240e53aSVlastimil Babka footprint, sacrificing scalability, debugging and other features. 290e240e53aSVlastimil Babka This is intended only for the smallest system that had used the 291e240e53aSVlastimil Babka SLOB allocator and is not recommended for systems with more than 292e240e53aSVlastimil Babka 16MB RAM. 293e240e53aSVlastimil Babka 294e240e53aSVlastimil Babka If unsure, say N. 295e240e53aSVlastimil Babka 2967b42f104SJohannes Weinerconfig SLAB_MERGE_DEFAULT 2977b42f104SJohannes Weiner bool "Allow slab caches to be merged" 2987b42f104SJohannes Weiner default y 2997b42f104SJohannes Weiner depends on SLAB || SLUB 3007b42f104SJohannes Weiner help 3017b42f104SJohannes Weiner For reduced kernel memory fragmentation, slab caches can be 3027b42f104SJohannes Weiner merged when they share the same size and other characteristics. 3037b42f104SJohannes Weiner This carries a risk of kernel heap overflows being able to 3047b42f104SJohannes Weiner overwrite objects from merged caches (and more easily control 3057b42f104SJohannes Weiner cache layout), which makes such heap attacks easier to exploit 3067b42f104SJohannes Weiner by attackers. By keeping caches unmerged, these kinds of exploits 3077b42f104SJohannes Weiner can usually only damage objects in the same cache. To disable 3087b42f104SJohannes Weiner merging at runtime, "slab_nomerge" can be passed on the kernel 3097b42f104SJohannes Weiner command line. 3107b42f104SJohannes Weiner 3117b42f104SJohannes Weinerconfig SLAB_FREELIST_RANDOM 3127b42f104SJohannes Weiner bool "Randomize slab freelist" 313e240e53aSVlastimil Babka depends on SLAB || (SLUB && !SLUB_TINY) 3147b42f104SJohannes Weiner help 3157b42f104SJohannes Weiner Randomizes the freelist order used on creating new pages. This 3167b42f104SJohannes Weiner security feature reduces the predictability of the kernel slab 3177b42f104SJohannes Weiner allocator against heap overflows. 3187b42f104SJohannes Weiner 3197b42f104SJohannes Weinerconfig SLAB_FREELIST_HARDENED 3207b42f104SJohannes Weiner bool "Harden slab freelist metadata" 321e240e53aSVlastimil Babka depends on SLAB || (SLUB && !SLUB_TINY) 3227b42f104SJohannes Weiner help 3237b42f104SJohannes Weiner Many kernel heap attacks try to target slab cache metadata and 3247b42f104SJohannes Weiner other infrastructure. This options makes minor performance 3257b42f104SJohannes Weiner sacrifices to harden the kernel slab allocator against common 3267b42f104SJohannes Weiner freelist exploit methods. Some slab implementations have more 3277b42f104SJohannes Weiner sanity-checking than others. This option is most effective with 3287b42f104SJohannes Weiner CONFIG_SLUB. 3297b42f104SJohannes Weiner 3300710d012SVlastimil Babkaconfig SLUB_STATS 3310710d012SVlastimil Babka default n 3320710d012SVlastimil Babka bool "Enable SLUB performance statistics" 333e240e53aSVlastimil Babka depends on SLUB && SYSFS && !SLUB_TINY 3340710d012SVlastimil Babka help 3350710d012SVlastimil Babka SLUB statistics are useful to debug SLUBs allocation behavior in 3360710d012SVlastimil Babka order find ways to optimize the allocator. This should never be 3370710d012SVlastimil Babka enabled for production use since keeping statistics slows down 3380710d012SVlastimil Babka the allocator by a few percentage points. The slabinfo command 3390710d012SVlastimil Babka supports the determination of the most active slabs to figure 3400710d012SVlastimil Babka out which slabs are relevant to a particular load. 3410710d012SVlastimil Babka Try running: slabinfo -DA 3420710d012SVlastimil Babka 343519bcb79SJohannes Weinerconfig SLUB_CPU_PARTIAL 344519bcb79SJohannes Weiner default y 345e240e53aSVlastimil Babka depends on SLUB && SMP && !SLUB_TINY 346519bcb79SJohannes Weiner bool "SLUB per cpu partial cache" 347519bcb79SJohannes Weiner help 348519bcb79SJohannes Weiner Per cpu partial caches accelerate objects allocation and freeing 349519bcb79SJohannes Weiner that is local to a processor at the price of more indeterminism 350519bcb79SJohannes Weiner in the latency of the free. On overflow these caches will be cleared 351519bcb79SJohannes Weiner which requires the taking of locks that may cause latency spikes. 352519bcb79SJohannes Weiner Typically one would choose no for a realtime system. 353519bcb79SJohannes Weiner 3543c615294SGONG, Ruiqiconfig RANDOM_KMALLOC_CACHES 3553c615294SGONG, Ruiqi default n 3563c615294SGONG, Ruiqi depends on SLUB && !SLUB_TINY 3573c615294SGONG, Ruiqi bool "Randomize slab caches for normal kmalloc" 3583c615294SGONG, Ruiqi help 3593c615294SGONG, Ruiqi A hardening feature that creates multiple copies of slab caches for 3603c615294SGONG, Ruiqi normal kmalloc allocation and makes kmalloc randomly pick one based 3613c615294SGONG, Ruiqi on code address, which makes the attackers more difficult to spray 3623c615294SGONG, Ruiqi vulnerable memory objects on the heap for the purpose of exploiting 3633c615294SGONG, Ruiqi memory vulnerabilities. 3643c615294SGONG, Ruiqi 3653c615294SGONG, Ruiqi Currently the number of copies is set to 16, a reasonably large value 3663c615294SGONG, Ruiqi that effectively diverges the memory objects allocated for different 3673c615294SGONG, Ruiqi subsystems or modules into different caches, at the expense of a 3683c615294SGONG, Ruiqi limited degree of memory and CPU overhead that relates to hardware and 3693c615294SGONG, Ruiqi system workload. 3703c615294SGONG, Ruiqi 371519bcb79SJohannes Weinerendmenu # SLAB allocator options 372519bcb79SJohannes Weiner 3737b42f104SJohannes Weinerconfig SHUFFLE_PAGE_ALLOCATOR 3747b42f104SJohannes Weiner bool "Page allocator randomization" 3757b42f104SJohannes Weiner default SLAB_FREELIST_RANDOM && ACPI_NUMA 3767b42f104SJohannes Weiner help 3777b42f104SJohannes Weiner Randomization of the page allocator improves the average 3787b42f104SJohannes Weiner utilization of a direct-mapped memory-side-cache. See section 3797b42f104SJohannes Weiner 5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI 3807b42f104SJohannes Weiner 6.2a specification for an example of how a platform advertises 3817b42f104SJohannes Weiner the presence of a memory-side-cache. There are also incidental 3827b42f104SJohannes Weiner security benefits as it reduces the predictability of page 3837b42f104SJohannes Weiner allocations to compliment SLAB_FREELIST_RANDOM, but the 38423baf831SKirill A. Shutemov default granularity of shuffling on the MAX_ORDER i.e, 10th 38523baf831SKirill A. Shutemov order of pages is selected based on cache utilization benefits 38623baf831SKirill A. Shutemov on x86. 3877b42f104SJohannes Weiner 3887b42f104SJohannes Weiner While the randomization improves cache utilization it may 3897b42f104SJohannes Weiner negatively impact workloads on platforms without a cache. For 3907b42f104SJohannes Weiner this reason, by default, the randomization is enabled only 3917b42f104SJohannes Weiner after runtime detection of a direct-mapped memory-side-cache. 3927b42f104SJohannes Weiner Otherwise, the randomization may be force enabled with the 3937b42f104SJohannes Weiner 'page_alloc.shuffle' kernel command line parameter. 3947b42f104SJohannes Weiner 3957b42f104SJohannes Weiner Say Y if unsure. 3967b42f104SJohannes Weiner 3970710d012SVlastimil Babkaconfig COMPAT_BRK 3980710d012SVlastimil Babka bool "Disable heap randomization" 3990710d012SVlastimil Babka default y 4000710d012SVlastimil Babka help 4010710d012SVlastimil Babka Randomizing heap placement makes heap exploits harder, but it 4020710d012SVlastimil Babka also breaks ancient binaries (including anything libc5 based). 4030710d012SVlastimil Babka This option changes the bootup default to heap randomization 4040710d012SVlastimil Babka disabled, and can be overridden at runtime by setting 4050710d012SVlastimil Babka /proc/sys/kernel/randomize_va_space to 2. 4060710d012SVlastimil Babka 4070710d012SVlastimil Babka On non-ancient distros (post-2000 ones) N is usually a safe choice. 4080710d012SVlastimil Babka 4090710d012SVlastimil Babkaconfig MMAP_ALLOW_UNINITIALIZED 4100710d012SVlastimil Babka bool "Allow mmapped anonymous memory to be uninitialized" 4110710d012SVlastimil Babka depends on EXPERT && !MMU 4120710d012SVlastimil Babka default n 4130710d012SVlastimil Babka help 4140710d012SVlastimil Babka Normally, and according to the Linux spec, anonymous memory obtained 4150710d012SVlastimil Babka from mmap() has its contents cleared before it is passed to 4160710d012SVlastimil Babka userspace. Enabling this config option allows you to request that 4170710d012SVlastimil Babka mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus 4180710d012SVlastimil Babka providing a huge performance boost. If this option is not enabled, 4190710d012SVlastimil Babka then the flag will be ignored. 4200710d012SVlastimil Babka 4210710d012SVlastimil Babka This is taken advantage of by uClibc's malloc(), and also by 4220710d012SVlastimil Babka ELF-FDPIC binfmt's brk and stack allocator. 4230710d012SVlastimil Babka 4240710d012SVlastimil Babka Because of the obvious security issues, this option should only be 4250710d012SVlastimil Babka enabled on embedded devices where you control what is run in 4260710d012SVlastimil Babka userspace. Since that isn't generally a problem on no-MMU systems, 4270710d012SVlastimil Babka it is normally safe to say Y here. 4280710d012SVlastimil Babka 4290710d012SVlastimil Babka See Documentation/admin-guide/mm/nommu-mmap.rst for more information. 4300710d012SVlastimil Babka 431e1785e85SDave Hansenconfig SELECT_MEMORY_MODEL 432e1785e85SDave Hansen def_bool y 433a8826eebSKees Cook depends on ARCH_SELECT_MEMORY_MODEL 434e1785e85SDave Hansen 4353a9da765SDave Hansenchoice 4363a9da765SDave Hansen prompt "Memory model" 437e1785e85SDave Hansen depends on SELECT_MEMORY_MODEL 438d41dee36SAndy Whitcroft default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT 439e1785e85SDave Hansen default FLATMEM_MANUAL 440d66d109dSMike Rapoport help 441d66d109dSMike Rapoport This option allows you to change some of the ways that 442d66d109dSMike Rapoport Linux manages its memory internally. Most users will 443d66d109dSMike Rapoport only have one option here selected by the architecture 444d66d109dSMike Rapoport configuration. This is normal. 4453a9da765SDave Hansen 446e1785e85SDave Hansenconfig FLATMEM_MANUAL 4473a9da765SDave Hansen bool "Flat Memory" 448bb1c50d3SMike Rapoport depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE 4493a9da765SDave Hansen help 450d66d109dSMike Rapoport This option is best suited for non-NUMA systems with 451d66d109dSMike Rapoport flat address space. The FLATMEM is the most efficient 452d66d109dSMike Rapoport system in terms of performance and resource consumption 453d66d109dSMike Rapoport and it is the best option for smaller systems. 4543a9da765SDave Hansen 455d66d109dSMike Rapoport For systems that have holes in their physical address 456d66d109dSMike Rapoport spaces and for features like NUMA and memory hotplug, 457dd33d29aSRandy Dunlap choose "Sparse Memory". 458d41dee36SAndy Whitcroft 459d41dee36SAndy Whitcroft If unsure, choose this option (Flat Memory) over any other. 4603a9da765SDave Hansen 461d41dee36SAndy Whitcroftconfig SPARSEMEM_MANUAL 462d41dee36SAndy Whitcroft bool "Sparse Memory" 463d41dee36SAndy Whitcroft depends on ARCH_SPARSEMEM_ENABLE 464d41dee36SAndy Whitcroft help 465d41dee36SAndy Whitcroft This will be the only option for some systems, including 466d66d109dSMike Rapoport memory hot-plug systems. This is normal. 467d41dee36SAndy Whitcroft 468d66d109dSMike Rapoport This option provides efficient support for systems with 469d66d109dSMike Rapoport holes is their physical address space and allows memory 470d66d109dSMike Rapoport hot-plug and hot-remove. 471d41dee36SAndy Whitcroft 472d66d109dSMike Rapoport If unsure, choose "Flat Memory" over this option. 473d41dee36SAndy Whitcroft 4743a9da765SDave Hansenendchoice 4753a9da765SDave Hansen 476d41dee36SAndy Whitcroftconfig SPARSEMEM 477d41dee36SAndy Whitcroft def_bool y 4781a83e175SRussell King depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL 479d41dee36SAndy Whitcroft 480e1785e85SDave Hansenconfig FLATMEM 481e1785e85SDave Hansen def_bool y 482bb1c50d3SMike Rapoport depends on !SPARSEMEM || FLATMEM_MANUAL 483d41dee36SAndy Whitcroft 48493b7504eSDave Hansen# 4853e347261SBob Picco# SPARSEMEM_EXTREME (which is the default) does some bootmem 486c89ab04fSMike Rapoport# allocations when sparse_init() is called. If this cannot 4873e347261SBob Picco# be done on your architecture, select this option. However, 4883e347261SBob Picco# statically allocating the mem_section[] array can potentially 4893e347261SBob Picco# consume vast quantities of .bss, so be careful. 4903e347261SBob Picco# 4913e347261SBob Picco# This option will also potentially produce smaller runtime code 4923e347261SBob Picco# with gcc 3.4 and later. 4933e347261SBob Picco# 4943e347261SBob Piccoconfig SPARSEMEM_STATIC 4959ba16087SJan Beulich bool 4963e347261SBob Picco 4973e347261SBob Picco# 49844c09201SMatt LaPlante# Architecture platforms which require a two level mem_section in SPARSEMEM 499802f192eSBob Picco# must select this option. This is usually for architecture platforms with 500802f192eSBob Picco# an extremely sparse physical address space. 501802f192eSBob Picco# 5023e347261SBob Piccoconfig SPARSEMEM_EXTREME 5033e347261SBob Picco def_bool y 5043e347261SBob Picco depends on SPARSEMEM && !SPARSEMEM_STATIC 5054c21e2f2SHugh Dickins 50629c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP_ENABLE 5079ba16087SJan Beulich bool 50829c71111SAndy Whitcroft 50929c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP 510a5ee6daaSGeoff Levand bool "Sparse Memory virtual memmap" 511a5ee6daaSGeoff Levand depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE 512a5ee6daaSGeoff Levand default y 513a5ee6daaSGeoff Levand help 514a5ee6daaSGeoff Levand SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise 515a5ee6daaSGeoff Levand pfn_to_page and page_to_pfn operations. This is the most 516a5ee6daaSGeoff Levand efficient option when sufficient kernel resources are available. 5170b376f1eSAneesh Kumar K.V# 5180b376f1eSAneesh Kumar K.V# Select this config option from the architecture Kconfig, if it is preferred 5190b376f1eSAneesh Kumar K.V# to enable the feature of HugeTLB/dev_dax vmemmap optimization. 5200b376f1eSAneesh Kumar K.V# 5210b6f1582SAneesh Kumar K.Vconfig ARCH_WANT_OPTIMIZE_DAX_VMEMMAP 5220b6f1582SAneesh Kumar K.V bool 5230b6f1582SAneesh Kumar K.V 5240b6f1582SAneesh Kumar K.Vconfig ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP 5250b376f1eSAneesh Kumar K.V bool 52629c71111SAndy Whitcroft 52770210ed9SPhilipp Hachtmannconfig HAVE_MEMBLOCK_PHYS_MAP 5286341e62bSChristoph Jaeger bool 52970210ed9SPhilipp Hachtmann 53067a929e0SChristoph Hellwigconfig HAVE_FAST_GUP 531050a9adcSChristoph Hellwig depends on MMU 5326341e62bSChristoph Jaeger bool 5332667f50eSSteve Capper 53452219aeaSDavid Hildenbrand# Don't discard allocated memory used to track "memory" and "reserved" memblocks 53552219aeaSDavid Hildenbrand# after early boot, so it can still be used to test for validity of memory. 53652219aeaSDavid Hildenbrand# Also, memblocks are updated with memory hot(un)plug. 537350e88baSMike Rapoportconfig ARCH_KEEP_MEMBLOCK 5386341e62bSChristoph Jaeger bool 539c378ddd5STejun Heo 5401e5d8e1eSDan Williams# Keep arch NUMA mapping infrastructure post-init. 5411e5d8e1eSDan Williamsconfig NUMA_KEEP_MEMINFO 5421e5d8e1eSDan Williams bool 5431e5d8e1eSDan Williams 544ee6f509cSMinchan Kimconfig MEMORY_ISOLATION 5456341e62bSChristoph Jaeger bool 546ee6f509cSMinchan Kim 547a9e7b8d4SDavid Hildenbrand# IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked 548a9e7b8d4SDavid Hildenbrand# IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via 549a9e7b8d4SDavid Hildenbrand# /dev/mem. 550a9e7b8d4SDavid Hildenbrandconfig EXCLUSIVE_SYSTEM_RAM 551a9e7b8d4SDavid Hildenbrand def_bool y 552a9e7b8d4SDavid Hildenbrand depends on !DEVMEM || STRICT_DEVMEM 553a9e7b8d4SDavid Hildenbrand 55446723bfaSYasuaki Ishimatsu# 55546723bfaSYasuaki Ishimatsu# Only be set on architectures that have completely implemented memory hotplug 55646723bfaSYasuaki Ishimatsu# feature. If you are not sure, don't touch it. 55746723bfaSYasuaki Ishimatsu# 55846723bfaSYasuaki Ishimatsuconfig HAVE_BOOTMEM_INFO_NODE 55946723bfaSYasuaki Ishimatsu def_bool n 56046723bfaSYasuaki Ishimatsu 56191024b3cSAnshuman Khandualconfig ARCH_ENABLE_MEMORY_HOTPLUG 56291024b3cSAnshuman Khandual bool 56391024b3cSAnshuman Khandual 564519bcb79SJohannes Weinerconfig ARCH_ENABLE_MEMORY_HOTREMOVE 565519bcb79SJohannes Weiner bool 566519bcb79SJohannes Weiner 5673947be19SDave Hansen# eventually, we can have this option just 'select SPARSEMEM' 568519bcb79SJohannes Weinermenuconfig MEMORY_HOTPLUG 569519bcb79SJohannes Weiner bool "Memory hotplug" 570b30c5927SDavid Hildenbrand select MEMORY_ISOLATION 57171b6f2ddSDavid Hildenbrand depends on SPARSEMEM 57240b31360SStephen Rothwell depends on ARCH_ENABLE_MEMORY_HOTPLUG 5737ec58a2bSDavid Hildenbrand depends on 64BIT 5741e5d8e1eSDan Williams select NUMA_KEEP_MEMINFO if NUMA 5753947be19SDave Hansen 576519bcb79SJohannes Weinerif MEMORY_HOTPLUG 577519bcb79SJohannes Weiner 5788604d9e5SVitaly Kuznetsovconfig MEMORY_HOTPLUG_DEFAULT_ONLINE 5798604d9e5SVitaly Kuznetsov bool "Online the newly added memory blocks by default" 5808604d9e5SVitaly Kuznetsov depends on MEMORY_HOTPLUG 5818604d9e5SVitaly Kuznetsov help 5828604d9e5SVitaly Kuznetsov This option sets the default policy setting for memory hotplug 5838604d9e5SVitaly Kuznetsov onlining policy (/sys/devices/system/memory/auto_online_blocks) which 5848604d9e5SVitaly Kuznetsov determines what happens to newly added memory regions. Policy setting 5858604d9e5SVitaly Kuznetsov can always be changed at runtime. 586cb1aaebeSMauro Carvalho Chehab See Documentation/admin-guide/mm/memory-hotplug.rst for more information. 5878604d9e5SVitaly Kuznetsov 5888604d9e5SVitaly Kuznetsov Say Y here if you want all hot-plugged memory blocks to appear in 5898604d9e5SVitaly Kuznetsov 'online' state by default. 5908604d9e5SVitaly Kuznetsov Say N here if you want the default policy to keep all hot-plugged 5918604d9e5SVitaly Kuznetsov memory blocks in 'offline' state. 5928604d9e5SVitaly Kuznetsov 5930c0e6195SKAMEZAWA Hiroyukiconfig MEMORY_HOTREMOVE 5940c0e6195SKAMEZAWA Hiroyuki bool "Allow for memory hot remove" 595f7e3334aSNathan Fontenot select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64) 5960c0e6195SKAMEZAWA Hiroyuki depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE 5970c0e6195SKAMEZAWA Hiroyuki depends on MIGRATION 5980c0e6195SKAMEZAWA Hiroyuki 599a08a2ae3SOscar Salvadorconfig MHP_MEMMAP_ON_MEMORY 600a08a2ae3SOscar Salvador def_bool y 601a08a2ae3SOscar Salvador depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP 602a08a2ae3SOscar Salvador depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE 603a08a2ae3SOscar Salvador 604519bcb79SJohannes Weinerendif # MEMORY_HOTPLUG 605519bcb79SJohannes Weiner 60604d5ea46SAneesh Kumar K.Vconfig ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE 60704d5ea46SAneesh Kumar K.V bool 60804d5ea46SAneesh Kumar K.V 6094c21e2f2SHugh Dickins# Heavily threaded applications may benefit from splitting the mm-wide 6104c21e2f2SHugh Dickins# page_table_lock, so that faults on different parts of the user address 6114c21e2f2SHugh Dickins# space can be handled with less contention: split it at this NR_CPUS. 6124c21e2f2SHugh Dickins# Default to 4 for wider testing, though 8 might be more appropriate. 6134c21e2f2SHugh Dickins# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock. 6147b6ac9dfSHugh Dickins# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes. 61560bccaa6SWill Deacon# SPARC32 allocates multiple pte tables within a single page, and therefore 61660bccaa6SWill Deacon# a per-page lock leads to problems when multiple tables need to be locked 61760bccaa6SWill Deacon# at the same time (e.g. copy_page_range()). 618a70caa8bSHugh Dickins# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page. 6194c21e2f2SHugh Dickins# 6204c21e2f2SHugh Dickinsconfig SPLIT_PTLOCK_CPUS 6214c21e2f2SHugh Dickins int 6229164550eSKirill A. Shutemov default "999999" if !MMU 623a70caa8bSHugh Dickins default "999999" if ARM && !CPU_CACHE_VIPT 624a70caa8bSHugh Dickins default "999999" if PARISC && !PA20 62560bccaa6SWill Deacon default "999999" if SPARC32 6264c21e2f2SHugh Dickins default "4" 6277cbe34cfSChristoph Lameter 628e009bb30SKirill A. Shutemovconfig ARCH_ENABLE_SPLIT_PMD_PTLOCK 6296341e62bSChristoph Jaeger bool 630e009bb30SKirill A. Shutemov 6317cbe34cfSChristoph Lameter# 63209316c09SKonstantin Khlebnikov# support for memory balloon 63309316c09SKonstantin Khlebnikovconfig MEMORY_BALLOON 6346341e62bSChristoph Jaeger bool 63509316c09SKonstantin Khlebnikov 63609316c09SKonstantin Khlebnikov# 63718468d93SRafael Aquini# support for memory balloon compaction 63818468d93SRafael Aquiniconfig BALLOON_COMPACTION 63918468d93SRafael Aquini bool "Allow for balloon memory compaction/migration" 64018468d93SRafael Aquini def_bool y 64109316c09SKonstantin Khlebnikov depends on COMPACTION && MEMORY_BALLOON 64218468d93SRafael Aquini help 64318468d93SRafael Aquini Memory fragmentation introduced by ballooning might reduce 64418468d93SRafael Aquini significantly the number of 2MB contiguous memory blocks that can be 64518468d93SRafael Aquini used within a guest, thus imposing performance penalties associated 64618468d93SRafael Aquini with the reduced number of transparent huge pages that could be used 64718468d93SRafael Aquini by the guest workload. Allowing the compaction & migration for memory 64818468d93SRafael Aquini pages enlisted as being part of memory balloon devices avoids the 64918468d93SRafael Aquini scenario aforementioned and helps improving memory defragmentation. 65018468d93SRafael Aquini 65118468d93SRafael Aquini# 652e9e96b39SMel Gorman# support for memory compaction 653e9e96b39SMel Gormanconfig COMPACTION 654e9e96b39SMel Gorman bool "Allow for memory compaction" 65505106e6aSRik van Riel def_bool y 656e9e96b39SMel Gorman select MIGRATION 65733a93877SAndrea Arcangeli depends on MMU 658e9e96b39SMel Gorman help 659b32eaf71SMichal Hocko Compaction is the only memory management component to form 660b32eaf71SMichal Hocko high order (larger physically contiguous) memory blocks 661b32eaf71SMichal Hocko reliably. The page allocator relies on compaction heavily and 662b32eaf71SMichal Hocko the lack of the feature can lead to unexpected OOM killer 663b32eaf71SMichal Hocko invocations for high order memory requests. You shouldn't 664b32eaf71SMichal Hocko disable this option unless there really is a strong reason for 665b32eaf71SMichal Hocko it and then we would be really interested to hear about that at 666b32eaf71SMichal Hocko linux-mm@kvack.org. 667e9e96b39SMel Gorman 668c7e0b3d0SThomas Gleixnerconfig COMPACT_UNEVICTABLE_DEFAULT 669c7e0b3d0SThomas Gleixner int 670c7e0b3d0SThomas Gleixner depends on COMPACTION 671c7e0b3d0SThomas Gleixner default 0 if PREEMPT_RT 672c7e0b3d0SThomas Gleixner default 1 673c7e0b3d0SThomas Gleixner 674e9e96b39SMel Gorman# 67536e66c55SAlexander Duyck# support for free page reporting 67636e66c55SAlexander Duyckconfig PAGE_REPORTING 67736e66c55SAlexander Duyck bool "Free page reporting" 67836e66c55SAlexander Duyck def_bool n 67936e66c55SAlexander Duyck help 68036e66c55SAlexander Duyck Free page reporting allows for the incremental acquisition of 68136e66c55SAlexander Duyck free pages from the buddy allocator for the purpose of reporting 68236e66c55SAlexander Duyck those pages to another entity, such as a hypervisor, so that the 68336e66c55SAlexander Duyck memory can be freed within the host for other uses. 68436e66c55SAlexander Duyck 68536e66c55SAlexander Duyck# 6867cbe34cfSChristoph Lameter# support for page migration 6877cbe34cfSChristoph Lameter# 6887cbe34cfSChristoph Lameterconfig MIGRATION 689b20a3503SChristoph Lameter bool "Page migration" 6906c5240aeSChristoph Lameter def_bool y 691de32a817SChen Gang depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU 692b20a3503SChristoph Lameter help 693b20a3503SChristoph Lameter Allows the migration of the physical location of pages of processes 694e9e96b39SMel Gorman while the virtual addresses are not changed. This is useful in 695e9e96b39SMel Gorman two situations. The first is on NUMA systems to put pages nearer 696e9e96b39SMel Gorman to the processors accessing. The second is when allocating huge 697e9e96b39SMel Gorman pages as migration can relocate pages to satisfy a huge page 698e9e96b39SMel Gorman allocation instead of reclaiming. 6996550e07fSGreg Kroah-Hartman 70076cbbeadSChristoph Hellwigconfig DEVICE_MIGRATION 701d90a25f8SChristoph Hellwig def_bool MIGRATION && ZONE_DEVICE 70276cbbeadSChristoph Hellwig 703c177c81eSNaoya Horiguchiconfig ARCH_ENABLE_HUGEPAGE_MIGRATION 7046341e62bSChristoph Jaeger bool 705c177c81eSNaoya Horiguchi 7069c670ea3SNaoya Horiguchiconfig ARCH_ENABLE_THP_MIGRATION 7079c670ea3SNaoya Horiguchi bool 7089c670ea3SNaoya Horiguchi 7094bfb68a0SAnshuman Khandualconfig HUGETLB_PAGE_SIZE_VARIABLE 7104bfb68a0SAnshuman Khandual def_bool n 7114bfb68a0SAnshuman Khandual help 7124bfb68a0SAnshuman Khandual Allows the pageblock_order value to be dynamic instead of just standard 7134bfb68a0SAnshuman Khandual HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available 7144bfb68a0SAnshuman Khandual on a platform. 7154bfb68a0SAnshuman Khandual 71623baf831SKirill A. Shutemov Note that the pageblock_order cannot exceed MAX_ORDER and will be 71723baf831SKirill A. Shutemov clamped down to MAX_ORDER. 718b3d40a2bSDavid Hildenbrand 7198df995f6SAlexandre Ghiticonfig CONTIG_ALLOC 7208df995f6SAlexandre Ghiti def_bool (MEMORY_ISOLATION && COMPACTION) || CMA 7218df995f6SAlexandre Ghiti 72252166607SHuang Yingconfig PCP_BATCH_SCALE_MAX 72352166607SHuang Ying int "Maximum scale factor of PCP (Per-CPU pageset) batch allocate/free" 72452166607SHuang Ying default 5 72552166607SHuang Ying range 0 6 72652166607SHuang Ying help 72752166607SHuang Ying In page allocator, PCP (Per-CPU pageset) is refilled and drained in 72852166607SHuang Ying batches. The batch number is scaled automatically to improve page 72952166607SHuang Ying allocation/free throughput. But too large scale factor may hurt 73052166607SHuang Ying latency. This option sets the upper limit of scale factor to limit 73152166607SHuang Ying the maximum latency. 73252166607SHuang Ying 733600715dcSJeremy Fitzhardingeconfig PHYS_ADDR_T_64BIT 734d4a451d5SChristoph Hellwig def_bool 64BIT 735600715dcSJeremy Fitzhardinge 7362a7326b5SChristoph Lameterconfig BOUNCE 7379ca24e2eSVinayak Menon bool "Enable bounce buffers" 7389ca24e2eSVinayak Menon default y 739ce288e05SChristoph Hellwig depends on BLOCK && MMU && HIGHMEM 7409ca24e2eSVinayak Menon help 741ce288e05SChristoph Hellwig Enable bounce buffers for devices that cannot access the full range of 742ce288e05SChristoph Hellwig memory available to the CPU. Enabled by default when HIGHMEM is 743ce288e05SChristoph Hellwig selected, but you may say n to override this. 7442a7326b5SChristoph Lameter 745cddb8a5cSAndrea Arcangeliconfig MMU_NOTIFIER 746cddb8a5cSAndrea Arcangeli bool 74799cb252fSJason Gunthorpe select INTERVAL_TREE 748fc4d5c29SDavid Howells 749f8af4da3SHugh Dickinsconfig KSM 750f8af4da3SHugh Dickins bool "Enable KSM for page merging" 751f8af4da3SHugh Dickins depends on MMU 75259e1a2f4STimofey Titovets select XXHASH 753f8af4da3SHugh Dickins help 754f8af4da3SHugh Dickins Enable Kernel Samepage Merging: KSM periodically scans those areas 755f8af4da3SHugh Dickins of an application's address space that an app has advised may be 756f8af4da3SHugh Dickins mergeable. When it finds pages of identical content, it replaces 757d0f209f6SHugh Dickins the many instances by a single page with that content, so 758f8af4da3SHugh Dickins saving memory until one or another app needs to modify the content. 759f8af4da3SHugh Dickins Recommended for use with KVM, or with other duplicative applications. 760ee65728eSMike Rapoport See Documentation/mm/ksm.rst for more information: KSM is inactive 761c73602adSHugh Dickins until a program has madvised that an area is MADV_MERGEABLE, and 762c73602adSHugh Dickins root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set). 763f8af4da3SHugh Dickins 764e0a94c2aSChristoph Lameterconfig DEFAULT_MMAP_MIN_ADDR 765e0a94c2aSChristoph Lameter int "Low address space to protect from user allocation" 7666e141546SDavid Howells depends on MMU 767e0a94c2aSChristoph Lameter default 4096 768e0a94c2aSChristoph Lameter help 769e0a94c2aSChristoph Lameter This is the portion of low virtual memory which should be protected 770e0a94c2aSChristoph Lameter from userspace allocation. Keeping a user from writing to low pages 771e0a94c2aSChristoph Lameter can help reduce the impact of kernel NULL pointer bugs. 772e0a94c2aSChristoph Lameter 773*e99fb98dSKefeng Wang For most ppc64 and x86 users with lots of address space 774e0a94c2aSChristoph Lameter a value of 65536 is reasonable and should cause no problems. 775e0a94c2aSChristoph Lameter On arm and other archs it should not be higher than 32768. 776788084abSEric Paris Programs which use vm86 functionality or have some need to map 777788084abSEric Paris this low address space will need CAP_SYS_RAWIO or disable this 778788084abSEric Paris protection by setting the value to 0. 779e0a94c2aSChristoph Lameter 780e0a94c2aSChristoph Lameter This value can be changed after boot using the 781e0a94c2aSChristoph Lameter /proc/sys/vm/mmap_min_addr tunable. 782e0a94c2aSChristoph Lameter 783d949f36fSLinus Torvaldsconfig ARCH_SUPPORTS_MEMORY_FAILURE 784d949f36fSLinus Torvalds bool 785e0a94c2aSChristoph Lameter 7866a46079cSAndi Kleenconfig MEMORY_FAILURE 7876a46079cSAndi Kleen depends on MMU 788d949f36fSLinus Torvalds depends on ARCH_SUPPORTS_MEMORY_FAILURE 7896a46079cSAndi Kleen bool "Enable recovery from hardware memory errors" 790ee6f509cSMinchan Kim select MEMORY_ISOLATION 79197f0b134SXie XiuQi select RAS 7926a46079cSAndi Kleen help 7936a46079cSAndi Kleen Enables code to recover from some memory failures on systems 7946a46079cSAndi Kleen with MCA recovery. This allows a system to continue running 7956a46079cSAndi Kleen even when some of its memory has uncorrected errors. This requires 7966a46079cSAndi Kleen special hardware support and typically ECC memory. 7976a46079cSAndi Kleen 798cae681fcSAndi Kleenconfig HWPOISON_INJECT 799413f9efbSAndi Kleen tristate "HWPoison pages injector" 80027df5068SAndi Kleen depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS 801478c5ffcSWu Fengguang select PROC_PAGE_MONITOR 802cae681fcSAndi Kleen 803fc4d5c29SDavid Howellsconfig NOMMU_INITIAL_TRIM_EXCESS 804fc4d5c29SDavid Howells int "Turn on mmap() excess space trimming before booting" 805fc4d5c29SDavid Howells depends on !MMU 806fc4d5c29SDavid Howells default 1 807fc4d5c29SDavid Howells help 808fc4d5c29SDavid Howells The NOMMU mmap() frequently needs to allocate large contiguous chunks 809fc4d5c29SDavid Howells of memory on which to store mappings, but it can only ask the system 810fc4d5c29SDavid Howells allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently 811fc4d5c29SDavid Howells more than it requires. To deal with this, mmap() is able to trim off 812fc4d5c29SDavid Howells the excess and return it to the allocator. 813fc4d5c29SDavid Howells 814fc4d5c29SDavid Howells If trimming is enabled, the excess is trimmed off and returned to the 815fc4d5c29SDavid Howells system allocator, which can cause extra fragmentation, particularly 816fc4d5c29SDavid Howells if there are a lot of transient processes. 817fc4d5c29SDavid Howells 818fc4d5c29SDavid Howells If trimming is disabled, the excess is kept, but not used, which for 819fc4d5c29SDavid Howells long-term mappings means that the space is wasted. 820fc4d5c29SDavid Howells 821fc4d5c29SDavid Howells Trimming can be dynamically controlled through a sysctl option 822fc4d5c29SDavid Howells (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of 823fc4d5c29SDavid Howells excess pages there must be before trimming should occur, or zero if 824fc4d5c29SDavid Howells no trimming is to occur. 825fc4d5c29SDavid Howells 826fc4d5c29SDavid Howells This option specifies the initial value of this option. The default 827fc4d5c29SDavid Howells of 1 says that all excess pages should be trimmed. 828fc4d5c29SDavid Howells 829dd19d293SStephen Kitt See Documentation/admin-guide/mm/nommu-mmap.rst for more information. 830bbddff05STejun Heo 831519bcb79SJohannes Weinerconfig ARCH_WANT_GENERAL_HUGETLB 832519bcb79SJohannes Weiner bool 833519bcb79SJohannes Weiner 834519bcb79SJohannes Weinerconfig ARCH_WANTS_THP_SWAP 835519bcb79SJohannes Weiner def_bool n 836519bcb79SJohannes Weiner 837519bcb79SJohannes Weinermenuconfig TRANSPARENT_HUGEPAGE 83813ece886SAndrea Arcangeli bool "Transparent Hugepage Support" 839554b0f3cSSebastian Andrzej Siewior depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT 8405d689240SAndrea Arcangeli select COMPACTION 8413a08cd52SMatthew Wilcox select XARRAY_MULTI 8424c76d9d1SAndrea Arcangeli help 8434c76d9d1SAndrea Arcangeli Transparent Hugepages allows the kernel to use huge pages and 8444c76d9d1SAndrea Arcangeli huge tlb transparently to the applications whenever possible. 8454c76d9d1SAndrea Arcangeli This feature can improve computing performance to certain 8464c76d9d1SAndrea Arcangeli applications by speeding up page faults during memory 8474c76d9d1SAndrea Arcangeli allocation, by reducing the number of tlb misses and by speeding 8484c76d9d1SAndrea Arcangeli up the pagetable walking. 8494c76d9d1SAndrea Arcangeli 8504c76d9d1SAndrea Arcangeli If memory constrained on embedded, you may want to say N. 8514c76d9d1SAndrea Arcangeli 852519bcb79SJohannes Weinerif TRANSPARENT_HUGEPAGE 853519bcb79SJohannes Weiner 85413ece886SAndrea Arcangelichoice 85513ece886SAndrea Arcangeli prompt "Transparent Hugepage Support sysfs defaults" 85613ece886SAndrea Arcangeli depends on TRANSPARENT_HUGEPAGE 85713ece886SAndrea Arcangeli default TRANSPARENT_HUGEPAGE_ALWAYS 85813ece886SAndrea Arcangeli help 85913ece886SAndrea Arcangeli Selects the sysfs defaults for Transparent Hugepage Support. 86013ece886SAndrea Arcangeli 86113ece886SAndrea Arcangeli config TRANSPARENT_HUGEPAGE_ALWAYS 86213ece886SAndrea Arcangeli bool "always" 86313ece886SAndrea Arcangeli help 86413ece886SAndrea Arcangeli Enabling Transparent Hugepage always, can increase the 86513ece886SAndrea Arcangeli memory footprint of applications without a guaranteed 86613ece886SAndrea Arcangeli benefit but it will work automatically for all applications. 86713ece886SAndrea Arcangeli 86813ece886SAndrea Arcangeli config TRANSPARENT_HUGEPAGE_MADVISE 86913ece886SAndrea Arcangeli bool "madvise" 87013ece886SAndrea Arcangeli help 87113ece886SAndrea Arcangeli Enabling Transparent Hugepage madvise, will only provide a 87213ece886SAndrea Arcangeli performance improvement benefit to the applications using 87313ece886SAndrea Arcangeli madvise(MADV_HUGEPAGE) but it won't risk to increase the 87413ece886SAndrea Arcangeli memory footprint of applications without a guaranteed 87513ece886SAndrea Arcangeli benefit. 876683ec99fSDmytro Maluka 877683ec99fSDmytro Maluka config TRANSPARENT_HUGEPAGE_NEVER 878683ec99fSDmytro Maluka bool "never" 879683ec99fSDmytro Maluka help 880683ec99fSDmytro Maluka Disable Transparent Hugepage by default. It can still be 881683ec99fSDmytro Maluka enabled at runtime via sysfs. 88213ece886SAndrea Arcangeliendchoice 88313ece886SAndrea Arcangeli 88438d8b4e6SHuang Yingconfig THP_SWAP 88538d8b4e6SHuang Ying def_bool y 886dad6a5ebSHugh Dickins depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT 88738d8b4e6SHuang Ying help 88838d8b4e6SHuang Ying Swap transparent huge pages in one piece, without splitting. 88914fef284SHuang Ying XXX: For now, swap cluster backing transparent huge page 89014fef284SHuang Ying will be split after swapout. 89138d8b4e6SHuang Ying 89238d8b4e6SHuang Ying For selection by architectures with reasonable THP sizes. 89338d8b4e6SHuang Ying 894519bcb79SJohannes Weinerconfig READ_ONLY_THP_FOR_FS 895519bcb79SJohannes Weiner bool "Read-only THP for filesystems (EXPERIMENTAL)" 896519bcb79SJohannes Weiner depends on TRANSPARENT_HUGEPAGE && SHMEM 897519bcb79SJohannes Weiner 898519bcb79SJohannes Weiner help 899519bcb79SJohannes Weiner Allow khugepaged to put read-only file-backed pages in THP. 900519bcb79SJohannes Weiner 901519bcb79SJohannes Weiner This is marked experimental because it is a new feature. Write 902519bcb79SJohannes Weiner support of file THPs will be developed in the next few release 903519bcb79SJohannes Weiner cycles. 904519bcb79SJohannes Weiner 905519bcb79SJohannes Weinerendif # TRANSPARENT_HUGEPAGE 906519bcb79SJohannes Weiner 907e496cf3dSKirill A. Shutemov# 908bbddff05STejun Heo# UP and nommu archs use km based percpu allocator 909bbddff05STejun Heo# 910bbddff05STejun Heoconfig NEED_PER_CPU_KM 9113583521aSVladimir Murzin depends on !SMP || !MMU 912bbddff05STejun Heo bool 913bbddff05STejun Heo default y 914077b1f83SDan Magenheimer 9157ecd19cfSKefeng Wangconfig NEED_PER_CPU_EMBED_FIRST_CHUNK 9167ecd19cfSKefeng Wang bool 9177ecd19cfSKefeng Wang 9187ecd19cfSKefeng Wangconfig NEED_PER_CPU_PAGE_FIRST_CHUNK 9197ecd19cfSKefeng Wang bool 9207ecd19cfSKefeng Wang 9217ecd19cfSKefeng Wangconfig USE_PERCPU_NUMA_NODE_ID 9227ecd19cfSKefeng Wang bool 9237ecd19cfSKefeng Wang 9247ecd19cfSKefeng Wangconfig HAVE_SETUP_PER_CPU_AREA 9257ecd19cfSKefeng Wang bool 9267ecd19cfSKefeng Wang 927f825c736SAneesh Kumar K.Vconfig CMA 928f825c736SAneesh Kumar K.V bool "Contiguous Memory Allocator" 929aca52c39SMike Rapoport depends on MMU 930f825c736SAneesh Kumar K.V select MIGRATION 931f825c736SAneesh Kumar K.V select MEMORY_ISOLATION 932f825c736SAneesh Kumar K.V help 933f825c736SAneesh Kumar K.V This enables the Contiguous Memory Allocator which allows other 934f825c736SAneesh Kumar K.V subsystems to allocate big physically-contiguous blocks of memory. 935f825c736SAneesh Kumar K.V CMA reserves a region of memory and allows only movable pages to 936f825c736SAneesh Kumar K.V be allocated from it. This way, the kernel can use the memory for 937f825c736SAneesh Kumar K.V pagecache and when a subsystem requests for contiguous area, the 938f825c736SAneesh Kumar K.V allocated pages are migrated away to serve the contiguous request. 939f825c736SAneesh Kumar K.V 940f825c736SAneesh Kumar K.V If unsure, say "n". 941f825c736SAneesh Kumar K.V 942f825c736SAneesh Kumar K.Vconfig CMA_DEBUG 943f825c736SAneesh Kumar K.V bool "CMA debug messages (DEVELOPMENT)" 944f825c736SAneesh Kumar K.V depends on DEBUG_KERNEL && CMA 945f825c736SAneesh Kumar K.V help 946f825c736SAneesh Kumar K.V Turns on debug messages in CMA. This produces KERN_DEBUG 947f825c736SAneesh Kumar K.V messages for every CMA call as well as various messages while 948f825c736SAneesh Kumar K.V processing calls such as dma_alloc_from_contiguous(). 949f825c736SAneesh Kumar K.V This option does not affect warning and error messages. 950bf550fc9SAlexander Graf 95128b24c1fSSasha Levinconfig CMA_DEBUGFS 95228b24c1fSSasha Levin bool "CMA debugfs interface" 95328b24c1fSSasha Levin depends on CMA && DEBUG_FS 95428b24c1fSSasha Levin help 95528b24c1fSSasha Levin Turns on the DebugFS interface for CMA. 95628b24c1fSSasha Levin 95743ca106fSMinchan Kimconfig CMA_SYSFS 95843ca106fSMinchan Kim bool "CMA information through sysfs interface" 95943ca106fSMinchan Kim depends on CMA && SYSFS 96043ca106fSMinchan Kim help 96143ca106fSMinchan Kim This option exposes some sysfs attributes to get information 96243ca106fSMinchan Kim from CMA. 96343ca106fSMinchan Kim 964a254129eSJoonsoo Kimconfig CMA_AREAS 965a254129eSJoonsoo Kim int "Maximum count of the CMA areas" 966a254129eSJoonsoo Kim depends on CMA 967b7176c26SBarry Song default 19 if NUMA 968a254129eSJoonsoo Kim default 7 969a254129eSJoonsoo Kim help 970a254129eSJoonsoo Kim CMA allows to create CMA areas for particular purpose, mainly, 971a254129eSJoonsoo Kim used as device private area. This parameter sets the maximum 972a254129eSJoonsoo Kim number of CMA area in the system. 973a254129eSJoonsoo Kim 974b7176c26SBarry Song If unsure, leave the default value "7" in UMA and "19" in NUMA. 975a254129eSJoonsoo Kim 976af8d417aSDan Streetmanconfig MEM_SOFT_DIRTY 977af8d417aSDan Streetman bool "Track memory changes" 978af8d417aSDan Streetman depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS 979af8d417aSDan Streetman select PROC_PAGE_MONITOR 9804e2e2770SSeth Jennings help 981af8d417aSDan Streetman This option enables memory changes tracking by introducing a 982af8d417aSDan Streetman soft-dirty bit on pte-s. This bit it set when someone writes 983af8d417aSDan Streetman into a page just as regular dirty bit, but unlike the latter 984af8d417aSDan Streetman it can be cleared by hands. 985af8d417aSDan Streetman 9861ad1335dSMike Rapoport See Documentation/admin-guide/mm/soft-dirty.rst for more details. 9874e2e2770SSeth Jennings 9889e5c33d7SMark Salterconfig GENERIC_EARLY_IOREMAP 9899e5c33d7SMark Salter bool 990042d27acSHelge Deller 99122ee3ea5SHelge Dellerconfig STACK_MAX_DEFAULT_SIZE_MB 99222ee3ea5SHelge Deller int "Default maximum user stack size for 32-bit processes (MB)" 99322ee3ea5SHelge Deller default 100 994042d27acSHelge Deller range 8 2048 995042d27acSHelge Deller depends on STACK_GROWSUP && (!64BIT || COMPAT) 996042d27acSHelge Deller help 997042d27acSHelge Deller This is the maximum stack size in Megabytes in the VM layout of 32-bit 998042d27acSHelge Deller user processes when the stack grows upwards (currently only on parisc 99922ee3ea5SHelge Deller arch) when the RLIMIT_STACK hard limit is unlimited. 1000042d27acSHelge Deller 100122ee3ea5SHelge Deller A sane initial value is 100 MB. 10023a80a7faSMel Gorman 10033a80a7faSMel Gormanconfig DEFERRED_STRUCT_PAGE_INIT 10041ce22103SVlastimil Babka bool "Defer initialisation of struct pages to kthreads" 1005d39f8fb4SMike Rapoport depends on SPARSEMEM 1006ab1e8d89SPavel Tatashin depends on !NEED_PER_CPU_KM 1007889c695dSPasha Tatashin depends on 64BIT 1008e4443149SDaniel Jordan select PADATA 10093a80a7faSMel Gorman help 10103a80a7faSMel Gorman Ordinarily all struct pages are initialised during early boot in a 10113a80a7faSMel Gorman single thread. On very large machines this can take a considerable 10123a80a7faSMel Gorman amount of time. If this option is set, large machines will bring up 1013e4443149SDaniel Jordan a subset of memmap at boot and then initialise the rest in parallel. 1014e4443149SDaniel Jordan This has a potential performance impact on tasks running early in the 10151ce22103SVlastimil Babka lifetime of the system until these kthreads finish the 10161ce22103SVlastimil Babka initialisation. 1017033fbae9SDan Williams 10181c676e0dSSeongJae Parkconfig PAGE_IDLE_FLAG 10191c676e0dSSeongJae Park bool 10201c676e0dSSeongJae Park select PAGE_EXTENSION if !64BIT 10211c676e0dSSeongJae Park help 10221c676e0dSSeongJae Park This adds PG_idle and PG_young flags to 'struct page'. PTE Accessed 10231c676e0dSSeongJae Park bit writers can set the state of the bit in the flags so that PTE 10241c676e0dSSeongJae Park Accessed bit readers may avoid disturbance. 10251c676e0dSSeongJae Park 102633c3fc71SVladimir Davydovconfig IDLE_PAGE_TRACKING 102733c3fc71SVladimir Davydov bool "Enable idle page tracking" 102833c3fc71SVladimir Davydov depends on SYSFS && MMU 10291c676e0dSSeongJae Park select PAGE_IDLE_FLAG 103033c3fc71SVladimir Davydov help 103133c3fc71SVladimir Davydov This feature allows to estimate the amount of user pages that have 103233c3fc71SVladimir Davydov not been touched during a given period of time. This information can 103333c3fc71SVladimir Davydov be useful to tune memory cgroup limits and/or for job placement 103433c3fc71SVladimir Davydov within a compute cluster. 103533c3fc71SVladimir Davydov 10361ad1335dSMike Rapoport See Documentation/admin-guide/mm/idle_page_tracking.rst for 10371ad1335dSMike Rapoport more details. 103833c3fc71SVladimir Davydov 1039c2280be8SAnshuman Khandualconfig ARCH_HAS_CACHE_LINE_SIZE 1040c2280be8SAnshuman Khandual bool 1041c2280be8SAnshuman Khandual 10422792d84eSKees Cookconfig ARCH_HAS_CURRENT_STACK_POINTER 10432792d84eSKees Cook bool 10442792d84eSKees Cook help 10452792d84eSKees Cook In support of HARDENED_USERCOPY performing stack variable lifetime 10462792d84eSKees Cook checking, an architecture-agnostic way to find the stack pointer 10472792d84eSKees Cook is needed. Once an architecture defines an unsigned long global 10482792d84eSKees Cook register alias named "current_stack_pointer", this config can be 10492792d84eSKees Cook selected. 10502792d84eSKees Cook 105117596731SRobin Murphyconfig ARCH_HAS_PTE_DEVMAP 105265f7d049SOliver O'Halloran bool 105365f7d049SOliver O'Halloran 105463703f37SKefeng Wangconfig ARCH_HAS_ZONE_DMA_SET 105563703f37SKefeng Wang bool 105663703f37SKefeng Wang 105763703f37SKefeng Wangconfig ZONE_DMA 105863703f37SKefeng Wang bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET 105963703f37SKefeng Wang default y if ARM64 || X86 106063703f37SKefeng Wang 106163703f37SKefeng Wangconfig ZONE_DMA32 106263703f37SKefeng Wang bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET 106363703f37SKefeng Wang depends on !X86_32 106463703f37SKefeng Wang default y if ARM64 106563703f37SKefeng Wang 1066033fbae9SDan Williamsconfig ZONE_DEVICE 10675042db43SJérôme Glisse bool "Device memory (pmem, HMM, etc...) hotplug support" 1068033fbae9SDan Williams depends on MEMORY_HOTPLUG 1069033fbae9SDan Williams depends on MEMORY_HOTREMOVE 107099490f16SDan Williams depends on SPARSEMEM_VMEMMAP 107117596731SRobin Murphy depends on ARCH_HAS_PTE_DEVMAP 10723a08cd52SMatthew Wilcox select XARRAY_MULTI 1073033fbae9SDan Williams 1074033fbae9SDan Williams help 1075033fbae9SDan Williams Device memory hotplug support allows for establishing pmem, 1076033fbae9SDan Williams or other device driver discovered memory regions, in the 1077033fbae9SDan Williams memmap. This allows pfn_to_page() lookups of otherwise 1078033fbae9SDan Williams "device-physical" addresses which is needed for using a DAX 1079033fbae9SDan Williams mapping in an O_DIRECT operation, among other things. 1080033fbae9SDan Williams 1081033fbae9SDan Williams If FS_DAX is enabled, then say Y. 108206a660adSLinus Torvalds 10839c240a7bSChristoph Hellwig# 10849c240a7bSChristoph Hellwig# Helpers to mirror range of the CPU page tables of a process into device page 10859c240a7bSChristoph Hellwig# tables. 10869c240a7bSChristoph Hellwig# 1087c0b12405SJérôme Glisseconfig HMM_MIRROR 10889c240a7bSChristoph Hellwig bool 1089f442c283SChristoph Hellwig depends on MMU 1090c0b12405SJérôme Glisse 109114b80582SDan Williamsconfig GET_FREE_REGION 109214b80582SDan Williams depends on SPARSEMEM 109314b80582SDan Williams bool 109414b80582SDan Williams 10955042db43SJérôme Glisseconfig DEVICE_PRIVATE 10965042db43SJérôme Glisse bool "Unaddressable device memory (GPU memory, ...)" 10977328d9ccSChristoph Hellwig depends on ZONE_DEVICE 109814b80582SDan Williams select GET_FREE_REGION 10995042db43SJérôme Glisse 11005042db43SJérôme Glisse help 11015042db43SJérôme Glisse Allows creation of struct pages to represent unaddressable device 11025042db43SJérôme Glisse memory; i.e., memory that is only accessible from the device (or 11035042db43SJérôme Glisse group of devices). You likely also want to select HMM_MIRROR. 11045042db43SJérôme Glisse 11053e9a9e25SChristoph Hellwigconfig VMAP_PFN 11063e9a9e25SChristoph Hellwig bool 11073e9a9e25SChristoph Hellwig 110863c17fb8SDave Hansenconfig ARCH_USES_HIGH_VMA_FLAGS 110963c17fb8SDave Hansen bool 111066d37570SDave Hansenconfig ARCH_HAS_PKEYS 111166d37570SDave Hansen bool 111230a5b536SDennis Zhou 1113b0284cd2SCatalin Marinasconfig ARCH_USES_PG_ARCH_X 1114b0284cd2SCatalin Marinas bool 1115b0284cd2SCatalin Marinas help 1116b0284cd2SCatalin Marinas Enable the definition of PG_arch_x page flags with x > 1. Only 1117b0284cd2SCatalin Marinas suitable for 64-bit architectures with CONFIG_FLATMEM or 1118b0284cd2SCatalin Marinas CONFIG_SPARSEMEM_VMEMMAP enabled, otherwise there may not be 1119b0284cd2SCatalin Marinas enough room for additional bits in page->flags. 1120b0284cd2SCatalin Marinas 11210710d012SVlastimil Babkaconfig VM_EVENT_COUNTERS 11220710d012SVlastimil Babka default y 11230710d012SVlastimil Babka bool "Enable VM event counters for /proc/vmstat" if EXPERT 11240710d012SVlastimil Babka help 11250710d012SVlastimil Babka VM event counters are needed for event counts to be shown. 11260710d012SVlastimil Babka This option allows the disabling of the VM event counters 11270710d012SVlastimil Babka on EXPERT systems. /proc/vmstat will only show page counts 11280710d012SVlastimil Babka if VM event counters are disabled. 11290710d012SVlastimil Babka 113030a5b536SDennis Zhouconfig PERCPU_STATS 113130a5b536SDennis Zhou bool "Collect percpu memory statistics" 113230a5b536SDennis Zhou help 113330a5b536SDennis Zhou This feature collects and exposes statistics via debugfs. The 113430a5b536SDennis Zhou information includes global and per chunk statistics, which can 113530a5b536SDennis Zhou be used to help understand percpu memory usage. 113664c349f4SKirill A. Shutemov 11379c84f229SJohn Hubbardconfig GUP_TEST 11389c84f229SJohn Hubbard bool "Enable infrastructure for get_user_pages()-related unit tests" 1139d0de8241SBarry Song depends on DEBUG_FS 114064c349f4SKirill A. Shutemov help 11419c84f229SJohn Hubbard Provides /sys/kernel/debug/gup_test, which in turn provides a way 11429c84f229SJohn Hubbard to make ioctl calls that can launch kernel-based unit tests for 11439c84f229SJohn Hubbard the get_user_pages*() and pin_user_pages*() family of API calls. 114464c349f4SKirill A. Shutemov 11459c84f229SJohn Hubbard These tests include benchmark testing of the _fast variants of 11469c84f229SJohn Hubbard get_user_pages*() and pin_user_pages*(), as well as smoke tests of 11479c84f229SJohn Hubbard the non-_fast variants. 11489c84f229SJohn Hubbard 1149f4f9bda4SJohn Hubbard There is also a sub-test that allows running dump_page() on any 1150f4f9bda4SJohn Hubbard of up to eight pages (selected by command line args) within the 1151f4f9bda4SJohn Hubbard range of user-space addresses. These pages are either pinned via 1152f4f9bda4SJohn Hubbard pin_user_pages*(), or pinned via get_user_pages*(), as specified 1153f4f9bda4SJohn Hubbard by other command line arguments. 1154f4f9bda4SJohn Hubbard 1155baa489faSSeongJae Park See tools/testing/selftests/mm/gup_test.c 11563010a5eaSLaurent Dufour 1157d0de8241SBarry Songcomment "GUP_TEST needs to have DEBUG_FS enabled" 1158d0de8241SBarry Song depends on !GUP_TEST && !DEBUG_FS 11593010a5eaSLaurent Dufour 11606ca297d4SPeter Zijlstraconfig GUP_GET_PXX_LOW_HIGH 116139656e83SChristoph Hellwig bool 116239656e83SChristoph Hellwig 1163def85743SKeith Buschconfig DMAPOOL_TEST 1164def85743SKeith Busch tristate "Enable a module to run time tests on dma_pool" 1165def85743SKeith Busch depends on HAS_DMA 1166def85743SKeith Busch help 1167def85743SKeith Busch Provides a test module that will allocate and free many blocks of 1168def85743SKeith Busch various sizes and report how long it takes. This is intended to 1169def85743SKeith Busch provide a consistent way to measure how changes to the 1170def85743SKeith Busch dma_pool_alloc/free routines affect performance. 1171def85743SKeith Busch 11723010a5eaSLaurent Dufourconfig ARCH_HAS_PTE_SPECIAL 11733010a5eaSLaurent Dufour bool 117459e0b520SChristoph Hellwig 1175cbd34da7SChristoph Hellwig# 1176cbd34da7SChristoph Hellwig# Some architectures require a special hugepage directory format that is 1177cbd34da7SChristoph Hellwig# required to support multiple hugepage sizes. For example a4fe3ce76 1178cbd34da7SChristoph Hellwig# "powerpc/mm: Allow more flexible layouts for hugepage pagetables" 1179cbd34da7SChristoph Hellwig# introduced it on powerpc. This allows for a more flexible hugepage 1180cbd34da7SChristoph Hellwig# pagetable layouts. 1181cbd34da7SChristoph Hellwig# 1182cbd34da7SChristoph Hellwigconfig ARCH_HAS_HUGEPD 1183cbd34da7SChristoph Hellwig bool 1184cbd34da7SChristoph Hellwig 1185c5acad84SThomas Hellstromconfig MAPPING_DIRTY_HELPERS 1186c5acad84SThomas Hellstrom bool 1187c5acad84SThomas Hellstrom 1188298fa1adSThomas Gleixnerconfig KMAP_LOCAL 1189298fa1adSThomas Gleixner bool 1190298fa1adSThomas Gleixner 1191825c43f5SArd Biesheuvelconfig KMAP_LOCAL_NON_LINEAR_PTE_ARRAY 1192825c43f5SArd Biesheuvel bool 1193825c43f5SArd Biesheuvel 11941fbaf8fcSChristoph Hellwig# struct io_mapping based helper. Selected by drivers that need them 11951fbaf8fcSChristoph Hellwigconfig IO_MAPPING 11961fbaf8fcSChristoph Hellwig bool 11971507f512SMike Rapoport 1198626e98cbSThomas Weißschuhconfig MEMFD_CREATE 1199626e98cbSThomas Weißschuh bool "Enable memfd_create() system call" if EXPERT 1200626e98cbSThomas Weißschuh 12011507f512SMike Rapoportconfig SECRETMEM 120274947724SLukas Bulwahn default y 120374947724SLukas Bulwahn bool "Enable memfd_secret() system call" if EXPERT 120474947724SLukas Bulwahn depends on ARCH_HAS_SET_DIRECT_MAP 120574947724SLukas Bulwahn help 120674947724SLukas Bulwahn Enable the memfd_secret() system call with the ability to create 120774947724SLukas Bulwahn memory areas visible only in the context of the owning process and 120874947724SLukas Bulwahn not mapped to other processes and other kernel page tables. 12091507f512SMike Rapoport 12109a10064fSColin Crossconfig ANON_VMA_NAME 12119a10064fSColin Cross bool "Anonymous VMA name support" 12129a10064fSColin Cross depends on PROC_FS && ADVISE_SYSCALLS && MMU 12139a10064fSColin Cross 12149a10064fSColin Cross help 12159a10064fSColin Cross Allow naming anonymous virtual memory areas. 12169a10064fSColin Cross 12179a10064fSColin Cross This feature allows assigning names to virtual memory areas. Assigned 12189a10064fSColin Cross names can be later retrieved from /proc/pid/maps and /proc/pid/smaps 12199a10064fSColin Cross and help identifying individual anonymous memory areas. 12209a10064fSColin Cross Assigning a name to anonymous virtual memory area might prevent that 12219a10064fSColin Cross area from being merged with adjacent virtual memory areas due to the 12229a10064fSColin Cross difference in their name. 12239a10064fSColin Cross 1224430529b5SPeter Xuconfig HAVE_ARCH_USERFAULTFD_WP 1225430529b5SPeter Xu bool 1226430529b5SPeter Xu help 1227430529b5SPeter Xu Arch has userfaultfd write protection support 1228430529b5SPeter Xu 1229430529b5SPeter Xuconfig HAVE_ARCH_USERFAULTFD_MINOR 1230430529b5SPeter Xu bool 1231430529b5SPeter Xu help 1232430529b5SPeter Xu Arch has userfaultfd minor fault support 1233430529b5SPeter Xu 123497219cc3SPeter Xumenuconfig USERFAULTFD 123597219cc3SPeter Xu bool "Enable userfaultfd() system call" 123697219cc3SPeter Xu depends on MMU 123797219cc3SPeter Xu help 123897219cc3SPeter Xu Enable the userfaultfd() system call that allows to intercept and 123997219cc3SPeter Xu handle page faults in userland. 124097219cc3SPeter Xu 124197219cc3SPeter Xuif USERFAULTFD 12421db9dbc2SPeter Xuconfig PTE_MARKER_UFFD_WP 124381e0f15fSPeter Xu bool "Userfaultfd write protection support for shmem/hugetlbfs" 124481e0f15fSPeter Xu default y 124581e0f15fSPeter Xu depends on HAVE_ARCH_USERFAULTFD_WP 12461db9dbc2SPeter Xu 12471db9dbc2SPeter Xu help 12481db9dbc2SPeter Xu Allows to create marker PTEs for userfaultfd write protection 12491db9dbc2SPeter Xu purposes. It is required to enable userfaultfd write protection on 12501db9dbc2SPeter Xu file-backed memory types like shmem and hugetlbfs. 125197219cc3SPeter Xuendif # USERFAULTFD 12521db9dbc2SPeter Xu 1253ac35a490SYu Zhao# multi-gen LRU { 1254ec1c86b2SYu Zhaoconfig LRU_GEN 1255ec1c86b2SYu Zhao bool "Multi-Gen LRU" 1256ec1c86b2SYu Zhao depends on MMU 1257ec1c86b2SYu Zhao # make sure folio->flags has enough spare bits 1258ec1c86b2SYu Zhao depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP 1259ec1c86b2SYu Zhao help 126007017acbSYu Zhao A high performance LRU implementation to overcommit memory. See 126107017acbSYu Zhao Documentation/admin-guide/mm/multigen_lru.rst for details. 1262ec1c86b2SYu Zhao 1263354ed597SYu Zhaoconfig LRU_GEN_ENABLED 1264354ed597SYu Zhao bool "Enable by default" 1265354ed597SYu Zhao depends on LRU_GEN 1266354ed597SYu Zhao help 1267354ed597SYu Zhao This option enables the multi-gen LRU by default. 1268354ed597SYu Zhao 1269ac35a490SYu Zhaoconfig LRU_GEN_STATS 1270ac35a490SYu Zhao bool "Full stats for debugging" 1271ac35a490SYu Zhao depends on LRU_GEN 1272ac35a490SYu Zhao help 1273ac35a490SYu Zhao Do not enable this option unless you plan to look at historical stats 1274ac35a490SYu Zhao from evicted generations for debugging purpose. 1275ac35a490SYu Zhao 1276ac35a490SYu Zhao This option has a per-memcg and per-node memory overhead. 1277ac35a490SYu Zhao# } 1278ac35a490SYu Zhao 12790b6cc04fSSuren Baghdasaryanconfig ARCH_SUPPORTS_PER_VMA_LOCK 12800b6cc04fSSuren Baghdasaryan def_bool n 12810b6cc04fSSuren Baghdasaryan 12820b6cc04fSSuren Baghdasaryanconfig PER_VMA_LOCK 12830b6cc04fSSuren Baghdasaryan def_bool y 12840b6cc04fSSuren Baghdasaryan depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP 12850b6cc04fSSuren Baghdasaryan help 12860b6cc04fSSuren Baghdasaryan Allow per-vma locking during page fault handling. 12870b6cc04fSSuren Baghdasaryan 12880b6cc04fSSuren Baghdasaryan This feature allows locking each virtual memory area separately when 12890b6cc04fSSuren Baghdasaryan handling page faults instead of taking mmap_lock. 12900b6cc04fSSuren Baghdasaryan 1291c2508ec5SLinus Torvaldsconfig LOCK_MM_AND_FIND_VMA 1292c2508ec5SLinus Torvalds bool 1293c2508ec5SLinus Torvalds depends on !STACK_GROWSUP 1294c2508ec5SLinus Torvalds 12952224d848SSeongJae Parksource "mm/damon/Kconfig" 12962224d848SSeongJae Park 129759e0b520SChristoph Hellwigendmenu 1298