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