xref: /linux/mm/Kconfig (revision 44d46b76c3a4b514a0cc9dab147ed430e5c1d699)
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
48b5ba474fSNhat Phamconfig ZSWAP_SHRINKER_DEFAULT_ON
49b5ba474fSNhat Pham	bool "Shrink the zswap pool on memory pressure"
50b5ba474fSNhat Pham	depends on ZSWAP
51b5ba474fSNhat Pham	default n
52b5ba474fSNhat Pham	help
53b5ba474fSNhat Pham	  If selected, the zswap shrinker will be enabled, and the pages
54b5ba474fSNhat Pham	  stored in the zswap pool will become available for reclaim (i.e
55b5ba474fSNhat Pham	  written back to the backing swap device) on memory pressure.
56b5ba474fSNhat Pham
57b5ba474fSNhat Pham	  This means that zswap writeback could happen even if the pool is
58b5ba474fSNhat Pham	  not yet full, or the cgroup zswap limit has not been reached,
59b5ba474fSNhat Pham	  reducing the chance that cold pages will reside in the zswap pool
60b5ba474fSNhat Pham	  and consume memory indefinitely.
61b5ba474fSNhat Pham
62519bcb79SJohannes Weinerchoice
63b3fbd58fSJohannes Weiner	prompt "Default compressor"
64519bcb79SJohannes Weiner	depends on ZSWAP
65519bcb79SJohannes Weiner	default ZSWAP_COMPRESSOR_DEFAULT_LZO
66519bcb79SJohannes Weiner	help
67519bcb79SJohannes Weiner	  Selects the default compression algorithm for the compressed cache
68519bcb79SJohannes Weiner	  for swap pages.
69519bcb79SJohannes Weiner
70519bcb79SJohannes Weiner	  For an overview what kind of performance can be expected from
71519bcb79SJohannes Weiner	  a particular compression algorithm please refer to the benchmarks
72519bcb79SJohannes Weiner	  available at the following LWN page:
73519bcb79SJohannes Weiner	  https://lwn.net/Articles/751795/
74519bcb79SJohannes Weiner
75519bcb79SJohannes Weiner	  If in doubt, select 'LZO'.
76519bcb79SJohannes Weiner
77519bcb79SJohannes Weiner	  The selection made here can be overridden by using the kernel
78519bcb79SJohannes Weiner	  command line 'zswap.compressor=' option.
79519bcb79SJohannes Weiner
80519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
81519bcb79SJohannes Weiner	bool "Deflate"
82519bcb79SJohannes Weiner	select CRYPTO_DEFLATE
83519bcb79SJohannes Weiner	help
84519bcb79SJohannes Weiner	  Use the Deflate algorithm as the default compression algorithm.
85519bcb79SJohannes Weiner
86519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZO
87519bcb79SJohannes Weiner	bool "LZO"
88519bcb79SJohannes Weiner	select CRYPTO_LZO
89519bcb79SJohannes Weiner	help
90519bcb79SJohannes Weiner	  Use the LZO algorithm as the default compression algorithm.
91519bcb79SJohannes Weiner
92519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_842
93519bcb79SJohannes Weiner	bool "842"
94519bcb79SJohannes Weiner	select CRYPTO_842
95519bcb79SJohannes Weiner	help
96519bcb79SJohannes Weiner	  Use the 842 algorithm as the default compression algorithm.
97519bcb79SJohannes Weiner
98519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4
99519bcb79SJohannes Weiner	bool "LZ4"
100519bcb79SJohannes Weiner	select CRYPTO_LZ4
101519bcb79SJohannes Weiner	help
102519bcb79SJohannes Weiner	  Use the LZ4 algorithm as the default compression algorithm.
103519bcb79SJohannes Weiner
104519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
105519bcb79SJohannes Weiner	bool "LZ4HC"
106519bcb79SJohannes Weiner	select CRYPTO_LZ4HC
107519bcb79SJohannes Weiner	help
108519bcb79SJohannes Weiner	  Use the LZ4HC algorithm as the default compression algorithm.
109519bcb79SJohannes Weiner
110519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_ZSTD
111519bcb79SJohannes Weiner	bool "zstd"
112519bcb79SJohannes Weiner	select CRYPTO_ZSTD
113519bcb79SJohannes Weiner	help
114519bcb79SJohannes Weiner	  Use the zstd algorithm as the default compression algorithm.
115519bcb79SJohannes Weinerendchoice
116519bcb79SJohannes Weiner
117519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT
118519bcb79SJohannes Weiner       string
119519bcb79SJohannes Weiner       depends on ZSWAP
120519bcb79SJohannes Weiner       default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
121519bcb79SJohannes Weiner       default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
122519bcb79SJohannes Weiner       default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
123519bcb79SJohannes Weiner       default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
124519bcb79SJohannes Weiner       default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
125519bcb79SJohannes Weiner       default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
126519bcb79SJohannes Weiner       default ""
127519bcb79SJohannes Weiner
128519bcb79SJohannes Weinerchoice
129b3fbd58fSJohannes Weiner	prompt "Default allocator"
130519bcb79SJohannes Weiner	depends on ZSWAP
13104cb7502SMatthew Wilcox (Oracle)	default ZSWAP_ZPOOL_DEFAULT_ZSMALLOC if MMU
132519bcb79SJohannes Weiner	default ZSWAP_ZPOOL_DEFAULT_ZBUD
133519bcb79SJohannes Weiner	help
134519bcb79SJohannes Weiner	  Selects the default allocator for the compressed cache for
135519bcb79SJohannes Weiner	  swap pages.
136519bcb79SJohannes Weiner	  The default is 'zbud' for compatibility, however please do
137519bcb79SJohannes Weiner	  read the description of each of the allocators below before
138519bcb79SJohannes Weiner	  making a right choice.
139519bcb79SJohannes Weiner
140519bcb79SJohannes Weiner	  The selection made here can be overridden by using the kernel
141519bcb79SJohannes Weiner	  command line 'zswap.zpool=' option.
142519bcb79SJohannes Weiner
143519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_ZBUD
144519bcb79SJohannes Weiner	bool "zbud"
145519bcb79SJohannes Weiner	select ZBUD
146519bcb79SJohannes Weiner	help
147519bcb79SJohannes Weiner	  Use the zbud allocator as the default allocator.
148519bcb79SJohannes Weiner
1497a2369b7SYosry Ahmedconfig ZSWAP_ZPOOL_DEFAULT_Z3FOLD_DEPRECATED
1507a2369b7SYosry Ahmed	bool "z3foldi (DEPRECATED)"
1517a2369b7SYosry Ahmed	select Z3FOLD_DEPRECATED
152519bcb79SJohannes Weiner	help
153519bcb79SJohannes Weiner	  Use the z3fold allocator as the default allocator.
154519bcb79SJohannes Weiner
1557a2369b7SYosry Ahmed	  Deprecated and scheduled for removal in a few cycles,
1567a2369b7SYosry Ahmed	  see CONFIG_Z3FOLD_DEPRECATED.
1577a2369b7SYosry Ahmed
158519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
159519bcb79SJohannes Weiner	bool "zsmalloc"
160519bcb79SJohannes Weiner	select ZSMALLOC
161519bcb79SJohannes Weiner	help
162519bcb79SJohannes Weiner	  Use the zsmalloc allocator as the default allocator.
163519bcb79SJohannes Weinerendchoice
164519bcb79SJohannes Weiner
165519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT
166519bcb79SJohannes Weiner       string
167519bcb79SJohannes Weiner       depends on ZSWAP
168519bcb79SJohannes Weiner       default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD
1697a2369b7SYosry Ahmed       default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD_DEPRECATED
170519bcb79SJohannes Weiner       default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
171519bcb79SJohannes Weiner       default ""
172519bcb79SJohannes Weiner
173519bcb79SJohannes Weinerconfig ZBUD
174b3fbd58fSJohannes Weiner	tristate "2:1 compression allocator (zbud)"
175b3fbd58fSJohannes Weiner	depends on ZSWAP
176519bcb79SJohannes Weiner	help
177519bcb79SJohannes Weiner	  A special purpose allocator for storing compressed pages.
178519bcb79SJohannes Weiner	  It is designed to store up to two compressed pages per physical
179519bcb79SJohannes Weiner	  page.  While this design limits storage density, it has simple and
180519bcb79SJohannes Weiner	  deterministic reclaim properties that make it preferable to a higher
181519bcb79SJohannes Weiner	  density approach when reclaim will be used.
182519bcb79SJohannes Weiner
1837a2369b7SYosry Ahmedconfig Z3FOLD_DEPRECATED
1847a2369b7SYosry Ahmed	tristate "3:1 compression allocator (z3fold) (DEPRECATED)"
185b3fbd58fSJohannes Weiner	depends on ZSWAP
186519bcb79SJohannes Weiner	help
1877a2369b7SYosry Ahmed	  Deprecated and scheduled for removal in a few cycles. If you have
1887a2369b7SYosry Ahmed	  a good reason for using Z3FOLD over ZSMALLOC, please contact
1897a2369b7SYosry Ahmed	  linux-mm@kvack.org and the zswap maintainers.
1907a2369b7SYosry Ahmed
191519bcb79SJohannes Weiner	  A special purpose allocator for storing compressed pages.
192519bcb79SJohannes Weiner	  It is designed to store up to three compressed pages per physical
193519bcb79SJohannes Weiner	  page. It is a ZBUD derivative so the simplicity and determinism are
194519bcb79SJohannes Weiner	  still there.
195519bcb79SJohannes Weiner
1967a2369b7SYosry Ahmedconfig Z3FOLD
1977a2369b7SYosry Ahmed	tristate
1987a2369b7SYosry Ahmed	default y if Z3FOLD_DEPRECATED=y
1997a2369b7SYosry Ahmed	default m if Z3FOLD_DEPRECATED=m
2007a2369b7SYosry Ahmed	depends on Z3FOLD_DEPRECATED
2017a2369b7SYosry Ahmed
202519bcb79SJohannes Weinerconfig ZSMALLOC
203b3fbd58fSJohannes Weiner	tristate
2045ad7a998SSergey Senozhatsky	prompt "N:1 compression allocator (zsmalloc)" if (ZSWAP || ZRAM)
20504cb7502SMatthew Wilcox (Oracle)	depends on MMU
206519bcb79SJohannes Weiner	help
207519bcb79SJohannes Weiner	  zsmalloc is a slab-based memory allocator designed to store
208b3fbd58fSJohannes Weiner	  pages of various compression levels efficiently. It achieves
209b3fbd58fSJohannes Weiner	  the highest storage density with the least amount of fragmentation.
210519bcb79SJohannes Weiner
211519bcb79SJohannes Weinerconfig ZSMALLOC_STAT
212519bcb79SJohannes Weiner	bool "Export zsmalloc statistics"
213519bcb79SJohannes Weiner	depends on ZSMALLOC
214519bcb79SJohannes Weiner	select DEBUG_FS
215519bcb79SJohannes Weiner	help
216519bcb79SJohannes Weiner	  This option enables code in the zsmalloc to collect various
217519bcb79SJohannes Weiner	  statistics about what's happening in zsmalloc and exports that
218519bcb79SJohannes Weiner	  information to userspace via debugfs.
219519bcb79SJohannes Weiner	  If unsure, say N.
220519bcb79SJohannes Weiner
2214ff93b29SSergey Senozhatskyconfig ZSMALLOC_CHAIN_SIZE
2224ff93b29SSergey Senozhatsky	int "Maximum number of physical pages per-zspage"
223b46402faSSergey Senozhatsky	default 8
2244ff93b29SSergey Senozhatsky	range 4 16
2254ff93b29SSergey Senozhatsky	depends on ZSMALLOC
2264ff93b29SSergey Senozhatsky	help
2274ff93b29SSergey Senozhatsky	  This option sets the upper limit on the number of physical pages
2284ff93b29SSergey Senozhatsky	  that a zmalloc page (zspage) can consist of. The optimal zspage
2294ff93b29SSergey Senozhatsky	  chain size is calculated for each size class during the
2304ff93b29SSergey Senozhatsky	  initialization of the pool.
2314ff93b29SSergey Senozhatsky
2324ff93b29SSergey Senozhatsky	  Changing this option can alter the characteristics of size classes,
2334ff93b29SSergey Senozhatsky	  such as the number of pages per zspage and the number of objects
2344ff93b29SSergey Senozhatsky	  per zspage. This can also result in different configurations of
2354ff93b29SSergey Senozhatsky	  the pool, as zsmalloc merges size classes with similar
2364ff93b29SSergey Senozhatsky	  characteristics.
2374ff93b29SSergey Senozhatsky
2384ff93b29SSergey Senozhatsky	  For more information, see zsmalloc documentation.
2394ff93b29SSergey Senozhatsky
2402a19be61SVlastimil Babkamenu "Slab allocator options"
2417b42f104SJohannes Weiner
2427b42f104SJohannes Weinerconfig SLUB
2432a19be61SVlastimil Babka	def_bool y
244eb07c4f3SVlastimil Babka
245e240e53aSVlastimil Babkaconfig SLUB_TINY
2462a19be61SVlastimil Babka	bool "Configure for minimal memory footprint"
2472a19be61SVlastimil Babka	depends on EXPERT
248e240e53aSVlastimil Babka	select SLAB_MERGE_DEFAULT
249e240e53aSVlastimil Babka	help
2502a19be61SVlastimil Babka	   Configures the slab allocator in a way to achieve minimal memory
251e240e53aSVlastimil Babka	   footprint, sacrificing scalability, debugging and other features.
252e240e53aSVlastimil Babka	   This is intended only for the smallest system that had used the
253e240e53aSVlastimil Babka	   SLOB allocator and is not recommended for systems with more than
254e240e53aSVlastimil Babka	   16MB RAM.
255e240e53aSVlastimil Babka
256e240e53aSVlastimil Babka	   If unsure, say N.
257e240e53aSVlastimil Babka
2587b42f104SJohannes Weinerconfig SLAB_MERGE_DEFAULT
2597b42f104SJohannes Weiner	bool "Allow slab caches to be merged"
2607b42f104SJohannes Weiner	default y
2617b42f104SJohannes Weiner	help
2627b42f104SJohannes Weiner	  For reduced kernel memory fragmentation, slab caches can be
2637b42f104SJohannes Weiner	  merged when they share the same size and other characteristics.
2647b42f104SJohannes Weiner	  This carries a risk of kernel heap overflows being able to
2657b42f104SJohannes Weiner	  overwrite objects from merged caches (and more easily control
2667b42f104SJohannes Weiner	  cache layout), which makes such heap attacks easier to exploit
2677b42f104SJohannes Weiner	  by attackers. By keeping caches unmerged, these kinds of exploits
2687b42f104SJohannes Weiner	  can usually only damage objects in the same cache. To disable
2697b42f104SJohannes Weiner	  merging at runtime, "slab_nomerge" can be passed on the kernel
2707b42f104SJohannes Weiner	  command line.
2717b42f104SJohannes Weiner
2727b42f104SJohannes Weinerconfig SLAB_FREELIST_RANDOM
2737b42f104SJohannes Weiner	bool "Randomize slab freelist"
2742a19be61SVlastimil Babka	depends on !SLUB_TINY
2757b42f104SJohannes Weiner	help
2767b42f104SJohannes Weiner	  Randomizes the freelist order used on creating new pages. This
2777b42f104SJohannes Weiner	  security feature reduces the predictability of the kernel slab
2787b42f104SJohannes Weiner	  allocator against heap overflows.
2797b42f104SJohannes Weiner
2807b42f104SJohannes Weinerconfig SLAB_FREELIST_HARDENED
2817b42f104SJohannes Weiner	bool "Harden slab freelist metadata"
2822a19be61SVlastimil Babka	depends on !SLUB_TINY
2837b42f104SJohannes Weiner	help
2847b42f104SJohannes Weiner	  Many kernel heap attacks try to target slab cache metadata and
2857b42f104SJohannes Weiner	  other infrastructure. This options makes minor performance
2867b42f104SJohannes Weiner	  sacrifices to harden the kernel slab allocator against common
2872a19be61SVlastimil Babka	  freelist exploit methods.
2887b42f104SJohannes Weiner
28967f2df3bSKees Cookconfig SLAB_BUCKETS
29067f2df3bSKees Cook	bool "Support allocation from separate kmalloc buckets"
29167f2df3bSKees Cook	depends on !SLUB_TINY
29267f2df3bSKees Cook	default SLAB_FREELIST_HARDENED
29367f2df3bSKees Cook	help
29467f2df3bSKees Cook	  Kernel heap attacks frequently depend on being able to create
29567f2df3bSKees Cook	  specifically-sized allocations with user-controlled contents
29667f2df3bSKees Cook	  that will be allocated into the same kmalloc bucket as a
29767f2df3bSKees Cook	  target object. To avoid sharing these allocation buckets,
29867f2df3bSKees Cook	  provide an explicitly separated set of buckets to be used for
29967f2df3bSKees Cook	  user-controlled allocations. This may very slightly increase
30067f2df3bSKees Cook	  memory fragmentation, though in practice it's only a handful
30167f2df3bSKees Cook	  of extra pages since the bulk of user-controlled allocations
30267f2df3bSKees Cook	  are relatively long-lived.
30367f2df3bSKees Cook
30467f2df3bSKees Cook	  If unsure, say Y.
30567f2df3bSKees Cook
3060710d012SVlastimil Babkaconfig SLUB_STATS
3070710d012SVlastimil Babka	default n
3082a19be61SVlastimil Babka	bool "Enable performance statistics"
3092a19be61SVlastimil Babka	depends on SYSFS && !SLUB_TINY
3100710d012SVlastimil Babka	help
3112a19be61SVlastimil Babka	  The statistics are useful to debug slab allocation behavior in
3120710d012SVlastimil Babka	  order find ways to optimize the allocator. This should never be
3130710d012SVlastimil Babka	  enabled for production use since keeping statistics slows down
3140710d012SVlastimil Babka	  the allocator by a few percentage points. The slabinfo command
3150710d012SVlastimil Babka	  supports the determination of the most active slabs to figure
3160710d012SVlastimil Babka	  out which slabs are relevant to a particular load.
3170710d012SVlastimil Babka	  Try running: slabinfo -DA
3180710d012SVlastimil Babka
319519bcb79SJohannes Weinerconfig SLUB_CPU_PARTIAL
320519bcb79SJohannes Weiner	default y
3212a19be61SVlastimil Babka	depends on SMP && !SLUB_TINY
3222a19be61SVlastimil Babka	bool "Enable per cpu partial caches"
323519bcb79SJohannes Weiner	help
324519bcb79SJohannes Weiner	  Per cpu partial caches accelerate objects allocation and freeing
325519bcb79SJohannes Weiner	  that is local to a processor at the price of more indeterminism
326519bcb79SJohannes Weiner	  in the latency of the free. On overflow these caches will be cleared
327519bcb79SJohannes Weiner	  which requires the taking of locks that may cause latency spikes.
328519bcb79SJohannes Weiner	  Typically one would choose no for a realtime system.
329519bcb79SJohannes Weiner
3303c615294SGONG, Ruiqiconfig RANDOM_KMALLOC_CACHES
3313c615294SGONG, Ruiqi	default n
3322a19be61SVlastimil Babka	depends on !SLUB_TINY
3333c615294SGONG, Ruiqi	bool "Randomize slab caches for normal kmalloc"
3343c615294SGONG, Ruiqi	help
3353c615294SGONG, Ruiqi	  A hardening feature that creates multiple copies of slab caches for
3363c615294SGONG, Ruiqi	  normal kmalloc allocation and makes kmalloc randomly pick one based
3373c615294SGONG, Ruiqi	  on code address, which makes the attackers more difficult to spray
3383c615294SGONG, Ruiqi	  vulnerable memory objects on the heap for the purpose of exploiting
3393c615294SGONG, Ruiqi	  memory vulnerabilities.
3403c615294SGONG, Ruiqi
3413c615294SGONG, Ruiqi	  Currently the number of copies is set to 16, a reasonably large value
3423c615294SGONG, Ruiqi	  that effectively diverges the memory objects allocated for different
3433c615294SGONG, Ruiqi	  subsystems or modules into different caches, at the expense of a
3443c615294SGONG, Ruiqi	  limited degree of memory and CPU overhead that relates to hardware and
3453c615294SGONG, Ruiqi	  system workload.
3463c615294SGONG, Ruiqi
3472a19be61SVlastimil Babkaendmenu # Slab allocator options
348519bcb79SJohannes Weiner
3497b42f104SJohannes Weinerconfig SHUFFLE_PAGE_ALLOCATOR
3507b42f104SJohannes Weiner	bool "Page allocator randomization"
3517b42f104SJohannes Weiner	default SLAB_FREELIST_RANDOM && ACPI_NUMA
3527b42f104SJohannes Weiner	help
3537b42f104SJohannes Weiner	  Randomization of the page allocator improves the average
3547b42f104SJohannes Weiner	  utilization of a direct-mapped memory-side-cache. See section
3557b42f104SJohannes Weiner	  5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
3567b42f104SJohannes Weiner	  6.2a specification for an example of how a platform advertises
3577b42f104SJohannes Weiner	  the presence of a memory-side-cache. There are also incidental
3587b42f104SJohannes Weiner	  security benefits as it reduces the predictability of page
3597b42f104SJohannes Weiner	  allocations to compliment SLAB_FREELIST_RANDOM, but the
3605e0a760bSKirill A. Shutemov	  default granularity of shuffling on the MAX_PAGE_ORDER i.e, 10th
36123baf831SKirill A. Shutemov	  order of pages is selected based on cache utilization benefits
36223baf831SKirill A. Shutemov	  on x86.
3637b42f104SJohannes Weiner
3647b42f104SJohannes Weiner	  While the randomization improves cache utilization it may
3657b42f104SJohannes Weiner	  negatively impact workloads on platforms without a cache. For
366b413f9cdSMaíra Canal	  this reason, by default, the randomization is not enabled even
367b413f9cdSMaíra Canal	  if SHUFFLE_PAGE_ALLOCATOR=y. The randomization may be force enabled
368b413f9cdSMaíra Canal	  with the 'page_alloc.shuffle' kernel command line parameter.
3697b42f104SJohannes Weiner
3707b42f104SJohannes Weiner	  Say Y if unsure.
3717b42f104SJohannes Weiner
3720710d012SVlastimil Babkaconfig COMPAT_BRK
3730710d012SVlastimil Babka	bool "Disable heap randomization"
3740710d012SVlastimil Babka	default y
3750710d012SVlastimil Babka	help
3760710d012SVlastimil Babka	  Randomizing heap placement makes heap exploits harder, but it
3770710d012SVlastimil Babka	  also breaks ancient binaries (including anything libc5 based).
3780710d012SVlastimil Babka	  This option changes the bootup default to heap randomization
3790710d012SVlastimil Babka	  disabled, and can be overridden at runtime by setting
3800710d012SVlastimil Babka	  /proc/sys/kernel/randomize_va_space to 2.
3810710d012SVlastimil Babka
3820710d012SVlastimil Babka	  On non-ancient distros (post-2000 ones) N is usually a safe choice.
3830710d012SVlastimil Babka
3840710d012SVlastimil Babkaconfig MMAP_ALLOW_UNINITIALIZED
3850710d012SVlastimil Babka	bool "Allow mmapped anonymous memory to be uninitialized"
3860710d012SVlastimil Babka	depends on EXPERT && !MMU
3870710d012SVlastimil Babka	default n
3880710d012SVlastimil Babka	help
3890710d012SVlastimil Babka	  Normally, and according to the Linux spec, anonymous memory obtained
3900710d012SVlastimil Babka	  from mmap() has its contents cleared before it is passed to
3910710d012SVlastimil Babka	  userspace.  Enabling this config option allows you to request that
3920710d012SVlastimil Babka	  mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
3930710d012SVlastimil Babka	  providing a huge performance boost.  If this option is not enabled,
3940710d012SVlastimil Babka	  then the flag will be ignored.
3950710d012SVlastimil Babka
3960710d012SVlastimil Babka	  This is taken advantage of by uClibc's malloc(), and also by
3970710d012SVlastimil Babka	  ELF-FDPIC binfmt's brk and stack allocator.
3980710d012SVlastimil Babka
3990710d012SVlastimil Babka	  Because of the obvious security issues, this option should only be
4000710d012SVlastimil Babka	  enabled on embedded devices where you control what is run in
4010710d012SVlastimil Babka	  userspace.  Since that isn't generally a problem on no-MMU systems,
4020710d012SVlastimil Babka	  it is normally safe to say Y here.
4030710d012SVlastimil Babka
4040710d012SVlastimil Babka	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
4050710d012SVlastimil Babka
406e1785e85SDave Hansenconfig SELECT_MEMORY_MODEL
407e1785e85SDave Hansen	def_bool y
408a8826eebSKees Cook	depends on ARCH_SELECT_MEMORY_MODEL
409e1785e85SDave Hansen
4103a9da765SDave Hansenchoice
4113a9da765SDave Hansen	prompt "Memory model"
412e1785e85SDave Hansen	depends on SELECT_MEMORY_MODEL
413d41dee36SAndy Whitcroft	default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
414e1785e85SDave Hansen	default FLATMEM_MANUAL
415d66d109dSMike Rapoport	help
416d66d109dSMike Rapoport	  This option allows you to change some of the ways that
417d66d109dSMike Rapoport	  Linux manages its memory internally. Most users will
418d66d109dSMike Rapoport	  only have one option here selected by the architecture
419d66d109dSMike Rapoport	  configuration. This is normal.
4203a9da765SDave Hansen
421e1785e85SDave Hansenconfig FLATMEM_MANUAL
4223a9da765SDave Hansen	bool "Flat Memory"
423bb1c50d3SMike Rapoport	depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
4243a9da765SDave Hansen	help
425d66d109dSMike Rapoport	  This option is best suited for non-NUMA systems with
426d66d109dSMike Rapoport	  flat address space. The FLATMEM is the most efficient
427d66d109dSMike Rapoport	  system in terms of performance and resource consumption
428d66d109dSMike Rapoport	  and it is the best option for smaller systems.
4293a9da765SDave Hansen
430d66d109dSMike Rapoport	  For systems that have holes in their physical address
431d66d109dSMike Rapoport	  spaces and for features like NUMA and memory hotplug,
432dd33d29aSRandy Dunlap	  choose "Sparse Memory".
433d41dee36SAndy Whitcroft
434d41dee36SAndy Whitcroft	  If unsure, choose this option (Flat Memory) over any other.
4353a9da765SDave Hansen
436d41dee36SAndy Whitcroftconfig SPARSEMEM_MANUAL
437d41dee36SAndy Whitcroft	bool "Sparse Memory"
438d41dee36SAndy Whitcroft	depends on ARCH_SPARSEMEM_ENABLE
439d41dee36SAndy Whitcroft	help
440d41dee36SAndy Whitcroft	  This will be the only option for some systems, including
441d66d109dSMike Rapoport	  memory hot-plug systems.  This is normal.
442d41dee36SAndy Whitcroft
443d66d109dSMike Rapoport	  This option provides efficient support for systems with
444d66d109dSMike Rapoport	  holes is their physical address space and allows memory
445d66d109dSMike Rapoport	  hot-plug and hot-remove.
446d41dee36SAndy Whitcroft
447d66d109dSMike Rapoport	  If unsure, choose "Flat Memory" over this option.
448d41dee36SAndy Whitcroft
4493a9da765SDave Hansenendchoice
4503a9da765SDave Hansen
451d41dee36SAndy Whitcroftconfig SPARSEMEM
452d41dee36SAndy Whitcroft	def_bool y
4531a83e175SRussell King	depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
454d41dee36SAndy Whitcroft
455e1785e85SDave Hansenconfig FLATMEM
456e1785e85SDave Hansen	def_bool y
457bb1c50d3SMike Rapoport	depends on !SPARSEMEM || FLATMEM_MANUAL
458d41dee36SAndy Whitcroft
45993b7504eSDave Hansen#
4603e347261SBob Picco# SPARSEMEM_EXTREME (which is the default) does some bootmem
461c89ab04fSMike Rapoport# allocations when sparse_init() is called.  If this cannot
4623e347261SBob Picco# be done on your architecture, select this option.  However,
4633e347261SBob Picco# statically allocating the mem_section[] array can potentially
4643e347261SBob Picco# consume vast quantities of .bss, so be careful.
4653e347261SBob Picco#
4663e347261SBob Picco# This option will also potentially produce smaller runtime code
4673e347261SBob Picco# with gcc 3.4 and later.
4683e347261SBob Picco#
4693e347261SBob Piccoconfig SPARSEMEM_STATIC
4709ba16087SJan Beulich	bool
4713e347261SBob Picco
4723e347261SBob Picco#
47344c09201SMatt LaPlante# Architecture platforms which require a two level mem_section in SPARSEMEM
474802f192eSBob Picco# must select this option. This is usually for architecture platforms with
475802f192eSBob Picco# an extremely sparse physical address space.
476802f192eSBob Picco#
4773e347261SBob Piccoconfig SPARSEMEM_EXTREME
4783e347261SBob Picco	def_bool y
4793e347261SBob Picco	depends on SPARSEMEM && !SPARSEMEM_STATIC
4804c21e2f2SHugh Dickins
48129c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP_ENABLE
4829ba16087SJan Beulich	bool
48329c71111SAndy Whitcroft
48429c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP
485a5ee6daaSGeoff Levand	bool "Sparse Memory virtual memmap"
486a5ee6daaSGeoff Levand	depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
487a5ee6daaSGeoff Levand	default y
488a5ee6daaSGeoff Levand	help
489a5ee6daaSGeoff Levand	  SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
490a5ee6daaSGeoff Levand	  pfn_to_page and page_to_pfn operations.  This is the most
491a5ee6daaSGeoff Levand	  efficient option when sufficient kernel resources are available.
4920b376f1eSAneesh Kumar K.V#
4930b376f1eSAneesh Kumar K.V# Select this config option from the architecture Kconfig, if it is preferred
4940b376f1eSAneesh Kumar K.V# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
4950b376f1eSAneesh Kumar K.V#
4960b6f1582SAneesh Kumar K.Vconfig ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
4970b6f1582SAneesh Kumar K.V	bool
4980b6f1582SAneesh Kumar K.V
4990b6f1582SAneesh Kumar K.Vconfig ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
5000b376f1eSAneesh Kumar K.V	bool
50129c71111SAndy Whitcroft
50270210ed9SPhilipp Hachtmannconfig HAVE_MEMBLOCK_PHYS_MAP
5036341e62bSChristoph Jaeger	bool
50470210ed9SPhilipp Hachtmann
50525176ad0SDavid Hildenbrandconfig HAVE_GUP_FAST
506050a9adcSChristoph Hellwig	depends on MMU
5076341e62bSChristoph Jaeger	bool
5082667f50eSSteve Capper
50952219aeaSDavid Hildenbrand# Don't discard allocated memory used to track "memory" and "reserved" memblocks
51052219aeaSDavid Hildenbrand# after early boot, so it can still be used to test for validity of memory.
51152219aeaSDavid Hildenbrand# Also, memblocks are updated with memory hot(un)plug.
512350e88baSMike Rapoportconfig ARCH_KEEP_MEMBLOCK
5136341e62bSChristoph Jaeger	bool
514c378ddd5STejun Heo
5151e5d8e1eSDan Williams# Keep arch NUMA mapping infrastructure post-init.
5161e5d8e1eSDan Williamsconfig NUMA_KEEP_MEMINFO
5171e5d8e1eSDan Williams	bool
5181e5d8e1eSDan Williams
519ee6f509cSMinchan Kimconfig MEMORY_ISOLATION
5206341e62bSChristoph Jaeger	bool
521ee6f509cSMinchan Kim
522a9e7b8d4SDavid Hildenbrand# IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked
523a9e7b8d4SDavid Hildenbrand# IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via
524a9e7b8d4SDavid Hildenbrand# /dev/mem.
525a9e7b8d4SDavid Hildenbrandconfig EXCLUSIVE_SYSTEM_RAM
526a9e7b8d4SDavid Hildenbrand	def_bool y
527a9e7b8d4SDavid Hildenbrand	depends on !DEVMEM || STRICT_DEVMEM
528a9e7b8d4SDavid Hildenbrand
52946723bfaSYasuaki Ishimatsu#
53046723bfaSYasuaki Ishimatsu# Only be set on architectures that have completely implemented memory hotplug
53146723bfaSYasuaki Ishimatsu# feature. If you are not sure, don't touch it.
53246723bfaSYasuaki Ishimatsu#
53346723bfaSYasuaki Ishimatsuconfig HAVE_BOOTMEM_INFO_NODE
53446723bfaSYasuaki Ishimatsu	def_bool n
53546723bfaSYasuaki Ishimatsu
53691024b3cSAnshuman Khandualconfig ARCH_ENABLE_MEMORY_HOTPLUG
53791024b3cSAnshuman Khandual	bool
53891024b3cSAnshuman Khandual
539519bcb79SJohannes Weinerconfig ARCH_ENABLE_MEMORY_HOTREMOVE
540519bcb79SJohannes Weiner	bool
541519bcb79SJohannes Weiner
5423947be19SDave Hansen# eventually, we can have this option just 'select SPARSEMEM'
543519bcb79SJohannes Weinermenuconfig MEMORY_HOTPLUG
544519bcb79SJohannes Weiner	bool "Memory hotplug"
545b30c5927SDavid Hildenbrand	select MEMORY_ISOLATION
54671b6f2ddSDavid Hildenbrand	depends on SPARSEMEM
54740b31360SStephen Rothwell	depends on ARCH_ENABLE_MEMORY_HOTPLUG
5487ec58a2bSDavid Hildenbrand	depends on 64BIT
5491e5d8e1eSDan Williams	select NUMA_KEEP_MEMINFO if NUMA
5503947be19SDave Hansen
551519bcb79SJohannes Weinerif MEMORY_HOTPLUG
552519bcb79SJohannes Weiner
553*44d46b76SGregory Pricechoice
554*44d46b76SGregory Price	prompt "Memory Hotplug Default Online Type"
555*44d46b76SGregory Price	default MHP_DEFAULT_ONLINE_TYPE_OFFLINE
5568604d9e5SVitaly Kuznetsov	help
557*44d46b76SGregory Price	  Default memory type for hotplugged memory.
558*44d46b76SGregory Price
5598604d9e5SVitaly Kuznetsov	  This option sets the default policy setting for memory hotplug
5608604d9e5SVitaly Kuznetsov	  onlining policy (/sys/devices/system/memory/auto_online_blocks) which
5618604d9e5SVitaly Kuznetsov	  determines what happens to newly added memory regions. Policy setting
5628604d9e5SVitaly Kuznetsov	  can always be changed at runtime.
563*44d46b76SGregory Price
564*44d46b76SGregory Price	  The default is 'offline'.
565*44d46b76SGregory Price
566*44d46b76SGregory Price	  Select offline to defer onlining to drivers and user policy.
567*44d46b76SGregory Price	  Select auto to let the kernel choose what zones to utilize.
568*44d46b76SGregory Price	  Select online_kernel to generally allow kernel usage of this memory.
569*44d46b76SGregory Price	  Select online_movable to generally disallow kernel usage of this memory.
570*44d46b76SGregory Price
571*44d46b76SGregory Price	  Example kernel usage would be page structs and page tables.
572*44d46b76SGregory Price
573cb1aaebeSMauro Carvalho Chehab	  See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
5748604d9e5SVitaly Kuznetsov
575*44d46b76SGregory Priceconfig MHP_DEFAULT_ONLINE_TYPE_OFFLINE
576*44d46b76SGregory Price	bool "offline"
577*44d46b76SGregory Price	help
578*44d46b76SGregory Price	  Hotplugged memory will not be onlined by default.
579*44d46b76SGregory Price	  Choose this for systems with drivers and user policy that
580*44d46b76SGregory Price	  handle onlining of hotplug memory policy.
581*44d46b76SGregory Price
582*44d46b76SGregory Priceconfig MHP_DEFAULT_ONLINE_TYPE_ONLINE_AUTO
583*44d46b76SGregory Price	bool "auto"
584*44d46b76SGregory Price	help
585*44d46b76SGregory Price	  Select this if you want the kernel to automatically online
586*44d46b76SGregory Price	  hotplugged memory into the zone it thinks is reasonable.
587*44d46b76SGregory Price	  This memory may be utilized for kernel data.
588*44d46b76SGregory Price
589*44d46b76SGregory Priceconfig MHP_DEFAULT_ONLINE_TYPE_ONLINE_KERNEL
590*44d46b76SGregory Price	bool "kernel"
591*44d46b76SGregory Price	help
592*44d46b76SGregory Price	  Select this if you want the kernel to automatically online
593*44d46b76SGregory Price	  hotplugged memory into a zone capable of being used for kernel
594*44d46b76SGregory Price	  data. This typically means ZONE_NORMAL.
595*44d46b76SGregory Price
596*44d46b76SGregory Priceconfig MHP_DEFAULT_ONLINE_TYPE_ONLINE_MOVABLE
597*44d46b76SGregory Price	bool "movable"
598*44d46b76SGregory Price	help
599*44d46b76SGregory Price	  Select this if you want the kernel to automatically online
600*44d46b76SGregory Price	  hotplug memory into ZONE_MOVABLE. This memory will generally
601*44d46b76SGregory Price	  not be utilized for kernel data.
602*44d46b76SGregory Price
603*44d46b76SGregory Price	  This should only be used when the admin knows sufficient
604*44d46b76SGregory Price	  ZONE_NORMAL memory is available to describe hotplug memory,
605*44d46b76SGregory Price	  otherwise hotplug memory may fail to online. For example,
606*44d46b76SGregory Price	  sufficient kernel-capable memory (ZONE_NORMAL) must be
607*44d46b76SGregory Price	  available to allocate page structs to describe ZONE_MOVABLE.
608*44d46b76SGregory Price
609*44d46b76SGregory Priceendchoice
6108604d9e5SVitaly Kuznetsov
6110c0e6195SKAMEZAWA Hiroyukiconfig MEMORY_HOTREMOVE
6120c0e6195SKAMEZAWA Hiroyuki	bool "Allow for memory hot remove"
613f7e3334aSNathan Fontenot	select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
6140c0e6195SKAMEZAWA Hiroyuki	depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
6150c0e6195SKAMEZAWA Hiroyuki	depends on MIGRATION
6160c0e6195SKAMEZAWA Hiroyuki
617a08a2ae3SOscar Salvadorconfig MHP_MEMMAP_ON_MEMORY
618a08a2ae3SOscar Salvador	def_bool y
619a08a2ae3SOscar Salvador	depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
620a08a2ae3SOscar Salvador	depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
621a08a2ae3SOscar Salvador
622519bcb79SJohannes Weinerendif # MEMORY_HOTPLUG
623519bcb79SJohannes Weiner
62404d5ea46SAneesh Kumar K.Vconfig ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
62504d5ea46SAneesh Kumar K.V       bool
62604d5ea46SAneesh Kumar K.V
6274c21e2f2SHugh Dickins# Heavily threaded applications may benefit from splitting the mm-wide
6284c21e2f2SHugh Dickins# page_table_lock, so that faults on different parts of the user address
6294c21e2f2SHugh Dickins# space can be handled with less contention: split it at this NR_CPUS.
6304c21e2f2SHugh Dickins# Default to 4 for wider testing, though 8 might be more appropriate.
6314c21e2f2SHugh Dickins# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
6327b6ac9dfSHugh Dickins# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
63360bccaa6SWill Deacon# SPARC32 allocates multiple pte tables within a single page, and therefore
63460bccaa6SWill Deacon# a per-page lock leads to problems when multiple tables need to be locked
63560bccaa6SWill Deacon# at the same time (e.g. copy_page_range()).
636a70caa8bSHugh Dickins# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
6374c21e2f2SHugh Dickins#
638394290cbSDavid Hildenbrandconfig SPLIT_PTE_PTLOCKS
639394290cbSDavid Hildenbrand	def_bool y
640394290cbSDavid Hildenbrand	depends on MMU
641a3344078SGuenter Roeck	depends on SMP
642394290cbSDavid Hildenbrand	depends on NR_CPUS >= 4
643394290cbSDavid Hildenbrand	depends on !ARM || CPU_CACHE_VIPT
644394290cbSDavid Hildenbrand	depends on !PARISC || PA20
645394290cbSDavid Hildenbrand	depends on !SPARC32
6467cbe34cfSChristoph Lameter
647e009bb30SKirill A. Shutemovconfig ARCH_ENABLE_SPLIT_PMD_PTLOCK
6486341e62bSChristoph Jaeger	bool
649e009bb30SKirill A. Shutemov
650394290cbSDavid Hildenbrandconfig SPLIT_PMD_PTLOCKS
651394290cbSDavid Hildenbrand	def_bool y
652394290cbSDavid Hildenbrand	depends on SPLIT_PTE_PTLOCKS && ARCH_ENABLE_SPLIT_PMD_PTLOCK
653394290cbSDavid Hildenbrand
6547cbe34cfSChristoph Lameter#
65509316c09SKonstantin Khlebnikov# support for memory balloon
65609316c09SKonstantin Khlebnikovconfig MEMORY_BALLOON
6576341e62bSChristoph Jaeger	bool
65809316c09SKonstantin Khlebnikov
65909316c09SKonstantin Khlebnikov#
66018468d93SRafael Aquini# support for memory balloon compaction
66118468d93SRafael Aquiniconfig BALLOON_COMPACTION
66218468d93SRafael Aquini	bool "Allow for balloon memory compaction/migration"
663cd14b018SMasahiro Yamada	default y
66409316c09SKonstantin Khlebnikov	depends on COMPACTION && MEMORY_BALLOON
66518468d93SRafael Aquini	help
66618468d93SRafael Aquini	  Memory fragmentation introduced by ballooning might reduce
66718468d93SRafael Aquini	  significantly the number of 2MB contiguous memory blocks that can be
66818468d93SRafael Aquini	  used within a guest, thus imposing performance penalties associated
66918468d93SRafael Aquini	  with the reduced number of transparent huge pages that could be used
67018468d93SRafael Aquini	  by the guest workload. Allowing the compaction & migration for memory
67118468d93SRafael Aquini	  pages enlisted as being part of memory balloon devices avoids the
67218468d93SRafael Aquini	  scenario aforementioned and helps improving memory defragmentation.
67318468d93SRafael Aquini
67418468d93SRafael Aquini#
675e9e96b39SMel Gorman# support for memory compaction
676e9e96b39SMel Gormanconfig COMPACTION
677e9e96b39SMel Gorman	bool "Allow for memory compaction"
678cd14b018SMasahiro Yamada	default y
679e9e96b39SMel Gorman	select MIGRATION
68033a93877SAndrea Arcangeli	depends on MMU
681e9e96b39SMel Gorman	help
682b32eaf71SMichal Hocko	  Compaction is the only memory management component to form
683b32eaf71SMichal Hocko	  high order (larger physically contiguous) memory blocks
684b32eaf71SMichal Hocko	  reliably. The page allocator relies on compaction heavily and
685b32eaf71SMichal Hocko	  the lack of the feature can lead to unexpected OOM killer
686b32eaf71SMichal Hocko	  invocations for high order memory requests. You shouldn't
687b32eaf71SMichal Hocko	  disable this option unless there really is a strong reason for
688b32eaf71SMichal Hocko	  it and then we would be really interested to hear about that at
689b32eaf71SMichal Hocko	  linux-mm@kvack.org.
690e9e96b39SMel Gorman
691c7e0b3d0SThomas Gleixnerconfig COMPACT_UNEVICTABLE_DEFAULT
692c7e0b3d0SThomas Gleixner	int
693c7e0b3d0SThomas Gleixner	depends on COMPACTION
694c7e0b3d0SThomas Gleixner	default 0 if PREEMPT_RT
695c7e0b3d0SThomas Gleixner	default 1
696c7e0b3d0SThomas Gleixner
697e9e96b39SMel Gorman#
69836e66c55SAlexander Duyck# support for free page reporting
69936e66c55SAlexander Duyckconfig PAGE_REPORTING
70036e66c55SAlexander Duyck	bool "Free page reporting"
70136e66c55SAlexander Duyck	help
70236e66c55SAlexander Duyck	  Free page reporting allows for the incremental acquisition of
70336e66c55SAlexander Duyck	  free pages from the buddy allocator for the purpose of reporting
70436e66c55SAlexander Duyck	  those pages to another entity, such as a hypervisor, so that the
70536e66c55SAlexander Duyck	  memory can be freed within the host for other uses.
70636e66c55SAlexander Duyck
70736e66c55SAlexander Duyck#
7087cbe34cfSChristoph Lameter# support for page migration
7097cbe34cfSChristoph Lameter#
7107cbe34cfSChristoph Lameterconfig MIGRATION
711b20a3503SChristoph Lameter	bool "Page migration"
712cd14b018SMasahiro Yamada	default y
713de32a817SChen Gang	depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
714b20a3503SChristoph Lameter	help
715b20a3503SChristoph Lameter	  Allows the migration of the physical location of pages of processes
716e9e96b39SMel Gorman	  while the virtual addresses are not changed. This is useful in
717e9e96b39SMel Gorman	  two situations. The first is on NUMA systems to put pages nearer
718e9e96b39SMel Gorman	  to the processors accessing. The second is when allocating huge
719e9e96b39SMel Gorman	  pages as migration can relocate pages to satisfy a huge page
720e9e96b39SMel Gorman	  allocation instead of reclaiming.
7216550e07fSGreg Kroah-Hartman
72276cbbeadSChristoph Hellwigconfig DEVICE_MIGRATION
723d90a25f8SChristoph Hellwig	def_bool MIGRATION && ZONE_DEVICE
72476cbbeadSChristoph Hellwig
725c177c81eSNaoya Horiguchiconfig ARCH_ENABLE_HUGEPAGE_MIGRATION
7266341e62bSChristoph Jaeger	bool
727c177c81eSNaoya Horiguchi
7289c670ea3SNaoya Horiguchiconfig ARCH_ENABLE_THP_MIGRATION
7299c670ea3SNaoya Horiguchi	bool
7309c670ea3SNaoya Horiguchi
7314bfb68a0SAnshuman Khandualconfig HUGETLB_PAGE_SIZE_VARIABLE
7324bfb68a0SAnshuman Khandual	def_bool n
7334bfb68a0SAnshuman Khandual	help
7344bfb68a0SAnshuman Khandual	  Allows the pageblock_order value to be dynamic instead of just standard
7354bfb68a0SAnshuman Khandual	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
7364bfb68a0SAnshuman Khandual	  on a platform.
7374bfb68a0SAnshuman Khandual
7385e0a760bSKirill A. Shutemov	  Note that the pageblock_order cannot exceed MAX_PAGE_ORDER and will be
7395e0a760bSKirill A. Shutemov	  clamped down to MAX_PAGE_ORDER.
740b3d40a2bSDavid Hildenbrand
7418df995f6SAlexandre Ghiticonfig CONTIG_ALLOC
7428df995f6SAlexandre Ghiti	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
7438df995f6SAlexandre Ghiti
74452166607SHuang Yingconfig PCP_BATCH_SCALE_MAX
74552166607SHuang Ying	int "Maximum scale factor of PCP (Per-CPU pageset) batch allocate/free"
74652166607SHuang Ying	default 5
74752166607SHuang Ying	range 0 6
74852166607SHuang Ying	help
74952166607SHuang Ying	  In page allocator, PCP (Per-CPU pageset) is refilled and drained in
75052166607SHuang Ying	  batches.  The batch number is scaled automatically to improve page
75152166607SHuang Ying	  allocation/free throughput.  But too large scale factor may hurt
75252166607SHuang Ying	  latency.  This option sets the upper limit of scale factor to limit
75352166607SHuang Ying	  the maximum latency.
75452166607SHuang Ying
755600715dcSJeremy Fitzhardingeconfig PHYS_ADDR_T_64BIT
756d4a451d5SChristoph Hellwig	def_bool 64BIT
757600715dcSJeremy Fitzhardinge
7582a7326b5SChristoph Lameterconfig BOUNCE
7599ca24e2eSVinayak Menon	bool "Enable bounce buffers"
7609ca24e2eSVinayak Menon	default y
761ce288e05SChristoph Hellwig	depends on BLOCK && MMU && HIGHMEM
7629ca24e2eSVinayak Menon	help
763ce288e05SChristoph Hellwig	  Enable bounce buffers for devices that cannot access the full range of
764ce288e05SChristoph Hellwig	  memory available to the CPU. Enabled by default when HIGHMEM is
765ce288e05SChristoph Hellwig	  selected, but you may say n to override this.
7662a7326b5SChristoph Lameter
767cddb8a5cSAndrea Arcangeliconfig MMU_NOTIFIER
768cddb8a5cSAndrea Arcangeli	bool
76999cb252fSJason Gunthorpe	select INTERVAL_TREE
770fc4d5c29SDavid Howells
771f8af4da3SHugh Dickinsconfig KSM
772f8af4da3SHugh Dickins	bool "Enable KSM for page merging"
773f8af4da3SHugh Dickins	depends on MMU
77459e1a2f4STimofey Titovets	select XXHASH
775f8af4da3SHugh Dickins	help
776f8af4da3SHugh Dickins	  Enable Kernel Samepage Merging: KSM periodically scans those areas
777f8af4da3SHugh Dickins	  of an application's address space that an app has advised may be
778f8af4da3SHugh Dickins	  mergeable.  When it finds pages of identical content, it replaces
779d0f209f6SHugh Dickins	  the many instances by a single page with that content, so
780f8af4da3SHugh Dickins	  saving memory until one or another app needs to modify the content.
781f8af4da3SHugh Dickins	  Recommended for use with KVM, or with other duplicative applications.
782ee65728eSMike Rapoport	  See Documentation/mm/ksm.rst for more information: KSM is inactive
783c73602adSHugh Dickins	  until a program has madvised that an area is MADV_MERGEABLE, and
784c73602adSHugh Dickins	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
785f8af4da3SHugh Dickins
786e0a94c2aSChristoph Lameterconfig DEFAULT_MMAP_MIN_ADDR
787e0a94c2aSChristoph Lameter	int "Low address space to protect from user allocation"
7886e141546SDavid Howells	depends on MMU
789e0a94c2aSChristoph Lameter	default 4096
790e0a94c2aSChristoph Lameter	help
791e0a94c2aSChristoph Lameter	  This is the portion of low virtual memory which should be protected
792e0a94c2aSChristoph Lameter	  from userspace allocation.  Keeping a user from writing to low pages
793e0a94c2aSChristoph Lameter	  can help reduce the impact of kernel NULL pointer bugs.
794e0a94c2aSChristoph Lameter
79534f7c528SJavier Martinez Canillas	  For most arm64, ppc64 and x86 users with lots of address space
796e0a94c2aSChristoph Lameter	  a value of 65536 is reasonable and should cause no problems.
797e0a94c2aSChristoph Lameter	  On arm and other archs it should not be higher than 32768.
798788084abSEric Paris	  Programs which use vm86 functionality or have some need to map
799788084abSEric Paris	  this low address space will need CAP_SYS_RAWIO or disable this
800788084abSEric Paris	  protection by setting the value to 0.
801e0a94c2aSChristoph Lameter
802e0a94c2aSChristoph Lameter	  This value can be changed after boot using the
803e0a94c2aSChristoph Lameter	  /proc/sys/vm/mmap_min_addr tunable.
804e0a94c2aSChristoph Lameter
805d949f36fSLinus Torvaldsconfig ARCH_SUPPORTS_MEMORY_FAILURE
806d949f36fSLinus Torvalds	bool
807e0a94c2aSChristoph Lameter
8086a46079cSAndi Kleenconfig MEMORY_FAILURE
8096a46079cSAndi Kleen	depends on MMU
810d949f36fSLinus Torvalds	depends on ARCH_SUPPORTS_MEMORY_FAILURE
8116a46079cSAndi Kleen	bool "Enable recovery from hardware memory errors"
812ee6f509cSMinchan Kim	select MEMORY_ISOLATION
81397f0b134SXie XiuQi	select RAS
8146a46079cSAndi Kleen	help
8156a46079cSAndi Kleen	  Enables code to recover from some memory failures on systems
8166a46079cSAndi Kleen	  with MCA recovery. This allows a system to continue running
8176a46079cSAndi Kleen	  even when some of its memory has uncorrected errors. This requires
8186a46079cSAndi Kleen	  special hardware support and typically ECC memory.
8196a46079cSAndi Kleen
820cae681fcSAndi Kleenconfig HWPOISON_INJECT
821413f9efbSAndi Kleen	tristate "HWPoison pages injector"
82227df5068SAndi Kleen	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
823478c5ffcSWu Fengguang	select PROC_PAGE_MONITOR
824cae681fcSAndi Kleen
825fc4d5c29SDavid Howellsconfig NOMMU_INITIAL_TRIM_EXCESS
826fc4d5c29SDavid Howells	int "Turn on mmap() excess space trimming before booting"
827fc4d5c29SDavid Howells	depends on !MMU
828fc4d5c29SDavid Howells	default 1
829fc4d5c29SDavid Howells	help
830fc4d5c29SDavid Howells	  The NOMMU mmap() frequently needs to allocate large contiguous chunks
831fc4d5c29SDavid Howells	  of memory on which to store mappings, but it can only ask the system
832fc4d5c29SDavid Howells	  allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
833fc4d5c29SDavid Howells	  more than it requires.  To deal with this, mmap() is able to trim off
834fc4d5c29SDavid Howells	  the excess and return it to the allocator.
835fc4d5c29SDavid Howells
836fc4d5c29SDavid Howells	  If trimming is enabled, the excess is trimmed off and returned to the
837fc4d5c29SDavid Howells	  system allocator, which can cause extra fragmentation, particularly
838fc4d5c29SDavid Howells	  if there are a lot of transient processes.
839fc4d5c29SDavid Howells
840fc4d5c29SDavid Howells	  If trimming is disabled, the excess is kept, but not used, which for
841fc4d5c29SDavid Howells	  long-term mappings means that the space is wasted.
842fc4d5c29SDavid Howells
843fc4d5c29SDavid Howells	  Trimming can be dynamically controlled through a sysctl option
844fc4d5c29SDavid Howells	  (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
845fc4d5c29SDavid Howells	  excess pages there must be before trimming should occur, or zero if
846fc4d5c29SDavid Howells	  no trimming is to occur.
847fc4d5c29SDavid Howells
848fc4d5c29SDavid Howells	  This option specifies the initial value of this option.  The default
849fc4d5c29SDavid Howells	  of 1 says that all excess pages should be trimmed.
850fc4d5c29SDavid Howells
851dd19d293SStephen Kitt	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
852bbddff05STejun Heo
853519bcb79SJohannes Weinerconfig ARCH_WANT_GENERAL_HUGETLB
854519bcb79SJohannes Weiner	bool
855519bcb79SJohannes Weiner
856519bcb79SJohannes Weinerconfig ARCH_WANTS_THP_SWAP
857519bcb79SJohannes Weiner	def_bool n
858519bcb79SJohannes Weiner
859519bcb79SJohannes Weinermenuconfig TRANSPARENT_HUGEPAGE
86013ece886SAndrea Arcangeli	bool "Transparent Hugepage Support"
861554b0f3cSSebastian Andrzej Siewior	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
8625d689240SAndrea Arcangeli	select COMPACTION
8633a08cd52SMatthew Wilcox	select XARRAY_MULTI
8644c76d9d1SAndrea Arcangeli	help
8654c76d9d1SAndrea Arcangeli	  Transparent Hugepages allows the kernel to use huge pages and
8664c76d9d1SAndrea Arcangeli	  huge tlb transparently to the applications whenever possible.
8674c76d9d1SAndrea Arcangeli	  This feature can improve computing performance to certain
8684c76d9d1SAndrea Arcangeli	  applications by speeding up page faults during memory
8694c76d9d1SAndrea Arcangeli	  allocation, by reducing the number of tlb misses and by speeding
8704c76d9d1SAndrea Arcangeli	  up the pagetable walking.
8714c76d9d1SAndrea Arcangeli
8724c76d9d1SAndrea Arcangeli	  If memory constrained on embedded, you may want to say N.
8734c76d9d1SAndrea Arcangeli
874519bcb79SJohannes Weinerif TRANSPARENT_HUGEPAGE
875519bcb79SJohannes Weiner
87613ece886SAndrea Arcangelichoice
87713ece886SAndrea Arcangeli	prompt "Transparent Hugepage Support sysfs defaults"
87813ece886SAndrea Arcangeli	depends on TRANSPARENT_HUGEPAGE
87913ece886SAndrea Arcangeli	default TRANSPARENT_HUGEPAGE_ALWAYS
88013ece886SAndrea Arcangeli	help
88113ece886SAndrea Arcangeli	  Selects the sysfs defaults for Transparent Hugepage Support.
88213ece886SAndrea Arcangeli
88313ece886SAndrea Arcangeli	config TRANSPARENT_HUGEPAGE_ALWAYS
88413ece886SAndrea Arcangeli		bool "always"
88513ece886SAndrea Arcangeli	help
88613ece886SAndrea Arcangeli	  Enabling Transparent Hugepage always, can increase the
88713ece886SAndrea Arcangeli	  memory footprint of applications without a guaranteed
88813ece886SAndrea Arcangeli	  benefit but it will work automatically for all applications.
88913ece886SAndrea Arcangeli
89013ece886SAndrea Arcangeli	config TRANSPARENT_HUGEPAGE_MADVISE
89113ece886SAndrea Arcangeli		bool "madvise"
89213ece886SAndrea Arcangeli	help
89313ece886SAndrea Arcangeli	  Enabling Transparent Hugepage madvise, will only provide a
89413ece886SAndrea Arcangeli	  performance improvement benefit to the applications using
89513ece886SAndrea Arcangeli	  madvise(MADV_HUGEPAGE) but it won't risk to increase the
89613ece886SAndrea Arcangeli	  memory footprint of applications without a guaranteed
89713ece886SAndrea Arcangeli	  benefit.
898683ec99fSDmytro Maluka
899683ec99fSDmytro Maluka	config TRANSPARENT_HUGEPAGE_NEVER
900683ec99fSDmytro Maluka		bool "never"
901683ec99fSDmytro Maluka	help
902683ec99fSDmytro Maluka	  Disable Transparent Hugepage by default. It can still be
903683ec99fSDmytro Maluka	  enabled at runtime via sysfs.
90413ece886SAndrea Arcangeliendchoice
90513ece886SAndrea Arcangeli
90638d8b4e6SHuang Yingconfig THP_SWAP
90738d8b4e6SHuang Ying	def_bool y
908dad6a5ebSHugh Dickins	depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT
90938d8b4e6SHuang Ying	help
91038d8b4e6SHuang Ying	  Swap transparent huge pages in one piece, without splitting.
91114fef284SHuang Ying	  XXX: For now, swap cluster backing transparent huge page
91214fef284SHuang Ying	  will be split after swapout.
91338d8b4e6SHuang Ying
91438d8b4e6SHuang Ying	  For selection by architectures with reasonable THP sizes.
91538d8b4e6SHuang Ying
916519bcb79SJohannes Weinerconfig READ_ONLY_THP_FOR_FS
917519bcb79SJohannes Weiner	bool "Read-only THP for filesystems (EXPERIMENTAL)"
918519bcb79SJohannes Weiner	depends on TRANSPARENT_HUGEPAGE && SHMEM
919519bcb79SJohannes Weiner
920519bcb79SJohannes Weiner	help
921519bcb79SJohannes Weiner	  Allow khugepaged to put read-only file-backed pages in THP.
922519bcb79SJohannes Weiner
923519bcb79SJohannes Weiner	  This is marked experimental because it is a new feature. Write
924519bcb79SJohannes Weiner	  support of file THPs will be developed in the next few release
925519bcb79SJohannes Weiner	  cycles.
926519bcb79SJohannes Weiner
927519bcb79SJohannes Weinerendif # TRANSPARENT_HUGEPAGE
928519bcb79SJohannes Weiner
929e496cf3dSKirill A. Shutemov#
930ac3830c3SPeter Xu# The architecture supports pgtable leaves that is larger than PAGE_SIZE
931ac3830c3SPeter Xu#
932ac3830c3SPeter Xuconfig PGTABLE_HAS_HUGE_LEAVES
933ac3830c3SPeter Xu	def_bool TRANSPARENT_HUGEPAGE || HUGETLB_PAGE
934ac3830c3SPeter Xu
9356857be5fSPeter Xu# TODO: Allow to be enabled without THP
9366857be5fSPeter Xuconfig ARCH_SUPPORTS_HUGE_PFNMAP
9376857be5fSPeter Xu	def_bool n
9386857be5fSPeter Xu	depends on TRANSPARENT_HUGEPAGE
9396857be5fSPeter Xu
9406857be5fSPeter Xuconfig ARCH_SUPPORTS_PMD_PFNMAP
9416857be5fSPeter Xu	def_bool y
9426857be5fSPeter Xu	depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE
9436857be5fSPeter Xu
9446857be5fSPeter Xuconfig ARCH_SUPPORTS_PUD_PFNMAP
9456857be5fSPeter Xu	def_bool y
9466857be5fSPeter Xu	depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
9476857be5fSPeter Xu
948ac3830c3SPeter Xu#
949bbddff05STejun Heo# UP and nommu archs use km based percpu allocator
950bbddff05STejun Heo#
951bbddff05STejun Heoconfig NEED_PER_CPU_KM
9523583521aSVladimir Murzin	depends on !SMP || !MMU
953bbddff05STejun Heo	bool
954bbddff05STejun Heo	default y
955077b1f83SDan Magenheimer
9567ecd19cfSKefeng Wangconfig NEED_PER_CPU_EMBED_FIRST_CHUNK
9577ecd19cfSKefeng Wang	bool
9587ecd19cfSKefeng Wang
9597ecd19cfSKefeng Wangconfig NEED_PER_CPU_PAGE_FIRST_CHUNK
9607ecd19cfSKefeng Wang	bool
9617ecd19cfSKefeng Wang
9627ecd19cfSKefeng Wangconfig USE_PERCPU_NUMA_NODE_ID
9637ecd19cfSKefeng Wang	bool
9647ecd19cfSKefeng Wang
9657ecd19cfSKefeng Wangconfig HAVE_SETUP_PER_CPU_AREA
9667ecd19cfSKefeng Wang	bool
9677ecd19cfSKefeng Wang
968f825c736SAneesh Kumar K.Vconfig CMA
969f825c736SAneesh Kumar K.V	bool "Contiguous Memory Allocator"
970aca52c39SMike Rapoport	depends on MMU
971f825c736SAneesh Kumar K.V	select MIGRATION
972f825c736SAneesh Kumar K.V	select MEMORY_ISOLATION
973f825c736SAneesh Kumar K.V	help
974f825c736SAneesh Kumar K.V	  This enables the Contiguous Memory Allocator which allows other
975f825c736SAneesh Kumar K.V	  subsystems to allocate big physically-contiguous blocks of memory.
976f825c736SAneesh Kumar K.V	  CMA reserves a region of memory and allows only movable pages to
977f825c736SAneesh Kumar K.V	  be allocated from it. This way, the kernel can use the memory for
978f825c736SAneesh Kumar K.V	  pagecache and when a subsystem requests for contiguous area, the
979f825c736SAneesh Kumar K.V	  allocated pages are migrated away to serve the contiguous request.
980f825c736SAneesh Kumar K.V
981f825c736SAneesh Kumar K.V	  If unsure, say "n".
982f825c736SAneesh Kumar K.V
98328b24c1fSSasha Levinconfig CMA_DEBUGFS
98428b24c1fSSasha Levin	bool "CMA debugfs interface"
98528b24c1fSSasha Levin	depends on CMA && DEBUG_FS
98628b24c1fSSasha Levin	help
98728b24c1fSSasha Levin	  Turns on the DebugFS interface for CMA.
98828b24c1fSSasha Levin
98943ca106fSMinchan Kimconfig CMA_SYSFS
99043ca106fSMinchan Kim	bool "CMA information through sysfs interface"
99143ca106fSMinchan Kim	depends on CMA && SYSFS
99243ca106fSMinchan Kim	help
99343ca106fSMinchan Kim	  This option exposes some sysfs attributes to get information
99443ca106fSMinchan Kim	  from CMA.
99543ca106fSMinchan Kim
996a254129eSJoonsoo Kimconfig CMA_AREAS
997a254129eSJoonsoo Kim	int "Maximum count of the CMA areas"
998a254129eSJoonsoo Kim	depends on CMA
99973307523SAnshuman Khandual	default 20 if NUMA
100073307523SAnshuman Khandual	default 8
1001a254129eSJoonsoo Kim	help
1002a254129eSJoonsoo Kim	  CMA allows to create CMA areas for particular purpose, mainly,
1003a254129eSJoonsoo Kim	  used as device private area. This parameter sets the maximum
1004a254129eSJoonsoo Kim	  number of CMA area in the system.
1005a254129eSJoonsoo Kim
100673307523SAnshuman Khandual	  If unsure, leave the default value "8" in UMA and "20" in NUMA.
1007a254129eSJoonsoo Kim
1008af8d417aSDan Streetmanconfig MEM_SOFT_DIRTY
1009af8d417aSDan Streetman	bool "Track memory changes"
1010af8d417aSDan Streetman	depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
1011af8d417aSDan Streetman	select PROC_PAGE_MONITOR
10124e2e2770SSeth Jennings	help
1013af8d417aSDan Streetman	  This option enables memory changes tracking by introducing a
1014af8d417aSDan Streetman	  soft-dirty bit on pte-s. This bit it set when someone writes
1015af8d417aSDan Streetman	  into a page just as regular dirty bit, but unlike the latter
1016af8d417aSDan Streetman	  it can be cleared by hands.
1017af8d417aSDan Streetman
10181ad1335dSMike Rapoport	  See Documentation/admin-guide/mm/soft-dirty.rst for more details.
10194e2e2770SSeth Jennings
10209e5c33d7SMark Salterconfig GENERIC_EARLY_IOREMAP
10219e5c33d7SMark Salter	bool
1022042d27acSHelge Deller
102322ee3ea5SHelge Dellerconfig STACK_MAX_DEFAULT_SIZE_MB
102422ee3ea5SHelge Deller	int "Default maximum user stack size for 32-bit processes (MB)"
102522ee3ea5SHelge Deller	default 100
1026042d27acSHelge Deller	range 8 2048
1027042d27acSHelge Deller	depends on STACK_GROWSUP && (!64BIT || COMPAT)
1028042d27acSHelge Deller	help
1029042d27acSHelge Deller	  This is the maximum stack size in Megabytes in the VM layout of 32-bit
1030042d27acSHelge Deller	  user processes when the stack grows upwards (currently only on parisc
103122ee3ea5SHelge Deller	  arch) when the RLIMIT_STACK hard limit is unlimited.
1032042d27acSHelge Deller
103322ee3ea5SHelge Deller	  A sane initial value is 100 MB.
10343a80a7faSMel Gorman
10353a80a7faSMel Gormanconfig DEFERRED_STRUCT_PAGE_INIT
10361ce22103SVlastimil Babka	bool "Defer initialisation of struct pages to kthreads"
1037d39f8fb4SMike Rapoport	depends on SPARSEMEM
1038ab1e8d89SPavel Tatashin	depends on !NEED_PER_CPU_KM
1039889c695dSPasha Tatashin	depends on 64BIT
1040854fa98dSIlya Leoshkevich	depends on !KMSAN
1041e4443149SDaniel Jordan	select PADATA
10423a80a7faSMel Gorman	help
10433a80a7faSMel Gorman	  Ordinarily all struct pages are initialised during early boot in a
10443a80a7faSMel Gorman	  single thread. On very large machines this can take a considerable
10453a80a7faSMel Gorman	  amount of time. If this option is set, large machines will bring up
1046e4443149SDaniel Jordan	  a subset of memmap at boot and then initialise the rest in parallel.
1047e4443149SDaniel Jordan	  This has a potential performance impact on tasks running early in the
10481ce22103SVlastimil Babka	  lifetime of the system until these kthreads finish the
10491ce22103SVlastimil Babka	  initialisation.
1050033fbae9SDan Williams
10511c676e0dSSeongJae Parkconfig PAGE_IDLE_FLAG
10521c676e0dSSeongJae Park	bool
10531c676e0dSSeongJae Park	select PAGE_EXTENSION if !64BIT
10541c676e0dSSeongJae Park	help
10551c676e0dSSeongJae Park	  This adds PG_idle and PG_young flags to 'struct page'.  PTE Accessed
10561c676e0dSSeongJae Park	  bit writers can set the state of the bit in the flags so that PTE
10571c676e0dSSeongJae Park	  Accessed bit readers may avoid disturbance.
10581c676e0dSSeongJae Park
105933c3fc71SVladimir Davydovconfig IDLE_PAGE_TRACKING
106033c3fc71SVladimir Davydov	bool "Enable idle page tracking"
106133c3fc71SVladimir Davydov	depends on SYSFS && MMU
10621c676e0dSSeongJae Park	select PAGE_IDLE_FLAG
106333c3fc71SVladimir Davydov	help
106433c3fc71SVladimir Davydov	  This feature allows to estimate the amount of user pages that have
106533c3fc71SVladimir Davydov	  not been touched during a given period of time. This information can
106633c3fc71SVladimir Davydov	  be useful to tune memory cgroup limits and/or for job placement
106733c3fc71SVladimir Davydov	  within a compute cluster.
106833c3fc71SVladimir Davydov
10691ad1335dSMike Rapoport	  See Documentation/admin-guide/mm/idle_page_tracking.rst for
10701ad1335dSMike Rapoport	  more details.
107133c3fc71SVladimir Davydov
10728690bbcfSMathieu Desnoyers# Architectures which implement cpu_dcache_is_aliasing() to query
10738690bbcfSMathieu Desnoyers# whether the data caches are aliased (VIVT or VIPT with dcache
10748690bbcfSMathieu Desnoyers# aliasing) need to select this.
10758690bbcfSMathieu Desnoyersconfig ARCH_HAS_CPU_CACHE_ALIASING
10768690bbcfSMathieu Desnoyers	bool
10778690bbcfSMathieu Desnoyers
1078c2280be8SAnshuman Khandualconfig ARCH_HAS_CACHE_LINE_SIZE
1079c2280be8SAnshuman Khandual	bool
1080c2280be8SAnshuman Khandual
10812792d84eSKees Cookconfig ARCH_HAS_CURRENT_STACK_POINTER
10822792d84eSKees Cook	bool
10832792d84eSKees Cook	help
10842792d84eSKees Cook	  In support of HARDENED_USERCOPY performing stack variable lifetime
10852792d84eSKees Cook	  checking, an architecture-agnostic way to find the stack pointer
10862792d84eSKees Cook	  is needed. Once an architecture defines an unsigned long global
10872792d84eSKees Cook	  register alias named "current_stack_pointer", this config can be
10882792d84eSKees Cook	  selected.
10892792d84eSKees Cook
109017596731SRobin Murphyconfig ARCH_HAS_PTE_DEVMAP
109165f7d049SOliver O'Halloran	bool
109265f7d049SOliver O'Halloran
109363703f37SKefeng Wangconfig ARCH_HAS_ZONE_DMA_SET
109463703f37SKefeng Wang	bool
109563703f37SKefeng Wang
109663703f37SKefeng Wangconfig ZONE_DMA
109763703f37SKefeng Wang	bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
109863703f37SKefeng Wang	default y if ARM64 || X86
109963703f37SKefeng Wang
110063703f37SKefeng Wangconfig ZONE_DMA32
110163703f37SKefeng Wang	bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
110263703f37SKefeng Wang	depends on !X86_32
110363703f37SKefeng Wang	default y if ARM64
110463703f37SKefeng Wang
1105033fbae9SDan Williamsconfig ZONE_DEVICE
11065042db43SJérôme Glisse	bool "Device memory (pmem, HMM, etc...) hotplug support"
1107033fbae9SDan Williams	depends on MEMORY_HOTPLUG
1108033fbae9SDan Williams	depends on MEMORY_HOTREMOVE
110999490f16SDan Williams	depends on SPARSEMEM_VMEMMAP
111017596731SRobin Murphy	depends on ARCH_HAS_PTE_DEVMAP
11113a08cd52SMatthew Wilcox	select XARRAY_MULTI
1112033fbae9SDan Williams
1113033fbae9SDan Williams	help
1114033fbae9SDan Williams	  Device memory hotplug support allows for establishing pmem,
1115033fbae9SDan Williams	  or other device driver discovered memory regions, in the
1116033fbae9SDan Williams	  memmap. This allows pfn_to_page() lookups of otherwise
1117033fbae9SDan Williams	  "device-physical" addresses which is needed for using a DAX
1118033fbae9SDan Williams	  mapping in an O_DIRECT operation, among other things.
1119033fbae9SDan Williams
1120033fbae9SDan Williams	  If FS_DAX is enabled, then say Y.
112106a660adSLinus Torvalds
11229c240a7bSChristoph Hellwig#
11239c240a7bSChristoph Hellwig# Helpers to mirror range of the CPU page tables of a process into device page
11249c240a7bSChristoph Hellwig# tables.
11259c240a7bSChristoph Hellwig#
1126c0b12405SJérôme Glisseconfig HMM_MIRROR
11279c240a7bSChristoph Hellwig	bool
1128f442c283SChristoph Hellwig	depends on MMU
1129c0b12405SJérôme Glisse
113014b80582SDan Williamsconfig GET_FREE_REGION
113114b80582SDan Williams	bool
113214b80582SDan Williams
11335042db43SJérôme Glisseconfig DEVICE_PRIVATE
11345042db43SJérôme Glisse	bool "Unaddressable device memory (GPU memory, ...)"
11357328d9ccSChristoph Hellwig	depends on ZONE_DEVICE
113614b80582SDan Williams	select GET_FREE_REGION
11375042db43SJérôme Glisse
11385042db43SJérôme Glisse	help
11395042db43SJérôme Glisse	  Allows creation of struct pages to represent unaddressable device
11405042db43SJérôme Glisse	  memory; i.e., memory that is only accessible from the device (or
11415042db43SJérôme Glisse	  group of devices). You likely also want to select HMM_MIRROR.
11425042db43SJérôme Glisse
11433e9a9e25SChristoph Hellwigconfig VMAP_PFN
11443e9a9e25SChristoph Hellwig	bool
11453e9a9e25SChristoph Hellwig
114663c17fb8SDave Hansenconfig ARCH_USES_HIGH_VMA_FLAGS
114763c17fb8SDave Hansen	bool
114866d37570SDave Hansenconfig ARCH_HAS_PKEYS
114966d37570SDave Hansen	bool
115030a5b536SDennis Zhou
11517a87225aSMatthew Wilcox (Oracle)config ARCH_USES_PG_ARCH_2
1152b0284cd2SCatalin Marinas	bool
11537a87225aSMatthew Wilcox (Oracle)config ARCH_USES_PG_ARCH_3
11547a87225aSMatthew Wilcox (Oracle)	bool
1155b0284cd2SCatalin Marinas
11560710d012SVlastimil Babkaconfig VM_EVENT_COUNTERS
11570710d012SVlastimil Babka	default y
11580710d012SVlastimil Babka	bool "Enable VM event counters for /proc/vmstat" if EXPERT
11590710d012SVlastimil Babka	help
11600710d012SVlastimil Babka	  VM event counters are needed for event counts to be shown.
11610710d012SVlastimil Babka	  This option allows the disabling of the VM event counters
11620710d012SVlastimil Babka	  on EXPERT systems.  /proc/vmstat will only show page counts
11630710d012SVlastimil Babka	  if VM event counters are disabled.
11640710d012SVlastimil Babka
116530a5b536SDennis Zhouconfig PERCPU_STATS
116630a5b536SDennis Zhou	bool "Collect percpu memory statistics"
116730a5b536SDennis Zhou	help
116830a5b536SDennis Zhou	  This feature collects and exposes statistics via debugfs. The
116930a5b536SDennis Zhou	  information includes global and per chunk statistics, which can
117030a5b536SDennis Zhou	  be used to help understand percpu memory usage.
117164c349f4SKirill A. Shutemov
11729c84f229SJohn Hubbardconfig GUP_TEST
11739c84f229SJohn Hubbard	bool "Enable infrastructure for get_user_pages()-related unit tests"
1174d0de8241SBarry Song	depends on DEBUG_FS
117564c349f4SKirill A. Shutemov	help
11769c84f229SJohn Hubbard	  Provides /sys/kernel/debug/gup_test, which in turn provides a way
11779c84f229SJohn Hubbard	  to make ioctl calls that can launch kernel-based unit tests for
11789c84f229SJohn Hubbard	  the get_user_pages*() and pin_user_pages*() family of API calls.
117964c349f4SKirill A. Shutemov
11809c84f229SJohn Hubbard	  These tests include benchmark testing of the _fast variants of
11819c84f229SJohn Hubbard	  get_user_pages*() and pin_user_pages*(), as well as smoke tests of
11829c84f229SJohn Hubbard	  the non-_fast variants.
11839c84f229SJohn Hubbard
1184f4f9bda4SJohn Hubbard	  There is also a sub-test that allows running dump_page() on any
1185f4f9bda4SJohn Hubbard	  of up to eight pages (selected by command line args) within the
1186f4f9bda4SJohn Hubbard	  range of user-space addresses. These pages are either pinned via
1187f4f9bda4SJohn Hubbard	  pin_user_pages*(), or pinned via get_user_pages*(), as specified
1188f4f9bda4SJohn Hubbard	  by other command line arguments.
1189f4f9bda4SJohn Hubbard
1190baa489faSSeongJae Park	  See tools/testing/selftests/mm/gup_test.c
11913010a5eaSLaurent Dufour
1192d0de8241SBarry Songcomment "GUP_TEST needs to have DEBUG_FS enabled"
1193d0de8241SBarry Song	depends on !GUP_TEST && !DEBUG_FS
11943010a5eaSLaurent Dufour
11956ca297d4SPeter Zijlstraconfig GUP_GET_PXX_LOW_HIGH
119639656e83SChristoph Hellwig	bool
119739656e83SChristoph Hellwig
1198def85743SKeith Buschconfig DMAPOOL_TEST
1199def85743SKeith Busch	tristate "Enable a module to run time tests on dma_pool"
1200def85743SKeith Busch	depends on HAS_DMA
1201def85743SKeith Busch	help
1202def85743SKeith Busch	  Provides a test module that will allocate and free many blocks of
1203def85743SKeith Busch	  various sizes and report how long it takes. This is intended to
1204def85743SKeith Busch	  provide a consistent way to measure how changes to the
1205def85743SKeith Busch	  dma_pool_alloc/free routines affect performance.
1206def85743SKeith Busch
12073010a5eaSLaurent Dufourconfig ARCH_HAS_PTE_SPECIAL
12083010a5eaSLaurent Dufour	bool
120959e0b520SChristoph Hellwig
1210c5acad84SThomas Hellstromconfig MAPPING_DIRTY_HELPERS
1211c5acad84SThomas Hellstrom        bool
1212c5acad84SThomas Hellstrom
1213298fa1adSThomas Gleixnerconfig KMAP_LOCAL
1214298fa1adSThomas Gleixner	bool
1215298fa1adSThomas Gleixner
1216825c43f5SArd Biesheuvelconfig KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
1217825c43f5SArd Biesheuvel	bool
1218825c43f5SArd Biesheuvel
12191fbaf8fcSChristoph Hellwig# struct io_mapping based helper.  Selected by drivers that need them
12201fbaf8fcSChristoph Hellwigconfig IO_MAPPING
12211fbaf8fcSChristoph Hellwig	bool
12221507f512SMike Rapoport
1223626e98cbSThomas Weißschuhconfig MEMFD_CREATE
1224626e98cbSThomas Weißschuh	bool "Enable memfd_create() system call" if EXPERT
1225626e98cbSThomas Weißschuh
12261507f512SMike Rapoportconfig SECRETMEM
122774947724SLukas Bulwahn	default y
122874947724SLukas Bulwahn	bool "Enable memfd_secret() system call" if EXPERT
122974947724SLukas Bulwahn	depends on ARCH_HAS_SET_DIRECT_MAP
123074947724SLukas Bulwahn	help
123174947724SLukas Bulwahn	  Enable the memfd_secret() system call with the ability to create
123274947724SLukas Bulwahn	  memory areas visible only in the context of the owning process and
123374947724SLukas Bulwahn	  not mapped to other processes and other kernel page tables.
12341507f512SMike Rapoport
12359a10064fSColin Crossconfig ANON_VMA_NAME
12369a10064fSColin Cross	bool "Anonymous VMA name support"
12379a10064fSColin Cross	depends on PROC_FS && ADVISE_SYSCALLS && MMU
12389a10064fSColin Cross
12399a10064fSColin Cross	help
12409a10064fSColin Cross	  Allow naming anonymous virtual memory areas.
12419a10064fSColin Cross
12429a10064fSColin Cross	  This feature allows assigning names to virtual memory areas. Assigned
12439a10064fSColin Cross	  names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
12449a10064fSColin Cross	  and help identifying individual anonymous memory areas.
12459a10064fSColin Cross	  Assigning a name to anonymous virtual memory area might prevent that
12469a10064fSColin Cross	  area from being merged with adjacent virtual memory areas due to the
12479a10064fSColin Cross	  difference in their name.
12489a10064fSColin Cross
1249430529b5SPeter Xuconfig HAVE_ARCH_USERFAULTFD_WP
1250430529b5SPeter Xu	bool
1251430529b5SPeter Xu	help
1252430529b5SPeter Xu	  Arch has userfaultfd write protection support
1253430529b5SPeter Xu
1254430529b5SPeter Xuconfig HAVE_ARCH_USERFAULTFD_MINOR
1255430529b5SPeter Xu	bool
1256430529b5SPeter Xu	help
1257430529b5SPeter Xu	  Arch has userfaultfd minor fault support
1258430529b5SPeter Xu
125997219cc3SPeter Xumenuconfig USERFAULTFD
126097219cc3SPeter Xu	bool "Enable userfaultfd() system call"
126197219cc3SPeter Xu	depends on MMU
126297219cc3SPeter Xu	help
126397219cc3SPeter Xu	  Enable the userfaultfd() system call that allows to intercept and
126497219cc3SPeter Xu	  handle page faults in userland.
126597219cc3SPeter Xu
126697219cc3SPeter Xuif USERFAULTFD
12671db9dbc2SPeter Xuconfig PTE_MARKER_UFFD_WP
126881e0f15fSPeter Xu	bool "Userfaultfd write protection support for shmem/hugetlbfs"
126981e0f15fSPeter Xu	default y
127081e0f15fSPeter Xu	depends on HAVE_ARCH_USERFAULTFD_WP
12711db9dbc2SPeter Xu
12721db9dbc2SPeter Xu	help
12731db9dbc2SPeter Xu	  Allows to create marker PTEs for userfaultfd write protection
12741db9dbc2SPeter Xu	  purposes.  It is required to enable userfaultfd write protection on
12751db9dbc2SPeter Xu	  file-backed memory types like shmem and hugetlbfs.
127697219cc3SPeter Xuendif # USERFAULTFD
12771db9dbc2SPeter Xu
1278ac35a490SYu Zhao# multi-gen LRU {
1279ec1c86b2SYu Zhaoconfig LRU_GEN
1280ec1c86b2SYu Zhao	bool "Multi-Gen LRU"
1281ec1c86b2SYu Zhao	depends on MMU
1282ec1c86b2SYu Zhao	# make sure folio->flags has enough spare bits
1283ec1c86b2SYu Zhao	depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
1284ec1c86b2SYu Zhao	help
128507017acbSYu Zhao	  A high performance LRU implementation to overcommit memory. See
128607017acbSYu Zhao	  Documentation/admin-guide/mm/multigen_lru.rst for details.
1287ec1c86b2SYu Zhao
1288354ed597SYu Zhaoconfig LRU_GEN_ENABLED
1289354ed597SYu Zhao	bool "Enable by default"
1290354ed597SYu Zhao	depends on LRU_GEN
1291354ed597SYu Zhao	help
1292354ed597SYu Zhao	  This option enables the multi-gen LRU by default.
1293354ed597SYu Zhao
1294ac35a490SYu Zhaoconfig LRU_GEN_STATS
1295ac35a490SYu Zhao	bool "Full stats for debugging"
1296ac35a490SYu Zhao	depends on LRU_GEN
1297ac35a490SYu Zhao	help
1298ac35a490SYu Zhao	  Do not enable this option unless you plan to look at historical stats
1299ac35a490SYu Zhao	  from evicted generations for debugging purpose.
1300ac35a490SYu Zhao
1301ac35a490SYu Zhao	  This option has a per-memcg and per-node memory overhead.
130261dd3f24SKinsey Ho
130361dd3f24SKinsey Hoconfig LRU_GEN_WALKS_MMU
130461dd3f24SKinsey Ho	def_bool y
130561dd3f24SKinsey Ho	depends on LRU_GEN && ARCH_HAS_HW_PTE_YOUNG
1306ac35a490SYu Zhao# }
1307ac35a490SYu Zhao
13080b6cc04fSSuren Baghdasaryanconfig ARCH_SUPPORTS_PER_VMA_LOCK
13090b6cc04fSSuren Baghdasaryan       def_bool n
13100b6cc04fSSuren Baghdasaryan
13110b6cc04fSSuren Baghdasaryanconfig PER_VMA_LOCK
13120b6cc04fSSuren Baghdasaryan	def_bool y
13130b6cc04fSSuren Baghdasaryan	depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP
13140b6cc04fSSuren Baghdasaryan	help
13150b6cc04fSSuren Baghdasaryan	  Allow per-vma locking during page fault handling.
13160b6cc04fSSuren Baghdasaryan
13170b6cc04fSSuren Baghdasaryan	  This feature allows locking each virtual memory area separately when
13180b6cc04fSSuren Baghdasaryan	  handling page faults instead of taking mmap_lock.
13190b6cc04fSSuren Baghdasaryan
1320c2508ec5SLinus Torvaldsconfig LOCK_MM_AND_FIND_VMA
1321c2508ec5SLinus Torvalds	bool
1322c2508ec5SLinus Torvalds	depends on !STACK_GROWSUP
1323c2508ec5SLinus Torvalds
13248f23f5dbSJason Gunthorpeconfig IOMMU_MM_DATA
13258f23f5dbSJason Gunthorpe	bool
13268f23f5dbSJason Gunthorpe
132712af2b83SMike Rapoport (IBM)config EXECMEM
132812af2b83SMike Rapoport (IBM)	bool
132912af2b83SMike Rapoport (IBM)
133087482708SMike Rapoport (Microsoft)config NUMA_MEMBLKS
133187482708SMike Rapoport (Microsoft)	bool
133287482708SMike Rapoport (Microsoft)
1333b0c4e27cSMike Rapoport (Microsoft)config NUMA_EMU
1334b0c4e27cSMike Rapoport (Microsoft)	bool "NUMA emulation"
1335b0c4e27cSMike Rapoport (Microsoft)	depends on NUMA_MEMBLKS
1336b0c4e27cSMike Rapoport (Microsoft)	help
1337b0c4e27cSMike Rapoport (Microsoft)	  Enable NUMA emulation. A flat machine will be split
1338b0c4e27cSMike Rapoport (Microsoft)	  into virtual nodes when booted with "numa=fake=N", where N is the
1339b0c4e27cSMike Rapoport (Microsoft)	  number of nodes. This is only useful for debugging.
1340b0c4e27cSMike Rapoport (Microsoft)
1341bcc9d04eSMark Brownconfig ARCH_HAS_USER_SHADOW_STACK
1342bcc9d04eSMark Brown	bool
1343bcc9d04eSMark Brown	help
1344bcc9d04eSMark Brown	  The architecture has hardware support for userspace shadow call
1345bcc9d04eSMark Brown          stacks (eg, x86 CET, arm64 GCS or RISC-V Zicfiss).
1346bcc9d04eSMark Brown
13476375e95fSQi Zhengconfig ARCH_SUPPORTS_PT_RECLAIM
13486375e95fSQi Zheng	def_bool n
13496375e95fSQi Zheng
13506375e95fSQi Zhengconfig PT_RECLAIM
13516375e95fSQi Zheng	bool "reclaim empty user page table pages"
13526375e95fSQi Zheng	default y
13536375e95fSQi Zheng	depends on ARCH_SUPPORTS_PT_RECLAIM && MMU && SMP
13546375e95fSQi Zheng	select MMU_GATHER_RCU_TABLE_FREE
13556375e95fSQi Zheng	help
13566375e95fSQi Zheng	  Try to reclaim empty user page table pages in paths other than munmap
13576375e95fSQi Zheng	  and exit_mmap path.
13586375e95fSQi Zheng
13596375e95fSQi Zheng	  Note: now only empty user PTE page table pages will be reclaimed.
13606375e95fSQi Zheng
13616375e95fSQi Zheng
13622224d848SSeongJae Parksource "mm/damon/Kconfig"
13632224d848SSeongJae Park
136459e0b520SChristoph Hellwigendmenu
1365