xref: /openbmc/linux/mm/Kconfig (revision 04d5ea46)
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
64519bcb79SJohannes Weinerchoice
65b3fbd58fSJohannes Weiner	prompt "Default compressor"
66519bcb79SJohannes Weiner	depends on ZSWAP
67519bcb79SJohannes Weiner	default ZSWAP_COMPRESSOR_DEFAULT_LZO
68519bcb79SJohannes Weiner	help
69519bcb79SJohannes Weiner	  Selects the default compression algorithm for the compressed cache
70519bcb79SJohannes Weiner	  for swap pages.
71519bcb79SJohannes Weiner
72519bcb79SJohannes Weiner	  For an overview what kind of performance can be expected from
73519bcb79SJohannes Weiner	  a particular compression algorithm please refer to the benchmarks
74519bcb79SJohannes Weiner	  available at the following LWN page:
75519bcb79SJohannes Weiner	  https://lwn.net/Articles/751795/
76519bcb79SJohannes Weiner
77519bcb79SJohannes Weiner	  If in doubt, select 'LZO'.
78519bcb79SJohannes Weiner
79519bcb79SJohannes Weiner	  The selection made here can be overridden by using the kernel
80519bcb79SJohannes Weiner	  command line 'zswap.compressor=' option.
81519bcb79SJohannes Weiner
82519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
83519bcb79SJohannes Weiner	bool "Deflate"
84519bcb79SJohannes Weiner	select CRYPTO_DEFLATE
85519bcb79SJohannes Weiner	help
86519bcb79SJohannes Weiner	  Use the Deflate algorithm as the default compression algorithm.
87519bcb79SJohannes Weiner
88519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZO
89519bcb79SJohannes Weiner	bool "LZO"
90519bcb79SJohannes Weiner	select CRYPTO_LZO
91519bcb79SJohannes Weiner	help
92519bcb79SJohannes Weiner	  Use the LZO algorithm as the default compression algorithm.
93519bcb79SJohannes Weiner
94519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_842
95519bcb79SJohannes Weiner	bool "842"
96519bcb79SJohannes Weiner	select CRYPTO_842
97519bcb79SJohannes Weiner	help
98519bcb79SJohannes Weiner	  Use the 842 algorithm as the default compression algorithm.
99519bcb79SJohannes Weiner
100519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4
101519bcb79SJohannes Weiner	bool "LZ4"
102519bcb79SJohannes Weiner	select CRYPTO_LZ4
103519bcb79SJohannes Weiner	help
104519bcb79SJohannes Weiner	  Use the LZ4 algorithm as the default compression algorithm.
105519bcb79SJohannes Weiner
106519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
107519bcb79SJohannes Weiner	bool "LZ4HC"
108519bcb79SJohannes Weiner	select CRYPTO_LZ4HC
109519bcb79SJohannes Weiner	help
110519bcb79SJohannes Weiner	  Use the LZ4HC algorithm as the default compression algorithm.
111519bcb79SJohannes Weiner
112519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_ZSTD
113519bcb79SJohannes Weiner	bool "zstd"
114519bcb79SJohannes Weiner	select CRYPTO_ZSTD
115519bcb79SJohannes Weiner	help
116519bcb79SJohannes Weiner	  Use the zstd algorithm as the default compression algorithm.
117519bcb79SJohannes Weinerendchoice
118519bcb79SJohannes Weiner
119519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT
120519bcb79SJohannes Weiner       string
121519bcb79SJohannes Weiner       depends on ZSWAP
122519bcb79SJohannes Weiner       default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
123519bcb79SJohannes Weiner       default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
124519bcb79SJohannes Weiner       default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
125519bcb79SJohannes Weiner       default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
126519bcb79SJohannes Weiner       default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
127519bcb79SJohannes Weiner       default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
128519bcb79SJohannes Weiner       default ""
129519bcb79SJohannes Weiner
130519bcb79SJohannes Weinerchoice
131b3fbd58fSJohannes Weiner	prompt "Default allocator"
132519bcb79SJohannes Weiner	depends on ZSWAP
133519bcb79SJohannes Weiner	default ZSWAP_ZPOOL_DEFAULT_ZBUD
134519bcb79SJohannes Weiner	help
135519bcb79SJohannes Weiner	  Selects the default allocator for the compressed cache for
136519bcb79SJohannes Weiner	  swap pages.
137519bcb79SJohannes Weiner	  The default is 'zbud' for compatibility, however please do
138519bcb79SJohannes Weiner	  read the description of each of the allocators below before
139519bcb79SJohannes Weiner	  making a right choice.
140519bcb79SJohannes Weiner
141519bcb79SJohannes Weiner	  The selection made here can be overridden by using the kernel
142519bcb79SJohannes Weiner	  command line 'zswap.zpool=' option.
143519bcb79SJohannes Weiner
144519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_ZBUD
145519bcb79SJohannes Weiner	bool "zbud"
146519bcb79SJohannes Weiner	select ZBUD
147519bcb79SJohannes Weiner	help
148519bcb79SJohannes Weiner	  Use the zbud allocator as the default allocator.
149519bcb79SJohannes Weiner
150519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_Z3FOLD
151519bcb79SJohannes Weiner	bool "z3fold"
152519bcb79SJohannes Weiner	select Z3FOLD
153519bcb79SJohannes Weiner	help
154519bcb79SJohannes Weiner	  Use the z3fold allocator as the default allocator.
155519bcb79SJohannes Weiner
156519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
157519bcb79SJohannes Weiner	bool "zsmalloc"
158519bcb79SJohannes Weiner	select ZSMALLOC
159519bcb79SJohannes Weiner	help
160519bcb79SJohannes Weiner	  Use the zsmalloc allocator as the default allocator.
161519bcb79SJohannes Weinerendchoice
162519bcb79SJohannes Weiner
163519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT
164519bcb79SJohannes Weiner       string
165519bcb79SJohannes Weiner       depends on ZSWAP
166519bcb79SJohannes Weiner       default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD
167519bcb79SJohannes Weiner       default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD
168519bcb79SJohannes Weiner       default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
169519bcb79SJohannes Weiner       default ""
170519bcb79SJohannes Weiner
171519bcb79SJohannes Weinerconfig ZBUD
172b3fbd58fSJohannes Weiner	tristate "2:1 compression allocator (zbud)"
173b3fbd58fSJohannes Weiner	depends on ZSWAP
174519bcb79SJohannes Weiner	help
175519bcb79SJohannes Weiner	  A special purpose allocator for storing compressed pages.
176519bcb79SJohannes Weiner	  It is designed to store up to two compressed pages per physical
177519bcb79SJohannes Weiner	  page.  While this design limits storage density, it has simple and
178519bcb79SJohannes Weiner	  deterministic reclaim properties that make it preferable to a higher
179519bcb79SJohannes Weiner	  density approach when reclaim will be used.
180519bcb79SJohannes Weiner
181519bcb79SJohannes Weinerconfig Z3FOLD
182b3fbd58fSJohannes Weiner	tristate "3:1 compression allocator (z3fold)"
183b3fbd58fSJohannes Weiner	depends on ZSWAP
184519bcb79SJohannes Weiner	help
185519bcb79SJohannes Weiner	  A special purpose allocator for storing compressed pages.
186519bcb79SJohannes Weiner	  It is designed to store up to three compressed pages per physical
187519bcb79SJohannes Weiner	  page. It is a ZBUD derivative so the simplicity and determinism are
188519bcb79SJohannes Weiner	  still there.
189519bcb79SJohannes Weiner
190519bcb79SJohannes Weinerconfig ZSMALLOC
191b3fbd58fSJohannes Weiner	tristate
192b3fbd58fSJohannes Weiner	prompt "N:1 compression allocator (zsmalloc)" if ZSWAP
193519bcb79SJohannes Weiner	depends on MMU
194519bcb79SJohannes Weiner	help
195519bcb79SJohannes Weiner	  zsmalloc is a slab-based memory allocator designed to store
196b3fbd58fSJohannes Weiner	  pages of various compression levels efficiently. It achieves
197b3fbd58fSJohannes Weiner	  the highest storage density with the least amount of fragmentation.
198519bcb79SJohannes Weiner
199519bcb79SJohannes Weinerconfig ZSMALLOC_STAT
200519bcb79SJohannes Weiner	bool "Export zsmalloc statistics"
201519bcb79SJohannes Weiner	depends on ZSMALLOC
202519bcb79SJohannes Weiner	select DEBUG_FS
203519bcb79SJohannes Weiner	help
204519bcb79SJohannes Weiner	  This option enables code in the zsmalloc to collect various
205519bcb79SJohannes Weiner	  statistics about what's happening in zsmalloc and exports that
206519bcb79SJohannes Weiner	  information to userspace via debugfs.
207519bcb79SJohannes Weiner	  If unsure, say N.
208519bcb79SJohannes Weiner
2094ff93b29SSergey Senozhatskyconfig ZSMALLOC_CHAIN_SIZE
2104ff93b29SSergey Senozhatsky	int "Maximum number of physical pages per-zspage"
211b46402faSSergey Senozhatsky	default 8
2124ff93b29SSergey Senozhatsky	range 4 16
2134ff93b29SSergey Senozhatsky	depends on ZSMALLOC
2144ff93b29SSergey Senozhatsky	help
2154ff93b29SSergey Senozhatsky	  This option sets the upper limit on the number of physical pages
2164ff93b29SSergey Senozhatsky	  that a zmalloc page (zspage) can consist of. The optimal zspage
2174ff93b29SSergey Senozhatsky	  chain size is calculated for each size class during the
2184ff93b29SSergey Senozhatsky	  initialization of the pool.
2194ff93b29SSergey Senozhatsky
2204ff93b29SSergey Senozhatsky	  Changing this option can alter the characteristics of size classes,
2214ff93b29SSergey Senozhatsky	  such as the number of pages per zspage and the number of objects
2224ff93b29SSergey Senozhatsky	  per zspage. This can also result in different configurations of
2234ff93b29SSergey Senozhatsky	  the pool, as zsmalloc merges size classes with similar
2244ff93b29SSergey Senozhatsky	  characteristics.
2254ff93b29SSergey Senozhatsky
2264ff93b29SSergey Senozhatsky	  For more information, see zsmalloc documentation.
2274ff93b29SSergey Senozhatsky
228519bcb79SJohannes Weinermenu "SLAB allocator options"
229519bcb79SJohannes Weiner
2307b42f104SJohannes Weinerchoice
2317b42f104SJohannes Weiner	prompt "Choose SLAB allocator"
2327b42f104SJohannes Weiner	default SLUB
2337b42f104SJohannes Weiner	help
2347b42f104SJohannes Weiner	   This option allows to select a slab allocator.
2357b42f104SJohannes Weiner
236eb07c4f3SVlastimil Babkaconfig SLAB_DEPRECATED
237eb07c4f3SVlastimil Babka	bool "SLAB (DEPRECATED)"
2387b42f104SJohannes Weiner	depends on !PREEMPT_RT
2397b42f104SJohannes Weiner	help
240eb07c4f3SVlastimil Babka	  Deprecated and scheduled for removal in a few cycles. Replaced by
241eb07c4f3SVlastimil Babka	  SLUB.
242eb07c4f3SVlastimil Babka
243eb07c4f3SVlastimil Babka	  If you cannot migrate to SLUB, please contact linux-mm@kvack.org
244eb07c4f3SVlastimil Babka	  and the people listed in the SLAB ALLOCATOR section of MAINTAINERS
245eb07c4f3SVlastimil Babka	  file, explaining why.
246eb07c4f3SVlastimil Babka
2477b42f104SJohannes Weiner	  The regular slab allocator that is established and known to work
2487b42f104SJohannes Weiner	  well in all environments. It organizes cache hot objects in
2497b42f104SJohannes Weiner	  per cpu and per node queues.
2507b42f104SJohannes Weiner
2517b42f104SJohannes Weinerconfig SLUB
2527b42f104SJohannes Weiner	bool "SLUB (Unqueued Allocator)"
2537b42f104SJohannes Weiner	help
2547b42f104SJohannes Weiner	   SLUB is a slab allocator that minimizes cache line usage
2557b42f104SJohannes Weiner	   instead of managing queues of cached objects (SLAB approach).
2567b42f104SJohannes Weiner	   Per cpu caching is realized using slabs of objects instead
2577b42f104SJohannes Weiner	   of queues of objects. SLUB can use memory efficiently
2587b42f104SJohannes Weiner	   and has enhanced diagnostics. SLUB is the default choice for
2597b42f104SJohannes Weiner	   a slab allocator.
2607b42f104SJohannes Weiner
2617b42f104SJohannes Weinerendchoice
2627b42f104SJohannes Weiner
263eb07c4f3SVlastimil Babkaconfig SLAB
264eb07c4f3SVlastimil Babka	bool
265eb07c4f3SVlastimil Babka	default y
266eb07c4f3SVlastimil Babka	depends on SLAB_DEPRECATED
267eb07c4f3SVlastimil Babka
268e240e53aSVlastimil Babkaconfig SLUB_TINY
269e240e53aSVlastimil Babka	bool "Configure SLUB for minimal memory footprint"
270e240e53aSVlastimil Babka	depends on SLUB && EXPERT
271e240e53aSVlastimil Babka	select SLAB_MERGE_DEFAULT
272e240e53aSVlastimil Babka	help
273e240e53aSVlastimil Babka	   Configures the SLUB allocator in a way to achieve minimal memory
274e240e53aSVlastimil Babka	   footprint, sacrificing scalability, debugging and other features.
275e240e53aSVlastimil Babka	   This is intended only for the smallest system that had used the
276e240e53aSVlastimil Babka	   SLOB allocator and is not recommended for systems with more than
277e240e53aSVlastimil Babka	   16MB RAM.
278e240e53aSVlastimil Babka
279e240e53aSVlastimil Babka	   If unsure, say N.
280e240e53aSVlastimil Babka
2817b42f104SJohannes Weinerconfig SLAB_MERGE_DEFAULT
2827b42f104SJohannes Weiner	bool "Allow slab caches to be merged"
2837b42f104SJohannes Weiner	default y
2847b42f104SJohannes Weiner	depends on SLAB || SLUB
2857b42f104SJohannes Weiner	help
2867b42f104SJohannes Weiner	  For reduced kernel memory fragmentation, slab caches can be
2877b42f104SJohannes Weiner	  merged when they share the same size and other characteristics.
2887b42f104SJohannes Weiner	  This carries a risk of kernel heap overflows being able to
2897b42f104SJohannes Weiner	  overwrite objects from merged caches (and more easily control
2907b42f104SJohannes Weiner	  cache layout), which makes such heap attacks easier to exploit
2917b42f104SJohannes Weiner	  by attackers. By keeping caches unmerged, these kinds of exploits
2927b42f104SJohannes Weiner	  can usually only damage objects in the same cache. To disable
2937b42f104SJohannes Weiner	  merging at runtime, "slab_nomerge" can be passed on the kernel
2947b42f104SJohannes Weiner	  command line.
2957b42f104SJohannes Weiner
2967b42f104SJohannes Weinerconfig SLAB_FREELIST_RANDOM
2977b42f104SJohannes Weiner	bool "Randomize slab freelist"
298e240e53aSVlastimil Babka	depends on SLAB || (SLUB && !SLUB_TINY)
2997b42f104SJohannes Weiner	help
3007b42f104SJohannes Weiner	  Randomizes the freelist order used on creating new pages. This
3017b42f104SJohannes Weiner	  security feature reduces the predictability of the kernel slab
3027b42f104SJohannes Weiner	  allocator against heap overflows.
3037b42f104SJohannes Weiner
3047b42f104SJohannes Weinerconfig SLAB_FREELIST_HARDENED
3057b42f104SJohannes Weiner	bool "Harden slab freelist metadata"
306e240e53aSVlastimil Babka	depends on SLAB || (SLUB && !SLUB_TINY)
3077b42f104SJohannes Weiner	help
3087b42f104SJohannes Weiner	  Many kernel heap attacks try to target slab cache metadata and
3097b42f104SJohannes Weiner	  other infrastructure. This options makes minor performance
3107b42f104SJohannes Weiner	  sacrifices to harden the kernel slab allocator against common
3117b42f104SJohannes Weiner	  freelist exploit methods. Some slab implementations have more
3127b42f104SJohannes Weiner	  sanity-checking than others. This option is most effective with
3137b42f104SJohannes Weiner	  CONFIG_SLUB.
3147b42f104SJohannes Weiner
3150710d012SVlastimil Babkaconfig SLUB_STATS
3160710d012SVlastimil Babka	default n
3170710d012SVlastimil Babka	bool "Enable SLUB performance statistics"
318e240e53aSVlastimil Babka	depends on SLUB && SYSFS && !SLUB_TINY
3190710d012SVlastimil Babka	help
3200710d012SVlastimil Babka	  SLUB statistics are useful to debug SLUBs allocation behavior in
3210710d012SVlastimil Babka	  order find ways to optimize the allocator. This should never be
3220710d012SVlastimil Babka	  enabled for production use since keeping statistics slows down
3230710d012SVlastimil Babka	  the allocator by a few percentage points. The slabinfo command
3240710d012SVlastimil Babka	  supports the determination of the most active slabs to figure
3250710d012SVlastimil Babka	  out which slabs are relevant to a particular load.
3260710d012SVlastimil Babka	  Try running: slabinfo -DA
3270710d012SVlastimil Babka
328519bcb79SJohannes Weinerconfig SLUB_CPU_PARTIAL
329519bcb79SJohannes Weiner	default y
330e240e53aSVlastimil Babka	depends on SLUB && SMP && !SLUB_TINY
331519bcb79SJohannes Weiner	bool "SLUB per cpu partial cache"
332519bcb79SJohannes Weiner	help
333519bcb79SJohannes Weiner	  Per cpu partial caches accelerate objects allocation and freeing
334519bcb79SJohannes Weiner	  that is local to a processor at the price of more indeterminism
335519bcb79SJohannes Weiner	  in the latency of the free. On overflow these caches will be cleared
336519bcb79SJohannes Weiner	  which requires the taking of locks that may cause latency spikes.
337519bcb79SJohannes Weiner	  Typically one would choose no for a realtime system.
338519bcb79SJohannes Weiner
339519bcb79SJohannes Weinerconfig RANDOM_KMALLOC_CACHES
340519bcb79SJohannes Weiner	default n
3417b42f104SJohannes Weiner	depends on SLUB && !SLUB_TINY
3427b42f104SJohannes Weiner	bool "Randomize slab caches for normal kmalloc"
3437b42f104SJohannes Weiner	help
3447b42f104SJohannes Weiner	  A hardening feature that creates multiple copies of slab caches for
3457b42f104SJohannes Weiner	  normal kmalloc allocation and makes kmalloc randomly pick one based
3467b42f104SJohannes Weiner	  on code address, which makes the attackers more difficult to spray
3477b42f104SJohannes Weiner	  vulnerable memory objects on the heap for the purpose of exploiting
3487b42f104SJohannes Weiner	  memory vulnerabilities.
3497b42f104SJohannes Weiner
3507b42f104SJohannes Weiner	  Currently the number of copies is set to 16, a reasonably large value
3517b42f104SJohannes Weiner	  that effectively diverges the memory objects allocated for different
35223baf831SKirill A. Shutemov	  subsystems or modules into different caches, at the expense of a
35323baf831SKirill A. Shutemov	  limited degree of memory and CPU overhead that relates to hardware and
35423baf831SKirill A. Shutemov	  system workload.
3557b42f104SJohannes Weiner
3567b42f104SJohannes Weinerendmenu # SLAB allocator options
3577b42f104SJohannes Weiner
3587b42f104SJohannes Weinerconfig SHUFFLE_PAGE_ALLOCATOR
3597b42f104SJohannes Weiner	bool "Page allocator randomization"
3607b42f104SJohannes Weiner	default SLAB_FREELIST_RANDOM && ACPI_NUMA
3617b42f104SJohannes Weiner	help
3627b42f104SJohannes Weiner	  Randomization of the page allocator improves the average
3637b42f104SJohannes Weiner	  utilization of a direct-mapped memory-side-cache. See section
3647b42f104SJohannes Weiner	  5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
3650710d012SVlastimil Babka	  6.2a specification for an example of how a platform advertises
3660710d012SVlastimil Babka	  the presence of a memory-side-cache. There are also incidental
3670710d012SVlastimil Babka	  security benefits as it reduces the predictability of page
3680710d012SVlastimil Babka	  allocations to compliment SLAB_FREELIST_RANDOM, but the
3690710d012SVlastimil Babka	  default granularity of shuffling on the MAX_ORDER i.e, 10th
3700710d012SVlastimil Babka	  order of pages is selected based on cache utilization benefits
3710710d012SVlastimil Babka	  on x86.
3720710d012SVlastimil Babka
3730710d012SVlastimil Babka	  While the randomization improves cache utilization it may
3740710d012SVlastimil Babka	  negatively impact workloads on platforms without a cache. For
3750710d012SVlastimil Babka	  this reason, by default, the randomization is enabled only
3760710d012SVlastimil Babka	  after runtime detection of a direct-mapped memory-side-cache.
3770710d012SVlastimil Babka	  Otherwise, the randomization may be force enabled with the
3780710d012SVlastimil Babka	  'page_alloc.shuffle' kernel command line parameter.
3790710d012SVlastimil Babka
3800710d012SVlastimil Babka	  Say Y if unsure.
3810710d012SVlastimil Babka
3820710d012SVlastimil Babkaconfig COMPAT_BRK
3830710d012SVlastimil Babka	bool "Disable heap randomization"
3840710d012SVlastimil Babka	default y
3850710d012SVlastimil Babka	help
3860710d012SVlastimil Babka	  Randomizing heap placement makes heap exploits harder, but it
3870710d012SVlastimil Babka	  also breaks ancient binaries (including anything libc5 based).
3880710d012SVlastimil Babka	  This option changes the bootup default to heap randomization
3890710d012SVlastimil Babka	  disabled, and can be overridden at runtime by setting
3900710d012SVlastimil Babka	  /proc/sys/kernel/randomize_va_space to 2.
3910710d012SVlastimil Babka
3920710d012SVlastimil Babka	  On non-ancient distros (post-2000 ones) N is usually a safe choice.
3930710d012SVlastimil Babka
3940710d012SVlastimil Babkaconfig MMAP_ALLOW_UNINITIALIZED
3950710d012SVlastimil Babka	bool "Allow mmapped anonymous memory to be uninitialized"
3960710d012SVlastimil Babka	depends on EXPERT && !MMU
3970710d012SVlastimil Babka	default n
3980710d012SVlastimil Babka	help
399e1785e85SDave Hansen	  Normally, and according to the Linux spec, anonymous memory obtained
400e1785e85SDave Hansen	  from mmap() has its contents cleared before it is passed to
401a8826eebSKees Cook	  userspace.  Enabling this config option allows you to request that
402e1785e85SDave Hansen	  mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
4033a9da765SDave Hansen	  providing a huge performance boost.  If this option is not enabled,
4043a9da765SDave Hansen	  then the flag will be ignored.
405e1785e85SDave Hansen
406d41dee36SAndy Whitcroft	  This is taken advantage of by uClibc's malloc(), and also by
407e1785e85SDave Hansen	  ELF-FDPIC binfmt's brk and stack allocator.
408d66d109dSMike Rapoport
409d66d109dSMike Rapoport	  Because of the obvious security issues, this option should only be
410d66d109dSMike Rapoport	  enabled on embedded devices where you control what is run in
411d66d109dSMike Rapoport	  userspace.  Since that isn't generally a problem on no-MMU systems,
412d66d109dSMike Rapoport	  it is normally safe to say Y here.
4133a9da765SDave Hansen
414e1785e85SDave Hansen	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
4153a9da765SDave Hansen
416bb1c50d3SMike Rapoportconfig SELECT_MEMORY_MODEL
4173a9da765SDave Hansen	def_bool y
418d66d109dSMike Rapoport	depends on ARCH_SELECT_MEMORY_MODEL
419d66d109dSMike Rapoport
420d66d109dSMike Rapoportchoice
421d66d109dSMike Rapoport	prompt "Memory model"
4223a9da765SDave Hansen	depends on SELECT_MEMORY_MODEL
423d66d109dSMike Rapoport	default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
424d66d109dSMike Rapoport	default FLATMEM_MANUAL
425dd33d29aSRandy Dunlap	help
426d41dee36SAndy Whitcroft	  This option allows you to change some of the ways that
427d41dee36SAndy Whitcroft	  Linux manages its memory internally. Most users will
4283a9da765SDave Hansen	  only have one option here selected by the architecture
429d41dee36SAndy Whitcroft	  configuration. This is normal.
430d41dee36SAndy Whitcroft
431d41dee36SAndy Whitcroftconfig FLATMEM_MANUAL
432d41dee36SAndy Whitcroft	bool "Flat Memory"
433d41dee36SAndy Whitcroft	depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
434d66d109dSMike Rapoport	help
435d41dee36SAndy Whitcroft	  This option is best suited for non-NUMA systems with
436d66d109dSMike Rapoport	  flat address space. The FLATMEM is the most efficient
437d66d109dSMike Rapoport	  system in terms of performance and resource consumption
438d66d109dSMike Rapoport	  and it is the best option for smaller systems.
439d41dee36SAndy Whitcroft
440d66d109dSMike Rapoport	  For systems that have holes in their physical address
441d41dee36SAndy Whitcroft	  spaces and for features like NUMA and memory hotplug,
4423a9da765SDave Hansen	  choose "Sparse Memory".
4433a9da765SDave Hansen
444d41dee36SAndy Whitcroft	  If unsure, choose this option (Flat Memory) over any other.
445d41dee36SAndy Whitcroft
4461a83e175SRussell Kingconfig SPARSEMEM_MANUAL
447d41dee36SAndy Whitcroft	bool "Sparse Memory"
448e1785e85SDave Hansen	depends on ARCH_SPARSEMEM_ENABLE
449e1785e85SDave Hansen	help
450bb1c50d3SMike Rapoport	  This will be the only option for some systems, including
451d41dee36SAndy Whitcroft	  memory hot-plug systems.  This is normal.
45293b7504eSDave Hansen
4533e347261SBob Picco	  This option provides efficient support for systems with
454c89ab04fSMike Rapoport	  holes is their physical address space and allows memory
4553e347261SBob Picco	  hot-plug and hot-remove.
4563e347261SBob Picco
4573e347261SBob Picco	  If unsure, choose "Flat Memory" over this option.
4583e347261SBob Picco
4593e347261SBob Piccoendchoice
4603e347261SBob Picco
4613e347261SBob Piccoconfig SPARSEMEM
4623e347261SBob Picco	def_bool y
4639ba16087SJan Beulich	depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
4643e347261SBob Picco
4653e347261SBob Piccoconfig FLATMEM
46644c09201SMatt LaPlante	def_bool y
467802f192eSBob Picco	depends on !SPARSEMEM || FLATMEM_MANUAL
468802f192eSBob Picco
469802f192eSBob Picco#
4703e347261SBob Picco# SPARSEMEM_EXTREME (which is the default) does some bootmem
4713e347261SBob Picco# allocations when sparse_init() is called.  If this cannot
4723e347261SBob Picco# be done on your architecture, select this option.  However,
4734c21e2f2SHugh Dickins# statically allocating the mem_section[] array can potentially
47429c71111SAndy Whitcroft# consume vast quantities of .bss, so be careful.
4759ba16087SJan Beulich#
47629c71111SAndy Whitcroft# This option will also potentially produce smaller runtime code
47729c71111SAndy Whitcroft# with gcc 3.4 and later.
478a5ee6daaSGeoff Levand#
479a5ee6daaSGeoff Levandconfig SPARSEMEM_STATIC
480a5ee6daaSGeoff Levand	bool
481a5ee6daaSGeoff Levand
482a5ee6daaSGeoff Levand#
483a5ee6daaSGeoff Levand# Architecture platforms which require a two level mem_section in SPARSEMEM
484a5ee6daaSGeoff Levand# must select this option. This is usually for architecture platforms with
4850b376f1eSAneesh Kumar K.V# an extremely sparse physical address space.
4860b376f1eSAneesh Kumar K.V#
4870b376f1eSAneesh Kumar K.Vconfig SPARSEMEM_EXTREME
4880b376f1eSAneesh Kumar K.V	def_bool y
4890b6f1582SAneesh Kumar K.V	depends on SPARSEMEM && !SPARSEMEM_STATIC
4900b6f1582SAneesh Kumar K.V
4910b6f1582SAneesh Kumar K.Vconfig SPARSEMEM_VMEMMAP_ENABLE
4920b6f1582SAneesh Kumar K.V	bool
4930b376f1eSAneesh Kumar K.V
49429c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP
49570210ed9SPhilipp Hachtmann	bool "Sparse Memory virtual memmap"
4966341e62bSChristoph Jaeger	depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
49770210ed9SPhilipp Hachtmann	default y
49867a929e0SChristoph Hellwig	help
499050a9adcSChristoph Hellwig	  SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
5006341e62bSChristoph Jaeger	  pfn_to_page and page_to_pfn operations.  This is the most
5012667f50eSSteve Capper	  efficient option when sufficient kernel resources are available.
50252219aeaSDavid Hildenbrand#
50352219aeaSDavid Hildenbrand# Select this config option from the architecture Kconfig, if it is preferred
50452219aeaSDavid Hildenbrand# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
505350e88baSMike Rapoport#
5066341e62bSChristoph Jaegerconfig ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
507c378ddd5STejun Heo	bool
5081e5d8e1eSDan Williams
5091e5d8e1eSDan Williamsconfig ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
5101e5d8e1eSDan Williams	bool
5111e5d8e1eSDan Williams
512ee6f509cSMinchan Kimconfig HAVE_MEMBLOCK_PHYS_MAP
5136341e62bSChristoph Jaeger	bool
514ee6f509cSMinchan Kim
515a9e7b8d4SDavid Hildenbrandconfig HAVE_FAST_GUP
516a9e7b8d4SDavid Hildenbrand	depends on MMU
517a9e7b8d4SDavid Hildenbrand	bool
518a9e7b8d4SDavid Hildenbrand
519a9e7b8d4SDavid Hildenbrand# Don't discard allocated memory used to track "memory" and "reserved" memblocks
520a9e7b8d4SDavid Hildenbrand# after early boot, so it can still be used to test for validity of memory.
521a9e7b8d4SDavid Hildenbrand# Also, memblocks are updated with memory hot(un)plug.
52246723bfaSYasuaki Ishimatsuconfig ARCH_KEEP_MEMBLOCK
52346723bfaSYasuaki Ishimatsu	bool
52446723bfaSYasuaki Ishimatsu
52546723bfaSYasuaki Ishimatsu# Keep arch NUMA mapping infrastructure post-init.
52646723bfaSYasuaki Ishimatsuconfig NUMA_KEEP_MEMINFO
52746723bfaSYasuaki Ishimatsu	bool
52846723bfaSYasuaki Ishimatsu
52991024b3cSAnshuman Khandualconfig MEMORY_ISOLATION
53091024b3cSAnshuman Khandual	bool
53191024b3cSAnshuman Khandual
532519bcb79SJohannes Weiner# IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked
533519bcb79SJohannes Weiner# IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via
534519bcb79SJohannes Weiner# /dev/mem.
5353947be19SDave Hansenconfig EXCLUSIVE_SYSTEM_RAM
536519bcb79SJohannes Weiner	def_bool y
537519bcb79SJohannes Weiner	depends on !DEVMEM || STRICT_DEVMEM
538b30c5927SDavid Hildenbrand
53971b6f2ddSDavid Hildenbrand#
54040b31360SStephen Rothwell# Only be set on architectures that have completely implemented memory hotplug
5417ec58a2bSDavid Hildenbrand# feature. If you are not sure, don't touch it.
5421e5d8e1eSDan Williams#
5433947be19SDave Hansenconfig HAVE_BOOTMEM_INFO_NODE
544519bcb79SJohannes Weiner	def_bool n
545519bcb79SJohannes Weiner
5468604d9e5SVitaly Kuznetsovconfig ARCH_ENABLE_MEMORY_HOTPLUG
5478604d9e5SVitaly Kuznetsov	bool
5488604d9e5SVitaly Kuznetsov
5498604d9e5SVitaly Kuznetsovconfig ARCH_ENABLE_MEMORY_HOTREMOVE
5508604d9e5SVitaly Kuznetsov	bool
5518604d9e5SVitaly Kuznetsov
5528604d9e5SVitaly Kuznetsov# eventually, we can have this option just 'select SPARSEMEM'
5538604d9e5SVitaly Kuznetsovmenuconfig MEMORY_HOTPLUG
554cb1aaebeSMauro Carvalho Chehab	bool "Memory hotplug"
5558604d9e5SVitaly Kuznetsov	select MEMORY_ISOLATION
5568604d9e5SVitaly Kuznetsov	depends on SPARSEMEM
5578604d9e5SVitaly Kuznetsov	depends on ARCH_ENABLE_MEMORY_HOTPLUG
5588604d9e5SVitaly Kuznetsov	depends on 64BIT
5598604d9e5SVitaly Kuznetsov	select NUMA_KEEP_MEMINFO if NUMA
5608604d9e5SVitaly Kuznetsov
5610c0e6195SKAMEZAWA Hiroyukiif MEMORY_HOTPLUG
5620c0e6195SKAMEZAWA Hiroyuki
563f7e3334aSNathan Fontenotconfig MEMORY_HOTPLUG_DEFAULT_ONLINE
5640c0e6195SKAMEZAWA Hiroyuki	bool "Online the newly added memory blocks by default"
5650c0e6195SKAMEZAWA Hiroyuki	depends on MEMORY_HOTPLUG
5660c0e6195SKAMEZAWA Hiroyuki	help
567a08a2ae3SOscar Salvador	  This option sets the default policy setting for memory hotplug
568a08a2ae3SOscar Salvador	  onlining policy (/sys/devices/system/memory/auto_online_blocks) which
569a08a2ae3SOscar Salvador	  determines what happens to newly added memory regions. Policy setting
570a08a2ae3SOscar Salvador	  can always be changed at runtime.
571a08a2ae3SOscar Salvador	  See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
572519bcb79SJohannes Weiner
573519bcb79SJohannes Weiner	  Say Y here if you want all hot-plugged memory blocks to appear in
574*04d5ea46SAneesh Kumar K.V	  'online' state by default.
575*04d5ea46SAneesh Kumar K.V	  Say N here if you want the default policy to keep all hot-plugged
576*04d5ea46SAneesh Kumar K.V	  memory blocks in 'offline' state.
5774c21e2f2SHugh Dickins
5784c21e2f2SHugh Dickinsconfig MEMORY_HOTREMOVE
5794c21e2f2SHugh Dickins	bool "Allow for memory hot remove"
5804c21e2f2SHugh Dickins	select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
5814c21e2f2SHugh Dickins	depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
5827b6ac9dfSHugh Dickins	depends on MIGRATION
58360bccaa6SWill Deacon
58460bccaa6SWill Deaconconfig MHP_MEMMAP_ON_MEMORY
58560bccaa6SWill Deacon	def_bool y
586a70caa8bSHugh Dickins	depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
5874c21e2f2SHugh Dickins	depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
5884c21e2f2SHugh Dickins
5894c21e2f2SHugh Dickinsendif # MEMORY_HOTPLUG
5909164550eSKirill A. Shutemov
591a70caa8bSHugh Dickinsconfig ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
592a70caa8bSHugh Dickins       bool
59360bccaa6SWill Deacon
5944c21e2f2SHugh Dickins# Heavily threaded applications may benefit from splitting the mm-wide
5957cbe34cfSChristoph Lameter# page_table_lock, so that faults on different parts of the user address
596e009bb30SKirill A. Shutemov# space can be handled with less contention: split it at this NR_CPUS.
5976341e62bSChristoph Jaeger# Default to 4 for wider testing, though 8 might be more appropriate.
598e009bb30SKirill A. Shutemov# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
5997cbe34cfSChristoph Lameter# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
60009316c09SKonstantin Khlebnikov# SPARC32 allocates multiple pte tables within a single page, and therefore
60109316c09SKonstantin Khlebnikov# a per-page lock leads to problems when multiple tables need to be locked
6026341e62bSChristoph Jaeger# at the same time (e.g. copy_page_range()).
60309316c09SKonstantin Khlebnikov# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
60409316c09SKonstantin Khlebnikov#
60518468d93SRafael Aquiniconfig SPLIT_PTLOCK_CPUS
60618468d93SRafael Aquini	int
60718468d93SRafael Aquini	default "999999" if !MMU
60818468d93SRafael Aquini	default "999999" if ARM && !CPU_CACHE_VIPT
60909316c09SKonstantin Khlebnikov	default "999999" if PARISC && !PA20
61018468d93SRafael Aquini	default "999999" if SPARC32
61118468d93SRafael Aquini	default "4"
61218468d93SRafael Aquini
61318468d93SRafael Aquiniconfig ARCH_ENABLE_SPLIT_PMD_PTLOCK
61418468d93SRafael Aquini	bool
61518468d93SRafael Aquini
61618468d93SRafael Aquini#
61718468d93SRafael Aquini# support for memory balloon
61818468d93SRafael Aquiniconfig MEMORY_BALLOON
61918468d93SRafael Aquini	bool
620e9e96b39SMel Gorman
621e9e96b39SMel Gorman#
622e9e96b39SMel Gorman# support for memory balloon compaction
62305106e6aSRik van Rielconfig BALLOON_COMPACTION
624e9e96b39SMel Gorman	bool "Allow for balloon memory compaction/migration"
62533a93877SAndrea Arcangeli	def_bool y
626e9e96b39SMel Gorman	depends on COMPACTION && MEMORY_BALLOON
627b32eaf71SMichal Hocko	help
628b32eaf71SMichal Hocko	  Memory fragmentation introduced by ballooning might reduce
629b32eaf71SMichal Hocko	  significantly the number of 2MB contiguous memory blocks that can be
630b32eaf71SMichal Hocko	  used within a guest, thus imposing performance penalties associated
631b32eaf71SMichal Hocko	  with the reduced number of transparent huge pages that could be used
632b32eaf71SMichal Hocko	  by the guest workload. Allowing the compaction & migration for memory
633b32eaf71SMichal Hocko	  pages enlisted as being part of memory balloon devices avoids the
634b32eaf71SMichal Hocko	  scenario aforementioned and helps improving memory defragmentation.
635e9e96b39SMel Gorman
636c7e0b3d0SThomas Gleixner#
637c7e0b3d0SThomas Gleixner# support for memory compaction
638c7e0b3d0SThomas Gleixnerconfig COMPACTION
639c7e0b3d0SThomas Gleixner	bool "Allow for memory compaction"
640c7e0b3d0SThomas Gleixner	def_bool y
641c7e0b3d0SThomas Gleixner	select MIGRATION
642e9e96b39SMel Gorman	depends on MMU
64336e66c55SAlexander Duyck	help
64436e66c55SAlexander Duyck	  Compaction is the only memory management component to form
64536e66c55SAlexander Duyck	  high order (larger physically contiguous) memory blocks
64636e66c55SAlexander Duyck	  reliably. The page allocator relies on compaction heavily and
64736e66c55SAlexander Duyck	  the lack of the feature can lead to unexpected OOM killer
64836e66c55SAlexander Duyck	  invocations for high order memory requests. You shouldn't
64936e66c55SAlexander Duyck	  disable this option unless there really is a strong reason for
65036e66c55SAlexander Duyck	  it and then we would be really interested to hear about that at
65136e66c55SAlexander Duyck	  linux-mm@kvack.org.
65236e66c55SAlexander Duyck
65336e66c55SAlexander Duyckconfig COMPACT_UNEVICTABLE_DEFAULT
6547cbe34cfSChristoph Lameter	int
6557cbe34cfSChristoph Lameter	depends on COMPACTION
6567cbe34cfSChristoph Lameter	default 0 if PREEMPT_RT
657b20a3503SChristoph Lameter	default 1
6586c5240aeSChristoph Lameter
659de32a817SChen Gang#
660b20a3503SChristoph Lameter# support for free page reporting
661b20a3503SChristoph Lameterconfig PAGE_REPORTING
662e9e96b39SMel Gorman	bool "Free page reporting"
663e9e96b39SMel Gorman	def_bool n
664e9e96b39SMel Gorman	help
665e9e96b39SMel Gorman	  Free page reporting allows for the incremental acquisition of
666e9e96b39SMel Gorman	  free pages from the buddy allocator for the purpose of reporting
6676550e07fSGreg Kroah-Hartman	  those pages to another entity, such as a hypervisor, so that the
66876cbbeadSChristoph Hellwig	  memory can be freed within the host for other uses.
669d90a25f8SChristoph Hellwig
67076cbbeadSChristoph Hellwig#
671c177c81eSNaoya Horiguchi# support for page migration
6726341e62bSChristoph Jaeger#
673c177c81eSNaoya Horiguchiconfig MIGRATION
6749c670ea3SNaoya Horiguchi	bool "Page migration"
6759c670ea3SNaoya Horiguchi	def_bool y
6769c670ea3SNaoya Horiguchi	depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
6774bfb68a0SAnshuman Khandual	help
6784bfb68a0SAnshuman Khandual	  Allows the migration of the physical location of pages of processes
6794bfb68a0SAnshuman Khandual	  while the virtual addresses are not changed. This is useful in
6804bfb68a0SAnshuman Khandual	  two situations. The first is on NUMA systems to put pages nearer
6814bfb68a0SAnshuman Khandual	  to the processors accessing. The second is when allocating huge
6824bfb68a0SAnshuman Khandual	  pages as migration can relocate pages to satisfy a huge page
6834bfb68a0SAnshuman Khandual	  allocation instead of reclaiming.
68423baf831SKirill A. Shutemov
68523baf831SKirill A. Shutemovconfig DEVICE_MIGRATION
686b3d40a2bSDavid Hildenbrand	def_bool MIGRATION && ZONE_DEVICE
6878df995f6SAlexandre Ghiti
6888df995f6SAlexandre Ghiticonfig ARCH_ENABLE_HUGEPAGE_MIGRATION
6898df995f6SAlexandre Ghiti	bool
690600715dcSJeremy Fitzhardinge
691d4a451d5SChristoph Hellwigconfig ARCH_ENABLE_THP_MIGRATION
692600715dcSJeremy Fitzhardinge	bool
6932a7326b5SChristoph Lameter
6949ca24e2eSVinayak Menonconfig HUGETLB_PAGE_SIZE_VARIABLE
6959ca24e2eSVinayak Menon	def_bool n
696ce288e05SChristoph Hellwig	help
6979ca24e2eSVinayak Menon	  Allows the pageblock_order value to be dynamic instead of just standard
698ce288e05SChristoph Hellwig	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
699ce288e05SChristoph Hellwig	  on a platform.
700ce288e05SChristoph Hellwig
7012a7326b5SChristoph Lameter	  Note that the pageblock_order cannot exceed MAX_ORDER and will be
702cddb8a5cSAndrea Arcangeli	  clamped down to MAX_ORDER.
703cddb8a5cSAndrea Arcangeli
70499cb252fSJason Gunthorpeconfig CONTIG_ALLOC
705fc4d5c29SDavid Howells	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
706f8af4da3SHugh Dickins
707f8af4da3SHugh Dickinsconfig PHYS_ADDR_T_64BIT
708f8af4da3SHugh Dickins	def_bool 64BIT
70959e1a2f4STimofey Titovets
710f8af4da3SHugh Dickinsconfig BOUNCE
711f8af4da3SHugh Dickins	bool "Enable bounce buffers"
712f8af4da3SHugh Dickins	default y
713f8af4da3SHugh Dickins	depends on BLOCK && MMU && HIGHMEM
714d0f209f6SHugh Dickins	help
715f8af4da3SHugh Dickins	  Enable bounce buffers for devices that cannot access the full range of
716f8af4da3SHugh Dickins	  memory available to the CPU. Enabled by default when HIGHMEM is
717ee65728eSMike Rapoport	  selected, but you may say n to override this.
718c73602adSHugh Dickins
719c73602adSHugh Dickinsconfig MMU_NOTIFIER
720f8af4da3SHugh Dickins	bool
721e0a94c2aSChristoph Lameter	select INTERVAL_TREE
722e0a94c2aSChristoph Lameter
7236e141546SDavid Howellsconfig KSM
724e0a94c2aSChristoph Lameter	bool "Enable KSM for page merging"
725e0a94c2aSChristoph Lameter	depends on MMU
726e0a94c2aSChristoph Lameter	select XXHASH
727e0a94c2aSChristoph Lameter	help
728e0a94c2aSChristoph Lameter	  Enable Kernel Samepage Merging: KSM periodically scans those areas
729e0a94c2aSChristoph Lameter	  of an application's address space that an app has advised may be
730e0a94c2aSChristoph Lameter	  mergeable.  When it finds pages of identical content, it replaces
731e0a94c2aSChristoph Lameter	  the many instances by a single page with that content, so
732e0a94c2aSChristoph Lameter	  saving memory until one or another app needs to modify the content.
733788084abSEric Paris	  Recommended for use with KVM, or with other duplicative applications.
734788084abSEric Paris	  See Documentation/mm/ksm.rst for more information: KSM is inactive
735788084abSEric Paris	  until a program has madvised that an area is MADV_MERGEABLE, and
736e0a94c2aSChristoph Lameter	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
737e0a94c2aSChristoph Lameter
738e0a94c2aSChristoph Lameterconfig DEFAULT_MMAP_MIN_ADDR
739e0a94c2aSChristoph Lameter	int "Low address space to protect from user allocation"
740d949f36fSLinus Torvalds	depends on MMU
741d949f36fSLinus Torvalds	default 4096
742e0a94c2aSChristoph Lameter	help
7436a46079cSAndi Kleen	  This is the portion of low virtual memory which should be protected
7446a46079cSAndi Kleen	  from userspace allocation.  Keeping a user from writing to low pages
745d949f36fSLinus Torvalds	  can help reduce the impact of kernel NULL pointer bugs.
7466a46079cSAndi Kleen
747ee6f509cSMinchan Kim	  For most ia64, ppc64 and x86 users with lots of address space
74897f0b134SXie XiuQi	  a value of 65536 is reasonable and should cause no problems.
7496a46079cSAndi Kleen	  On arm and other archs it should not be higher than 32768.
7506a46079cSAndi Kleen	  Programs which use vm86 functionality or have some need to map
7516a46079cSAndi Kleen	  this low address space will need CAP_SYS_RAWIO or disable this
7526a46079cSAndi Kleen	  protection by setting the value to 0.
7536a46079cSAndi Kleen
7546a46079cSAndi Kleen	  This value can be changed after boot using the
755cae681fcSAndi Kleen	  /proc/sys/vm/mmap_min_addr tunable.
756413f9efbSAndi Kleen
75727df5068SAndi Kleenconfig ARCH_SUPPORTS_MEMORY_FAILURE
758478c5ffcSWu Fengguang	bool
759cae681fcSAndi Kleen
760fc4d5c29SDavid Howellsconfig MEMORY_FAILURE
761fc4d5c29SDavid Howells	depends on MMU
762fc4d5c29SDavid Howells	depends on ARCH_SUPPORTS_MEMORY_FAILURE
763fc4d5c29SDavid Howells	bool "Enable recovery from hardware memory errors"
764fc4d5c29SDavid Howells	select MEMORY_ISOLATION
765fc4d5c29SDavid Howells	select RAS
766fc4d5c29SDavid Howells	help
767fc4d5c29SDavid Howells	  Enables code to recover from some memory failures on systems
768fc4d5c29SDavid Howells	  with MCA recovery. This allows a system to continue running
769fc4d5c29SDavid Howells	  even when some of its memory has uncorrected errors. This requires
770fc4d5c29SDavid Howells	  special hardware support and typically ECC memory.
771fc4d5c29SDavid Howells
772fc4d5c29SDavid Howellsconfig HWPOISON_INJECT
773fc4d5c29SDavid Howells	tristate "HWPoison pages injector"
774fc4d5c29SDavid Howells	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
775fc4d5c29SDavid Howells	select PROC_PAGE_MONITOR
776fc4d5c29SDavid Howells
777fc4d5c29SDavid Howellsconfig NOMMU_INITIAL_TRIM_EXCESS
778fc4d5c29SDavid Howells	int "Turn on mmap() excess space trimming before booting"
779fc4d5c29SDavid Howells	depends on !MMU
780fc4d5c29SDavid Howells	default 1
781fc4d5c29SDavid Howells	help
782fc4d5c29SDavid Howells	  The NOMMU mmap() frequently needs to allocate large contiguous chunks
783fc4d5c29SDavid Howells	  of memory on which to store mappings, but it can only ask the system
784fc4d5c29SDavid Howells	  allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
785fc4d5c29SDavid Howells	  more than it requires.  To deal with this, mmap() is able to trim off
786dd19d293SStephen Kitt	  the excess and return it to the allocator.
787bbddff05STejun Heo
788519bcb79SJohannes Weiner	  If trimming is enabled, the excess is trimmed off and returned to the
789519bcb79SJohannes Weiner	  system allocator, which can cause extra fragmentation, particularly
790519bcb79SJohannes Weiner	  if there are a lot of transient processes.
791519bcb79SJohannes Weiner
792519bcb79SJohannes Weiner	  If trimming is disabled, the excess is kept, but not used, which for
793519bcb79SJohannes Weiner	  long-term mappings means that the space is wasted.
794519bcb79SJohannes Weiner
79513ece886SAndrea Arcangeli	  Trimming can be dynamically controlled through a sysctl option
796554b0f3cSSebastian Andrzej Siewior	  (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
7975d689240SAndrea Arcangeli	  excess pages there must be before trimming should occur, or zero if
7983a08cd52SMatthew Wilcox	  no trimming is to occur.
7994c76d9d1SAndrea Arcangeli
8004c76d9d1SAndrea Arcangeli	  This option specifies the initial value of this option.  The default
8014c76d9d1SAndrea Arcangeli	  of 1 says that all excess pages should be trimmed.
8024c76d9d1SAndrea Arcangeli
8034c76d9d1SAndrea Arcangeli	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
8044c76d9d1SAndrea Arcangeli
8054c76d9d1SAndrea Arcangeliconfig ARCH_WANT_GENERAL_HUGETLB
8064c76d9d1SAndrea Arcangeli	bool
8074c76d9d1SAndrea Arcangeli
8084c76d9d1SAndrea Arcangeliconfig ARCH_WANTS_THP_SWAP
809519bcb79SJohannes Weiner	def_bool n
810519bcb79SJohannes Weiner
81113ece886SAndrea Arcangelimenuconfig TRANSPARENT_HUGEPAGE
81213ece886SAndrea Arcangeli	bool "Transparent Hugepage Support"
81313ece886SAndrea Arcangeli	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
81413ece886SAndrea Arcangeli	select COMPACTION
81513ece886SAndrea Arcangeli	select XARRAY_MULTI
81613ece886SAndrea Arcangeli	help
81713ece886SAndrea Arcangeli	  Transparent Hugepages allows the kernel to use huge pages and
81813ece886SAndrea Arcangeli	  huge tlb transparently to the applications whenever possible.
81913ece886SAndrea Arcangeli	  This feature can improve computing performance to certain
82013ece886SAndrea Arcangeli	  applications by speeding up page faults during memory
82113ece886SAndrea Arcangeli	  allocation, by reducing the number of tlb misses and by speeding
82213ece886SAndrea Arcangeli	  up the pagetable walking.
82313ece886SAndrea Arcangeli
82413ece886SAndrea Arcangeli	  If memory constrained on embedded, you may want to say N.
82513ece886SAndrea Arcangeli
82613ece886SAndrea Arcangeliif TRANSPARENT_HUGEPAGE
82713ece886SAndrea Arcangeli
82813ece886SAndrea Arcangelichoice
82913ece886SAndrea Arcangeli	prompt "Transparent Hugepage Support sysfs defaults"
83013ece886SAndrea Arcangeli	depends on TRANSPARENT_HUGEPAGE
83113ece886SAndrea Arcangeli	default TRANSPARENT_HUGEPAGE_ALWAYS
83213ece886SAndrea Arcangeli	help
83313ece886SAndrea Arcangeli	  Selects the sysfs defaults for Transparent Hugepage Support.
83413ece886SAndrea Arcangeli
83538d8b4e6SHuang Ying	config TRANSPARENT_HUGEPAGE_ALWAYS
83638d8b4e6SHuang Ying		bool "always"
837dad6a5ebSHugh Dickins	help
83838d8b4e6SHuang Ying	  Enabling Transparent Hugepage always, can increase the
83938d8b4e6SHuang Ying	  memory footprint of applications without a guaranteed
84014fef284SHuang Ying	  benefit but it will work automatically for all applications.
84114fef284SHuang Ying
84238d8b4e6SHuang Ying	config TRANSPARENT_HUGEPAGE_MADVISE
84338d8b4e6SHuang Ying		bool "madvise"
84438d8b4e6SHuang Ying	help
845519bcb79SJohannes Weiner	  Enabling Transparent Hugepage madvise, will only provide a
846519bcb79SJohannes Weiner	  performance improvement benefit to the applications using
847519bcb79SJohannes Weiner	  madvise(MADV_HUGEPAGE) but it won't risk to increase the
848519bcb79SJohannes Weiner	  memory footprint of applications without a guaranteed
849519bcb79SJohannes Weiner	  benefit.
850519bcb79SJohannes Weinerendchoice
851519bcb79SJohannes Weiner
852519bcb79SJohannes Weinerconfig THP_SWAP
853519bcb79SJohannes Weiner	def_bool y
854519bcb79SJohannes Weiner	depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT
855519bcb79SJohannes Weiner	help
856519bcb79SJohannes Weiner	  Swap transparent huge pages in one piece, without splitting.
857519bcb79SJohannes Weiner	  XXX: For now, swap cluster backing transparent huge page
858e496cf3dSKirill A. Shutemov	  will be split after swapout.
859bbddff05STejun Heo
860bbddff05STejun Heo	  For selection by architectures with reasonable THP sizes.
861bbddff05STejun Heo
8623583521aSVladimir Murzinconfig READ_ONLY_THP_FOR_FS
863bbddff05STejun Heo	bool "Read-only THP for filesystems (EXPERIMENTAL)"
864bbddff05STejun Heo	depends on TRANSPARENT_HUGEPAGE && SHMEM
865077b1f83SDan Magenheimer
8667ecd19cfSKefeng Wang	help
8677ecd19cfSKefeng Wang	  Allow khugepaged to put read-only file-backed pages in THP.
8687ecd19cfSKefeng Wang
8697ecd19cfSKefeng Wang	  This is marked experimental because it is a new feature. Write
8707ecd19cfSKefeng Wang	  support of file THPs will be developed in the next few release
8717ecd19cfSKefeng Wang	  cycles.
8727ecd19cfSKefeng Wang
8737ecd19cfSKefeng Wangendif # TRANSPARENT_HUGEPAGE
8747ecd19cfSKefeng Wang
8757ecd19cfSKefeng Wang#
8767ecd19cfSKefeng Wang# UP and nommu archs use km based percpu allocator
8777ecd19cfSKefeng Wang#
878f825c736SAneesh Kumar K.Vconfig NEED_PER_CPU_KM
879f825c736SAneesh Kumar K.V	depends on !SMP || !MMU
880aca52c39SMike Rapoport	bool
881f825c736SAneesh Kumar K.V	default y
882f825c736SAneesh Kumar K.V
883f825c736SAneesh Kumar K.Vconfig NEED_PER_CPU_EMBED_FIRST_CHUNK
884f825c736SAneesh Kumar K.V	bool
885f825c736SAneesh Kumar K.V
886f825c736SAneesh Kumar K.Vconfig NEED_PER_CPU_PAGE_FIRST_CHUNK
887f825c736SAneesh Kumar K.V	bool
888f825c736SAneesh Kumar K.V
889f825c736SAneesh Kumar K.Vconfig USE_PERCPU_NUMA_NODE_ID
890f825c736SAneesh Kumar K.V	bool
891f825c736SAneesh Kumar K.V
892f825c736SAneesh Kumar K.Vconfig HAVE_SETUP_PER_CPU_AREA
893f825c736SAneesh Kumar K.V	bool
894f825c736SAneesh Kumar K.V
895f825c736SAneesh Kumar K.Vconfig CMA
896f825c736SAneesh Kumar K.V	bool "Contiguous Memory Allocator"
897f825c736SAneesh Kumar K.V	depends on MMU
898f825c736SAneesh Kumar K.V	select MIGRATION
899f825c736SAneesh Kumar K.V	select MEMORY_ISOLATION
900f825c736SAneesh Kumar K.V	help
901bf550fc9SAlexander Graf	  This enables the Contiguous Memory Allocator which allows other
90228b24c1fSSasha Levin	  subsystems to allocate big physically-contiguous blocks of memory.
90328b24c1fSSasha Levin	  CMA reserves a region of memory and allows only movable pages to
90428b24c1fSSasha Levin	  be allocated from it. This way, the kernel can use the memory for
90528b24c1fSSasha Levin	  pagecache and when a subsystem requests for contiguous area, the
90628b24c1fSSasha Levin	  allocated pages are migrated away to serve the contiguous request.
90728b24c1fSSasha Levin
90843ca106fSMinchan Kim	  If unsure, say "n".
90943ca106fSMinchan Kim
91043ca106fSMinchan Kimconfig CMA_DEBUG
91143ca106fSMinchan Kim	bool "CMA debug messages (DEVELOPMENT)"
91243ca106fSMinchan Kim	depends on DEBUG_KERNEL && CMA
91343ca106fSMinchan Kim	help
91443ca106fSMinchan Kim	  Turns on debug messages in CMA.  This produces KERN_DEBUG
915a254129eSJoonsoo Kim	  messages for every CMA call as well as various messages while
916a254129eSJoonsoo Kim	  processing calls such as dma_alloc_from_contiguous().
917a254129eSJoonsoo Kim	  This option does not affect warning and error messages.
918b7176c26SBarry Song
919a254129eSJoonsoo Kimconfig CMA_DEBUGFS
920a254129eSJoonsoo Kim	bool "CMA debugfs interface"
921a254129eSJoonsoo Kim	depends on CMA && DEBUG_FS
922a254129eSJoonsoo Kim	help
923a254129eSJoonsoo Kim	  Turns on the DebugFS interface for CMA.
924a254129eSJoonsoo Kim
925b7176c26SBarry Songconfig CMA_SYSFS
926a254129eSJoonsoo Kim	bool "CMA information through sysfs interface"
927af8d417aSDan Streetman	depends on CMA && SYSFS
928af8d417aSDan Streetman	help
929af8d417aSDan Streetman	  This option exposes some sysfs attributes to get information
930af8d417aSDan Streetman	  from CMA.
9314e2e2770SSeth Jennings
932af8d417aSDan Streetmanconfig CMA_AREAS
933af8d417aSDan Streetman	int "Maximum count of the CMA areas"
934af8d417aSDan Streetman	depends on CMA
935af8d417aSDan Streetman	default 19 if NUMA
936af8d417aSDan Streetman	default 7
9371ad1335dSMike Rapoport	help
9384e2e2770SSeth Jennings	  CMA allows to create CMA areas for particular purpose, mainly,
9399e5c33d7SMark Salter	  used as device private area. This parameter sets the maximum
9409e5c33d7SMark Salter	  number of CMA area in the system.
941042d27acSHelge Deller
94222ee3ea5SHelge Deller	  If unsure, leave the default value "7" in UMA and "19" in NUMA.
94322ee3ea5SHelge Deller
94422ee3ea5SHelge Dellerconfig MEM_SOFT_DIRTY
945042d27acSHelge Deller	bool "Track memory changes"
946042d27acSHelge Deller	depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
947042d27acSHelge Deller	select PROC_PAGE_MONITOR
948042d27acSHelge Deller	help
949042d27acSHelge Deller	  This option enables memory changes tracking by introducing a
95022ee3ea5SHelge Deller	  soft-dirty bit on pte-s. This bit it set when someone writes
951042d27acSHelge Deller	  into a page just as regular dirty bit, but unlike the latter
95222ee3ea5SHelge Deller	  it can be cleared by hands.
9533a80a7faSMel Gorman
9543a80a7faSMel Gorman	  See Documentation/admin-guide/mm/soft-dirty.rst for more details.
9551ce22103SVlastimil Babka
956d39f8fb4SMike Rapoportconfig GENERIC_EARLY_IOREMAP
957ab1e8d89SPavel Tatashin	bool
958889c695dSPasha Tatashin
959e4443149SDaniel Jordanconfig STACK_MAX_DEFAULT_SIZE_MB
9603a80a7faSMel Gorman	int "Default maximum user stack size for 32-bit processes (MB)"
9613a80a7faSMel Gorman	default 100
9623a80a7faSMel Gorman	range 8 2048
9633a80a7faSMel Gorman	depends on STACK_GROWSUP && (!64BIT || COMPAT)
964e4443149SDaniel Jordan	help
965e4443149SDaniel Jordan	  This is the maximum stack size in Megabytes in the VM layout of 32-bit
9661ce22103SVlastimil Babka	  user processes when the stack grows upwards (currently only on parisc
9671ce22103SVlastimil Babka	  arch) when the RLIMIT_STACK hard limit is unlimited.
968033fbae9SDan Williams
9691c676e0dSSeongJae Park	  A sane initial value is 100 MB.
9701c676e0dSSeongJae Park
9711c676e0dSSeongJae Parkconfig DEFERRED_STRUCT_PAGE_INIT
9721c676e0dSSeongJae Park	bool "Defer initialisation of struct pages to kthreads"
9731c676e0dSSeongJae Park	depends on SPARSEMEM
9741c676e0dSSeongJae Park	depends on !NEED_PER_CPU_KM
9751c676e0dSSeongJae Park	depends on 64BIT
9761c676e0dSSeongJae Park	select PADATA
97733c3fc71SVladimir Davydov	help
97833c3fc71SVladimir Davydov	  Ordinarily all struct pages are initialised during early boot in a
97933c3fc71SVladimir Davydov	  single thread. On very large machines this can take a considerable
9801c676e0dSSeongJae Park	  amount of time. If this option is set, large machines will bring up
98133c3fc71SVladimir Davydov	  a subset of memmap at boot and then initialise the rest in parallel.
98233c3fc71SVladimir Davydov	  This has a potential performance impact on tasks running early in the
98333c3fc71SVladimir Davydov	  lifetime of the system until these kthreads finish the
98433c3fc71SVladimir Davydov	  initialisation.
98533c3fc71SVladimir Davydov
98633c3fc71SVladimir Davydovconfig PAGE_IDLE_FLAG
9871ad1335dSMike Rapoport	bool
9881ad1335dSMike Rapoport	select PAGE_EXTENSION if !64BIT
98933c3fc71SVladimir Davydov	help
990c2280be8SAnshuman Khandual	  This adds PG_idle and PG_young flags to 'struct page'.  PTE Accessed
991c2280be8SAnshuman Khandual	  bit writers can set the state of the bit in the flags so that PTE
992c2280be8SAnshuman Khandual	  Accessed bit readers may avoid disturbance.
9932792d84eSKees Cook
9942792d84eSKees Cookconfig IDLE_PAGE_TRACKING
9952792d84eSKees Cook	bool "Enable idle page tracking"
9962792d84eSKees Cook	depends on SYSFS && MMU
9972792d84eSKees Cook	select PAGE_IDLE_FLAG
9982792d84eSKees Cook	help
9992792d84eSKees Cook	  This feature allows to estimate the amount of user pages that have
10002792d84eSKees Cook	  not been touched during a given period of time. This information can
10012792d84eSKees Cook	  be useful to tune memory cgroup limits and/or for job placement
100217596731SRobin Murphy	  within a compute cluster.
100365f7d049SOliver O'Halloran
100465f7d049SOliver O'Halloran	  See Documentation/admin-guide/mm/idle_page_tracking.rst for
100563703f37SKefeng Wang	  more details.
100663703f37SKefeng Wang
100763703f37SKefeng Wangconfig ARCH_HAS_CACHE_LINE_SIZE
100863703f37SKefeng Wang	bool
100963703f37SKefeng Wang
101063703f37SKefeng Wangconfig ARCH_HAS_CURRENT_STACK_POINTER
101163703f37SKefeng Wang	bool
101263703f37SKefeng Wang	help
101363703f37SKefeng Wang	  In support of HARDENED_USERCOPY performing stack variable lifetime
101463703f37SKefeng Wang	  checking, an architecture-agnostic way to find the stack pointer
101563703f37SKefeng Wang	  is needed. Once an architecture defines an unsigned long global
101663703f37SKefeng Wang	  register alias named "current_stack_pointer", this config can be
1017033fbae9SDan Williams	  selected.
10185042db43SJérôme Glisse
1019033fbae9SDan Williamsconfig ARCH_HAS_PTE_DEVMAP
1020033fbae9SDan Williams	bool
102199490f16SDan Williams
102217596731SRobin Murphyconfig ARCH_HAS_ZONE_DMA_SET
10233a08cd52SMatthew Wilcox	bool
1024033fbae9SDan Williams
1025033fbae9SDan Williamsconfig ZONE_DMA
1026033fbae9SDan Williams	bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
1027033fbae9SDan Williams	default y if ARM64 || X86
1028033fbae9SDan Williams
1029033fbae9SDan Williamsconfig ZONE_DMA32
1030033fbae9SDan Williams	bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
1031033fbae9SDan Williams	depends on !X86_32
1032033fbae9SDan Williams	default y if ARM64
103306a660adSLinus Torvalds
10349c240a7bSChristoph Hellwigconfig ZONE_DEVICE
10359c240a7bSChristoph Hellwig	bool "Device memory (pmem, HMM, etc...) hotplug support"
10369c240a7bSChristoph Hellwig	depends on MEMORY_HOTPLUG
10379c240a7bSChristoph Hellwig	depends on MEMORY_HOTREMOVE
1038c0b12405SJérôme Glisse	depends on SPARSEMEM_VMEMMAP
10399c240a7bSChristoph Hellwig	depends on ARCH_HAS_PTE_DEVMAP
1040f442c283SChristoph Hellwig	select XARRAY_MULTI
1041c0b12405SJérôme Glisse
104214b80582SDan Williams	help
104314b80582SDan Williams	  Device memory hotplug support allows for establishing pmem,
104414b80582SDan Williams	  or other device driver discovered memory regions, in the
104514b80582SDan Williams	  memmap. This allows pfn_to_page() lookups of otherwise
10465042db43SJérôme Glisse	  "device-physical" addresses which is needed for using a DAX
10475042db43SJérôme Glisse	  mapping in an O_DIRECT operation, among other things.
10487328d9ccSChristoph Hellwig
104914b80582SDan Williams	  If FS_DAX is enabled, then say Y.
10505042db43SJérôme Glisse
10515042db43SJérôme Glisse#
10525042db43SJérôme Glisse# Helpers to mirror range of the CPU page tables of a process into device page
10535042db43SJérôme Glisse# tables.
10545042db43SJérôme Glisse#
10555042db43SJérôme Glisseconfig HMM_MIRROR
10563e9a9e25SChristoph Hellwig	bool
10573e9a9e25SChristoph Hellwig	depends on MMU
10583e9a9e25SChristoph Hellwig
105963c17fb8SDave Hansenconfig GET_FREE_REGION
106063c17fb8SDave Hansen	depends on SPARSEMEM
106166d37570SDave Hansen	bool
106266d37570SDave Hansen
106330a5b536SDennis Zhouconfig DEVICE_PRIVATE
1064b0284cd2SCatalin Marinas	bool "Unaddressable device memory (GPU memory, ...)"
1065b0284cd2SCatalin Marinas	depends on ZONE_DEVICE
1066b0284cd2SCatalin Marinas	select GET_FREE_REGION
1067b0284cd2SCatalin Marinas
1068b0284cd2SCatalin Marinas	help
1069b0284cd2SCatalin Marinas	  Allows creation of struct pages to represent unaddressable device
1070b0284cd2SCatalin Marinas	  memory; i.e., memory that is only accessible from the device (or
1071b0284cd2SCatalin Marinas	  group of devices). You likely also want to select HMM_MIRROR.
10720710d012SVlastimil Babka
10730710d012SVlastimil Babkaconfig VMAP_PFN
10740710d012SVlastimil Babka	bool
10750710d012SVlastimil Babka
10760710d012SVlastimil Babkaconfig ARCH_USES_HIGH_VMA_FLAGS
10770710d012SVlastimil Babka	bool
10780710d012SVlastimil Babkaconfig ARCH_HAS_PKEYS
10790710d012SVlastimil Babka	bool
10800710d012SVlastimil Babka
108130a5b536SDennis Zhouconfig ARCH_USES_PG_ARCH_X
108230a5b536SDennis Zhou	bool
108330a5b536SDennis Zhou	help
108430a5b536SDennis Zhou	  Enable the definition of PG_arch_x page flags with x > 1. Only
108530a5b536SDennis Zhou	  suitable for 64-bit architectures with CONFIG_FLATMEM or
108630a5b536SDennis Zhou	  CONFIG_SPARSEMEM_VMEMMAP enabled, otherwise there may not be
108764c349f4SKirill A. Shutemov	  enough room for additional bits in page->flags.
10889c84f229SJohn Hubbard
10899c84f229SJohn Hubbardconfig VM_EVENT_COUNTERS
1090d0de8241SBarry Song	default y
109164c349f4SKirill A. Shutemov	bool "Enable VM event counters for /proc/vmstat" if EXPERT
10929c84f229SJohn Hubbard	help
10939c84f229SJohn Hubbard	  VM event counters are needed for event counts to be shown.
10949c84f229SJohn Hubbard	  This option allows the disabling of the VM event counters
109564c349f4SKirill A. Shutemov	  on EXPERT systems.  /proc/vmstat will only show page counts
10969c84f229SJohn Hubbard	  if VM event counters are disabled.
10979c84f229SJohn Hubbard
10989c84f229SJohn Hubbardconfig PERCPU_STATS
10999c84f229SJohn Hubbard	bool "Collect percpu memory statistics"
1100f4f9bda4SJohn Hubbard	help
1101f4f9bda4SJohn Hubbard	  This feature collects and exposes statistics via debugfs. The
1102f4f9bda4SJohn Hubbard	  information includes global and per chunk statistics, which can
1103f4f9bda4SJohn Hubbard	  be used to help understand percpu memory usage.
1104f4f9bda4SJohn Hubbard
1105f4f9bda4SJohn Hubbardconfig GUP_TEST
1106baa489faSSeongJae Park	bool "Enable infrastructure for get_user_pages()-related unit tests"
11073010a5eaSLaurent Dufour	depends on DEBUG_FS
1108d0de8241SBarry Song	help
1109d0de8241SBarry Song	  Provides /sys/kernel/debug/gup_test, which in turn provides a way
11103010a5eaSLaurent Dufour	  to make ioctl calls that can launch kernel-based unit tests for
11116ca297d4SPeter Zijlstra	  the get_user_pages*() and pin_user_pages*() family of API calls.
111239656e83SChristoph Hellwig
111339656e83SChristoph Hellwig	  These tests include benchmark testing of the _fast variants of
1114def85743SKeith Busch	  get_user_pages*() and pin_user_pages*(), as well as smoke tests of
1115def85743SKeith Busch	  the non-_fast variants.
1116def85743SKeith Busch
1117def85743SKeith Busch	  There is also a sub-test that allows running dump_page() on any
1118def85743SKeith Busch	  of up to eight pages (selected by command line args) within the
1119def85743SKeith Busch	  range of user-space addresses. These pages are either pinned via
1120def85743SKeith Busch	  pin_user_pages*(), or pinned via get_user_pages*(), as specified
1121def85743SKeith Busch	  by other command line arguments.
1122def85743SKeith Busch
11233010a5eaSLaurent Dufour	  See tools/testing/selftests/mm/gup_test.c
11243010a5eaSLaurent Dufour
112559e0b520SChristoph Hellwigcomment "GUP_TEST needs to have DEBUG_FS enabled"
1126cbd34da7SChristoph Hellwig	depends on !GUP_TEST && !DEBUG_FS
1127cbd34da7SChristoph Hellwig
1128cbd34da7SChristoph Hellwigconfig GUP_GET_PXX_LOW_HIGH
1129cbd34da7SChristoph Hellwig	bool
1130cbd34da7SChristoph Hellwig
1131cbd34da7SChristoph Hellwigconfig DMAPOOL_TEST
1132cbd34da7SChristoph Hellwig	tristate "Enable a module to run time tests on dma_pool"
1133cbd34da7SChristoph Hellwig	depends on HAS_DMA
1134cbd34da7SChristoph Hellwig	help
1135cbd34da7SChristoph Hellwig	  Provides a test module that will allocate and free many blocks of
1136c5acad84SThomas Hellstrom	  various sizes and report how long it takes. This is intended to
1137c5acad84SThomas Hellstrom	  provide a consistent way to measure how changes to the
1138c5acad84SThomas Hellstrom	  dma_pool_alloc/free routines affect performance.
1139298fa1adSThomas Gleixner
1140298fa1adSThomas Gleixnerconfig ARCH_HAS_PTE_SPECIAL
1141298fa1adSThomas Gleixner	bool
1142825c43f5SArd Biesheuvel
1143825c43f5SArd Biesheuvel#
1144825c43f5SArd Biesheuvel# Some architectures require a special hugepage directory format that is
11451fbaf8fcSChristoph Hellwig# required to support multiple hugepage sizes. For example a4fe3ce76
11461fbaf8fcSChristoph Hellwig# "powerpc/mm: Allow more flexible layouts for hugepage pagetables"
11471fbaf8fcSChristoph Hellwig# introduced it on powerpc.  This allows for a more flexible hugepage
11481507f512SMike Rapoport# pagetable layouts.
1149626e98cbSThomas Weißschuh#
1150626e98cbSThomas Weißschuhconfig ARCH_HAS_HUGEPD
1151626e98cbSThomas Weißschuh	bool
11521507f512SMike Rapoport
115374947724SLukas Bulwahnconfig MAPPING_DIRTY_HELPERS
115474947724SLukas Bulwahn        bool
115574947724SLukas Bulwahn
115674947724SLukas Bulwahnconfig KMAP_LOCAL
115774947724SLukas Bulwahn	bool
115874947724SLukas Bulwahn
115974947724SLukas Bulwahnconfig KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
11601507f512SMike Rapoport	bool
11619a10064fSColin Cross
11629a10064fSColin Cross# struct io_mapping based helper.  Selected by drivers that need them
11639a10064fSColin Crossconfig IO_MAPPING
11649a10064fSColin Cross	bool
11659a10064fSColin Cross
11669a10064fSColin Crossconfig MEMFD_CREATE
11679a10064fSColin Cross	bool "Enable memfd_create() system call" if EXPERT
11689a10064fSColin Cross
11699a10064fSColin Crossconfig SECRETMEM
11709a10064fSColin Cross	default y
11719a10064fSColin Cross	bool "Enable memfd_secret() system call" if EXPERT
11729a10064fSColin Cross	depends on ARCH_HAS_SET_DIRECT_MAP
11739a10064fSColin Cross	help
11749a10064fSColin Cross	  Enable the memfd_secret() system call with the ability to create
1175430529b5SPeter Xu	  memory areas visible only in the context of the owning process and
1176430529b5SPeter Xu	  not mapped to other processes and other kernel page tables.
1177430529b5SPeter Xu
1178430529b5SPeter Xuconfig ANON_VMA_NAME
1179430529b5SPeter Xu	bool "Anonymous VMA name support"
1180430529b5SPeter Xu	depends on PROC_FS && ADVISE_SYSCALLS && MMU
1181430529b5SPeter Xu
1182430529b5SPeter Xu	help
1183430529b5SPeter Xu	  Allow naming anonymous virtual memory areas.
1184430529b5SPeter Xu
1185430529b5SPeter Xu	  This feature allows assigning names to virtual memory areas. Assigned
1186430529b5SPeter Xu	  names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
1187430529b5SPeter Xu	  and help identifying individual anonymous memory areas.
1188430529b5SPeter Xu	  Assigning a name to anonymous virtual memory area might prevent that
1189430529b5SPeter Xu	  area from being merged with adjacent virtual memory areas due to the
1190430529b5SPeter Xu	  difference in their name.
1191430529b5SPeter Xu
11921db9dbc2SPeter Xuconfig USERFAULTFD
119381e0f15fSPeter Xu	bool "Enable userfaultfd() system call"
119481e0f15fSPeter Xu	depends on MMU
119581e0f15fSPeter Xu	help
11961db9dbc2SPeter Xu	  Enable the userfaultfd() system call that allows to intercept and
11971db9dbc2SPeter Xu	  handle page faults in userland.
11981db9dbc2SPeter Xu
11991db9dbc2SPeter Xuconfig HAVE_ARCH_USERFAULTFD_WP
12001db9dbc2SPeter Xu	bool
12011db9dbc2SPeter Xu	help
1202ac35a490SYu Zhao	  Arch has userfaultfd write protection support
1203ec1c86b2SYu Zhao
1204ec1c86b2SYu Zhaoconfig HAVE_ARCH_USERFAULTFD_MINOR
1205ec1c86b2SYu Zhao	bool
1206ec1c86b2SYu Zhao	help
1207ec1c86b2SYu Zhao	  Arch has userfaultfd minor fault support
1208ec1c86b2SYu Zhao
120907017acbSYu Zhaoconfig PTE_MARKER_UFFD_WP
121007017acbSYu Zhao	bool "Userfaultfd write protection support for shmem/hugetlbfs"
1211ec1c86b2SYu Zhao	default y
1212354ed597SYu Zhao	depends on HAVE_ARCH_USERFAULTFD_WP
1213354ed597SYu Zhao
1214354ed597SYu Zhao	help
1215354ed597SYu Zhao	  Allows to create marker PTEs for userfaultfd write protection
1216354ed597SYu Zhao	  purposes.  It is required to enable userfaultfd write protection on
1217354ed597SYu Zhao	  file-backed memory types like shmem and hugetlbfs.
1218ac35a490SYu Zhao
1219ac35a490SYu Zhao# multi-gen LRU {
1220ac35a490SYu Zhaoconfig LRU_GEN
1221ac35a490SYu Zhao	bool "Multi-Gen LRU"
1222ac35a490SYu Zhao	depends on MMU
1223ac35a490SYu Zhao	# make sure folio->flags has enough spare bits
1224ac35a490SYu Zhao	depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
1225ac35a490SYu Zhao	help
1226ac35a490SYu Zhao	  A high performance LRU implementation to overcommit memory. See
1227ac35a490SYu Zhao	  Documentation/admin-guide/mm/multigen_lru.rst for details.
12280b6cc04fSSuren Baghdasaryan
12290b6cc04fSSuren Baghdasaryanconfig LRU_GEN_ENABLED
12300b6cc04fSSuren Baghdasaryan	bool "Enable by default"
12310b6cc04fSSuren Baghdasaryan	depends on LRU_GEN
12320b6cc04fSSuren Baghdasaryan	help
12330b6cc04fSSuren Baghdasaryan	  This option enables the multi-gen LRU by default.
12340b6cc04fSSuren Baghdasaryan
12350b6cc04fSSuren Baghdasaryanconfig LRU_GEN_STATS
12360b6cc04fSSuren Baghdasaryan	bool "Full stats for debugging"
12370b6cc04fSSuren Baghdasaryan	depends on LRU_GEN
12380b6cc04fSSuren Baghdasaryan	help
12390b6cc04fSSuren Baghdasaryan	  Do not enable this option unless you plan to look at historical stats
1240c2508ec5SLinus Torvalds	  from evicted generations for debugging purpose.
1241c2508ec5SLinus Torvalds
1242c2508ec5SLinus Torvalds	  This option has a per-memcg and per-node memory overhead.
1243c2508ec5SLinus Torvalds# }
12442224d848SSeongJae Park
12452224d848SSeongJae Parkconfig ARCH_SUPPORTS_PER_VMA_LOCK
124659e0b520SChristoph Hellwig       def_bool n
1247
1248config PER_VMA_LOCK
1249	def_bool y
1250	depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP
1251	help
1252	  Allow per-vma locking during page fault handling.
1253
1254	  This feature allows locking each virtual memory area separately when
1255	  handling page faults instead of taking mmap_lock.
1256
1257config LOCK_MM_AND_FIND_VMA
1258	bool
1259	depends on !STACK_GROWSUP
1260
1261source "mm/damon/Kconfig"
1262
1263endmenu
1264