xref: /linux/mm/Kconfig (revision eb07c4f39c3e858a7d0cc4bb15b8a304f83f0497)
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
28519bcb79SJohannes Weiner	select FRONTSWAP
29b3fbd58fSJohannes Weiner	select CRYPTO
30519bcb79SJohannes Weiner	select ZPOOL
31519bcb79SJohannes Weiner	help
32519bcb79SJohannes Weiner	  A lightweight compressed cache for swap pages.  It takes
33519bcb79SJohannes Weiner	  pages that are in the process of being swapped out and attempts to
34519bcb79SJohannes Weiner	  compress them into a dynamically allocated RAM-based memory pool.
35519bcb79SJohannes Weiner	  This can result in a significant I/O reduction on swap device and,
361a44131dSSophia Gabriella	  in the case where decompressing from RAM is faster than swap device
37519bcb79SJohannes Weiner	  reads, can also improve workload performance.
38519bcb79SJohannes Weiner
39b3fbd58fSJohannes Weinerconfig ZSWAP_DEFAULT_ON
40b3fbd58fSJohannes Weiner	bool "Enable the compressed cache for swap pages by default"
41b3fbd58fSJohannes Weiner	depends on ZSWAP
42b3fbd58fSJohannes Weiner	help
43b3fbd58fSJohannes Weiner	  If selected, the compressed cache for swap pages will be enabled
44b3fbd58fSJohannes Weiner	  at boot, otherwise it will be disabled.
45b3fbd58fSJohannes Weiner
46b3fbd58fSJohannes Weiner	  The selection made here can be overridden by using the kernel
47b3fbd58fSJohannes Weiner	  command line 'zswap.enabled=' option.
48b3fbd58fSJohannes Weiner
49519bcb79SJohannes Weinerchoice
50b3fbd58fSJohannes Weiner	prompt "Default compressor"
51519bcb79SJohannes Weiner	depends on ZSWAP
52519bcb79SJohannes Weiner	default ZSWAP_COMPRESSOR_DEFAULT_LZO
53519bcb79SJohannes Weiner	help
54519bcb79SJohannes Weiner	  Selects the default compression algorithm for the compressed cache
55519bcb79SJohannes Weiner	  for swap pages.
56519bcb79SJohannes Weiner
57519bcb79SJohannes Weiner	  For an overview what kind of performance can be expected from
58519bcb79SJohannes Weiner	  a particular compression algorithm please refer to the benchmarks
59519bcb79SJohannes Weiner	  available at the following LWN page:
60519bcb79SJohannes Weiner	  https://lwn.net/Articles/751795/
61519bcb79SJohannes Weiner
62519bcb79SJohannes Weiner	  If in doubt, select 'LZO'.
63519bcb79SJohannes Weiner
64519bcb79SJohannes Weiner	  The selection made here can be overridden by using the kernel
65519bcb79SJohannes Weiner	  command line 'zswap.compressor=' option.
66519bcb79SJohannes Weiner
67519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
68519bcb79SJohannes Weiner	bool "Deflate"
69519bcb79SJohannes Weiner	select CRYPTO_DEFLATE
70519bcb79SJohannes Weiner	help
71519bcb79SJohannes Weiner	  Use the Deflate algorithm as the default compression algorithm.
72519bcb79SJohannes Weiner
73519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZO
74519bcb79SJohannes Weiner	bool "LZO"
75519bcb79SJohannes Weiner	select CRYPTO_LZO
76519bcb79SJohannes Weiner	help
77519bcb79SJohannes Weiner	  Use the LZO algorithm as the default compression algorithm.
78519bcb79SJohannes Weiner
79519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_842
80519bcb79SJohannes Weiner	bool "842"
81519bcb79SJohannes Weiner	select CRYPTO_842
82519bcb79SJohannes Weiner	help
83519bcb79SJohannes Weiner	  Use the 842 algorithm as the default compression algorithm.
84519bcb79SJohannes Weiner
85519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4
86519bcb79SJohannes Weiner	bool "LZ4"
87519bcb79SJohannes Weiner	select CRYPTO_LZ4
88519bcb79SJohannes Weiner	help
89519bcb79SJohannes Weiner	  Use the LZ4 algorithm as the default compression algorithm.
90519bcb79SJohannes Weiner
91519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
92519bcb79SJohannes Weiner	bool "LZ4HC"
93519bcb79SJohannes Weiner	select CRYPTO_LZ4HC
94519bcb79SJohannes Weiner	help
95519bcb79SJohannes Weiner	  Use the LZ4HC algorithm as the default compression algorithm.
96519bcb79SJohannes Weiner
97519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_ZSTD
98519bcb79SJohannes Weiner	bool "zstd"
99519bcb79SJohannes Weiner	select CRYPTO_ZSTD
100519bcb79SJohannes Weiner	help
101519bcb79SJohannes Weiner	  Use the zstd algorithm as the default compression algorithm.
102519bcb79SJohannes Weinerendchoice
103519bcb79SJohannes Weiner
104519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT
105519bcb79SJohannes Weiner       string
106519bcb79SJohannes Weiner       depends on ZSWAP
107519bcb79SJohannes Weiner       default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
108519bcb79SJohannes Weiner       default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
109519bcb79SJohannes Weiner       default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
110519bcb79SJohannes Weiner       default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
111519bcb79SJohannes Weiner       default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
112519bcb79SJohannes Weiner       default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
113519bcb79SJohannes Weiner       default ""
114519bcb79SJohannes Weiner
115519bcb79SJohannes Weinerchoice
116b3fbd58fSJohannes Weiner	prompt "Default allocator"
117519bcb79SJohannes Weiner	depends on ZSWAP
118519bcb79SJohannes Weiner	default ZSWAP_ZPOOL_DEFAULT_ZBUD
119519bcb79SJohannes Weiner	help
120519bcb79SJohannes Weiner	  Selects the default allocator for the compressed cache for
121519bcb79SJohannes Weiner	  swap pages.
122519bcb79SJohannes Weiner	  The default is 'zbud' for compatibility, however please do
123519bcb79SJohannes Weiner	  read the description of each of the allocators below before
124519bcb79SJohannes Weiner	  making a right choice.
125519bcb79SJohannes Weiner
126519bcb79SJohannes Weiner	  The selection made here can be overridden by using the kernel
127519bcb79SJohannes Weiner	  command line 'zswap.zpool=' option.
128519bcb79SJohannes Weiner
129519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_ZBUD
130519bcb79SJohannes Weiner	bool "zbud"
131519bcb79SJohannes Weiner	select ZBUD
132519bcb79SJohannes Weiner	help
133519bcb79SJohannes Weiner	  Use the zbud allocator as the default allocator.
134519bcb79SJohannes Weiner
135519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_Z3FOLD
136519bcb79SJohannes Weiner	bool "z3fold"
137519bcb79SJohannes Weiner	select Z3FOLD
138519bcb79SJohannes Weiner	help
139519bcb79SJohannes Weiner	  Use the z3fold allocator as the default allocator.
140519bcb79SJohannes Weiner
141519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
142519bcb79SJohannes Weiner	bool "zsmalloc"
143519bcb79SJohannes Weiner	select ZSMALLOC
144519bcb79SJohannes Weiner	help
145519bcb79SJohannes Weiner	  Use the zsmalloc allocator as the default allocator.
146519bcb79SJohannes Weinerendchoice
147519bcb79SJohannes Weiner
148519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT
149519bcb79SJohannes Weiner       string
150519bcb79SJohannes Weiner       depends on ZSWAP
151519bcb79SJohannes Weiner       default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD
152519bcb79SJohannes Weiner       default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD
153519bcb79SJohannes Weiner       default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
154519bcb79SJohannes Weiner       default ""
155519bcb79SJohannes Weiner
156519bcb79SJohannes Weinerconfig ZBUD
157b3fbd58fSJohannes Weiner	tristate "2:1 compression allocator (zbud)"
158b3fbd58fSJohannes Weiner	depends on ZSWAP
159519bcb79SJohannes Weiner	help
160519bcb79SJohannes Weiner	  A special purpose allocator for storing compressed pages.
161519bcb79SJohannes Weiner	  It is designed to store up to two compressed pages per physical
162519bcb79SJohannes Weiner	  page.  While this design limits storage density, it has simple and
163519bcb79SJohannes Weiner	  deterministic reclaim properties that make it preferable to a higher
164519bcb79SJohannes Weiner	  density approach when reclaim will be used.
165519bcb79SJohannes Weiner
166519bcb79SJohannes Weinerconfig Z3FOLD
167b3fbd58fSJohannes Weiner	tristate "3:1 compression allocator (z3fold)"
168b3fbd58fSJohannes Weiner	depends on ZSWAP
169519bcb79SJohannes Weiner	help
170519bcb79SJohannes Weiner	  A special purpose allocator for storing compressed pages.
171519bcb79SJohannes Weiner	  It is designed to store up to three compressed pages per physical
172519bcb79SJohannes Weiner	  page. It is a ZBUD derivative so the simplicity and determinism are
173519bcb79SJohannes Weiner	  still there.
174519bcb79SJohannes Weiner
175519bcb79SJohannes Weinerconfig ZSMALLOC
176b3fbd58fSJohannes Weiner	tristate
177b3fbd58fSJohannes Weiner	prompt "N:1 compression allocator (zsmalloc)" if ZSWAP
178519bcb79SJohannes Weiner	depends on MMU
179519bcb79SJohannes Weiner	help
180519bcb79SJohannes Weiner	  zsmalloc is a slab-based memory allocator designed to store
181b3fbd58fSJohannes Weiner	  pages of various compression levels efficiently. It achieves
182b3fbd58fSJohannes Weiner	  the highest storage density with the least amount of fragmentation.
183519bcb79SJohannes Weiner
184519bcb79SJohannes Weinerconfig ZSMALLOC_STAT
185519bcb79SJohannes Weiner	bool "Export zsmalloc statistics"
186519bcb79SJohannes Weiner	depends on ZSMALLOC
187519bcb79SJohannes Weiner	select DEBUG_FS
188519bcb79SJohannes Weiner	help
189519bcb79SJohannes Weiner	  This option enables code in the zsmalloc to collect various
190519bcb79SJohannes Weiner	  statistics about what's happening in zsmalloc and exports that
191519bcb79SJohannes Weiner	  information to userspace via debugfs.
192519bcb79SJohannes Weiner	  If unsure, say N.
193519bcb79SJohannes Weiner
1944ff93b29SSergey Senozhatskyconfig ZSMALLOC_CHAIN_SIZE
1954ff93b29SSergey Senozhatsky	int "Maximum number of physical pages per-zspage"
196b46402faSSergey Senozhatsky	default 8
1974ff93b29SSergey Senozhatsky	range 4 16
1984ff93b29SSergey Senozhatsky	depends on ZSMALLOC
1994ff93b29SSergey Senozhatsky	help
2004ff93b29SSergey Senozhatsky	  This option sets the upper limit on the number of physical pages
2014ff93b29SSergey Senozhatsky	  that a zmalloc page (zspage) can consist of. The optimal zspage
2024ff93b29SSergey Senozhatsky	  chain size is calculated for each size class during the
2034ff93b29SSergey Senozhatsky	  initialization of the pool.
2044ff93b29SSergey Senozhatsky
2054ff93b29SSergey Senozhatsky	  Changing this option can alter the characteristics of size classes,
2064ff93b29SSergey Senozhatsky	  such as the number of pages per zspage and the number of objects
2074ff93b29SSergey Senozhatsky	  per zspage. This can also result in different configurations of
2084ff93b29SSergey Senozhatsky	  the pool, as zsmalloc merges size classes with similar
2094ff93b29SSergey Senozhatsky	  characteristics.
2104ff93b29SSergey Senozhatsky
2114ff93b29SSergey Senozhatsky	  For more information, see zsmalloc documentation.
2124ff93b29SSergey Senozhatsky
213519bcb79SJohannes Weinermenu "SLAB allocator options"
214519bcb79SJohannes Weiner
2157b42f104SJohannes Weinerchoice
2167b42f104SJohannes Weiner	prompt "Choose SLAB allocator"
2177b42f104SJohannes Weiner	default SLUB
2187b42f104SJohannes Weiner	help
2197b42f104SJohannes Weiner	   This option allows to select a slab allocator.
2207b42f104SJohannes Weiner
221*eb07c4f3SVlastimil Babkaconfig SLAB_DEPRECATED
222*eb07c4f3SVlastimil Babka	bool "SLAB (DEPRECATED)"
2237b42f104SJohannes Weiner	depends on !PREEMPT_RT
2247b42f104SJohannes Weiner	select HAVE_HARDENED_USERCOPY_ALLOCATOR
2257b42f104SJohannes Weiner	help
226*eb07c4f3SVlastimil Babka	  Deprecated and scheduled for removal in a few cycles. Replaced by
227*eb07c4f3SVlastimil Babka	  SLUB.
228*eb07c4f3SVlastimil Babka
229*eb07c4f3SVlastimil Babka	  If you cannot migrate to SLUB, please contact linux-mm@kvack.org
230*eb07c4f3SVlastimil Babka	  and the people listed in the SLAB ALLOCATOR section of MAINTAINERS
231*eb07c4f3SVlastimil Babka	  file, explaining why.
232*eb07c4f3SVlastimil Babka
2337b42f104SJohannes Weiner	  The regular slab allocator that is established and known to work
2347b42f104SJohannes Weiner	  well in all environments. It organizes cache hot objects in
2357b42f104SJohannes Weiner	  per cpu and per node queues.
2367b42f104SJohannes Weiner
2377b42f104SJohannes Weinerconfig SLUB
2387b42f104SJohannes Weiner	bool "SLUB (Unqueued Allocator)"
2397b42f104SJohannes Weiner	select HAVE_HARDENED_USERCOPY_ALLOCATOR
2407b42f104SJohannes Weiner	help
2417b42f104SJohannes Weiner	   SLUB is a slab allocator that minimizes cache line usage
2427b42f104SJohannes Weiner	   instead of managing queues of cached objects (SLAB approach).
2437b42f104SJohannes Weiner	   Per cpu caching is realized using slabs of objects instead
2447b42f104SJohannes Weiner	   of queues of objects. SLUB can use memory efficiently
2457b42f104SJohannes Weiner	   and has enhanced diagnostics. SLUB is the default choice for
2467b42f104SJohannes Weiner	   a slab allocator.
2477b42f104SJohannes Weiner
2487b42f104SJohannes Weinerendchoice
2497b42f104SJohannes Weiner
250*eb07c4f3SVlastimil Babkaconfig SLAB
251*eb07c4f3SVlastimil Babka	bool
252*eb07c4f3SVlastimil Babka	default y
253*eb07c4f3SVlastimil Babka	depends on SLAB_DEPRECATED
254*eb07c4f3SVlastimil Babka
255e240e53aSVlastimil Babkaconfig SLUB_TINY
256e240e53aSVlastimil Babka	bool "Configure SLUB for minimal memory footprint"
257e240e53aSVlastimil Babka	depends on SLUB && EXPERT
258e240e53aSVlastimil Babka	select SLAB_MERGE_DEFAULT
259e240e53aSVlastimil Babka	help
260e240e53aSVlastimil Babka	   Configures the SLUB allocator in a way to achieve minimal memory
261e240e53aSVlastimil Babka	   footprint, sacrificing scalability, debugging and other features.
262e240e53aSVlastimil Babka	   This is intended only for the smallest system that had used the
263e240e53aSVlastimil Babka	   SLOB allocator and is not recommended for systems with more than
264e240e53aSVlastimil Babka	   16MB RAM.
265e240e53aSVlastimil Babka
266e240e53aSVlastimil Babka	   If unsure, say N.
267e240e53aSVlastimil Babka
2687b42f104SJohannes Weinerconfig SLAB_MERGE_DEFAULT
2697b42f104SJohannes Weiner	bool "Allow slab caches to be merged"
2707b42f104SJohannes Weiner	default y
2717b42f104SJohannes Weiner	depends on SLAB || SLUB
2727b42f104SJohannes Weiner	help
2737b42f104SJohannes Weiner	  For reduced kernel memory fragmentation, slab caches can be
2747b42f104SJohannes Weiner	  merged when they share the same size and other characteristics.
2757b42f104SJohannes Weiner	  This carries a risk of kernel heap overflows being able to
2767b42f104SJohannes Weiner	  overwrite objects from merged caches (and more easily control
2777b42f104SJohannes Weiner	  cache layout), which makes such heap attacks easier to exploit
2787b42f104SJohannes Weiner	  by attackers. By keeping caches unmerged, these kinds of exploits
2797b42f104SJohannes Weiner	  can usually only damage objects in the same cache. To disable
2807b42f104SJohannes Weiner	  merging at runtime, "slab_nomerge" can be passed on the kernel
2817b42f104SJohannes Weiner	  command line.
2827b42f104SJohannes Weiner
2837b42f104SJohannes Weinerconfig SLAB_FREELIST_RANDOM
2847b42f104SJohannes Weiner	bool "Randomize slab freelist"
285e240e53aSVlastimil Babka	depends on SLAB || (SLUB && !SLUB_TINY)
2867b42f104SJohannes Weiner	help
2877b42f104SJohannes Weiner	  Randomizes the freelist order used on creating new pages. This
2887b42f104SJohannes Weiner	  security feature reduces the predictability of the kernel slab
2897b42f104SJohannes Weiner	  allocator against heap overflows.
2907b42f104SJohannes Weiner
2917b42f104SJohannes Weinerconfig SLAB_FREELIST_HARDENED
2927b42f104SJohannes Weiner	bool "Harden slab freelist metadata"
293e240e53aSVlastimil Babka	depends on SLAB || (SLUB && !SLUB_TINY)
2947b42f104SJohannes Weiner	help
2957b42f104SJohannes Weiner	  Many kernel heap attacks try to target slab cache metadata and
2967b42f104SJohannes Weiner	  other infrastructure. This options makes minor performance
2977b42f104SJohannes Weiner	  sacrifices to harden the kernel slab allocator against common
2987b42f104SJohannes Weiner	  freelist exploit methods. Some slab implementations have more
2997b42f104SJohannes Weiner	  sanity-checking than others. This option is most effective with
3007b42f104SJohannes Weiner	  CONFIG_SLUB.
3017b42f104SJohannes Weiner
3020710d012SVlastimil Babkaconfig SLUB_STATS
3030710d012SVlastimil Babka	default n
3040710d012SVlastimil Babka	bool "Enable SLUB performance statistics"
305e240e53aSVlastimil Babka	depends on SLUB && SYSFS && !SLUB_TINY
3060710d012SVlastimil Babka	help
3070710d012SVlastimil Babka	  SLUB statistics are useful to debug SLUBs allocation behavior in
3080710d012SVlastimil Babka	  order find ways to optimize the allocator. This should never be
3090710d012SVlastimil Babka	  enabled for production use since keeping statistics slows down
3100710d012SVlastimil Babka	  the allocator by a few percentage points. The slabinfo command
3110710d012SVlastimil Babka	  supports the determination of the most active slabs to figure
3120710d012SVlastimil Babka	  out which slabs are relevant to a particular load.
3130710d012SVlastimil Babka	  Try running: slabinfo -DA
3140710d012SVlastimil Babka
315519bcb79SJohannes Weinerconfig SLUB_CPU_PARTIAL
316519bcb79SJohannes Weiner	default y
317e240e53aSVlastimil Babka	depends on SLUB && SMP && !SLUB_TINY
318519bcb79SJohannes Weiner	bool "SLUB per cpu partial cache"
319519bcb79SJohannes Weiner	help
320519bcb79SJohannes Weiner	  Per cpu partial caches accelerate objects allocation and freeing
321519bcb79SJohannes Weiner	  that is local to a processor at the price of more indeterminism
322519bcb79SJohannes Weiner	  in the latency of the free. On overflow these caches will be cleared
323519bcb79SJohannes Weiner	  which requires the taking of locks that may cause latency spikes.
324519bcb79SJohannes Weiner	  Typically one would choose no for a realtime system.
325519bcb79SJohannes Weiner
326519bcb79SJohannes Weinerendmenu # SLAB allocator options
327519bcb79SJohannes Weiner
3287b42f104SJohannes Weinerconfig SHUFFLE_PAGE_ALLOCATOR
3297b42f104SJohannes Weiner	bool "Page allocator randomization"
3307b42f104SJohannes Weiner	default SLAB_FREELIST_RANDOM && ACPI_NUMA
3317b42f104SJohannes Weiner	help
3327b42f104SJohannes Weiner	  Randomization of the page allocator improves the average
3337b42f104SJohannes Weiner	  utilization of a direct-mapped memory-side-cache. See section
3347b42f104SJohannes Weiner	  5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
3357b42f104SJohannes Weiner	  6.2a specification for an example of how a platform advertises
3367b42f104SJohannes Weiner	  the presence of a memory-side-cache. There are also incidental
3377b42f104SJohannes Weiner	  security benefits as it reduces the predictability of page
3387b42f104SJohannes Weiner	  allocations to compliment SLAB_FREELIST_RANDOM, but the
33923baf831SKirill A. Shutemov	  default granularity of shuffling on the MAX_ORDER i.e, 10th
34023baf831SKirill A. Shutemov	  order of pages is selected based on cache utilization benefits
34123baf831SKirill A. Shutemov	  on x86.
3427b42f104SJohannes Weiner
3437b42f104SJohannes Weiner	  While the randomization improves cache utilization it may
3447b42f104SJohannes Weiner	  negatively impact workloads on platforms without a cache. For
3457b42f104SJohannes Weiner	  this reason, by default, the randomization is enabled only
3467b42f104SJohannes Weiner	  after runtime detection of a direct-mapped memory-side-cache.
3477b42f104SJohannes Weiner	  Otherwise, the randomization may be force enabled with the
3487b42f104SJohannes Weiner	  'page_alloc.shuffle' kernel command line parameter.
3497b42f104SJohannes Weiner
3507b42f104SJohannes Weiner	  Say Y if unsure.
3517b42f104SJohannes Weiner
3520710d012SVlastimil Babkaconfig COMPAT_BRK
3530710d012SVlastimil Babka	bool "Disable heap randomization"
3540710d012SVlastimil Babka	default y
3550710d012SVlastimil Babka	help
3560710d012SVlastimil Babka	  Randomizing heap placement makes heap exploits harder, but it
3570710d012SVlastimil Babka	  also breaks ancient binaries (including anything libc5 based).
3580710d012SVlastimil Babka	  This option changes the bootup default to heap randomization
3590710d012SVlastimil Babka	  disabled, and can be overridden at runtime by setting
3600710d012SVlastimil Babka	  /proc/sys/kernel/randomize_va_space to 2.
3610710d012SVlastimil Babka
3620710d012SVlastimil Babka	  On non-ancient distros (post-2000 ones) N is usually a safe choice.
3630710d012SVlastimil Babka
3640710d012SVlastimil Babkaconfig MMAP_ALLOW_UNINITIALIZED
3650710d012SVlastimil Babka	bool "Allow mmapped anonymous memory to be uninitialized"
3660710d012SVlastimil Babka	depends on EXPERT && !MMU
3670710d012SVlastimil Babka	default n
3680710d012SVlastimil Babka	help
3690710d012SVlastimil Babka	  Normally, and according to the Linux spec, anonymous memory obtained
3700710d012SVlastimil Babka	  from mmap() has its contents cleared before it is passed to
3710710d012SVlastimil Babka	  userspace.  Enabling this config option allows you to request that
3720710d012SVlastimil Babka	  mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
3730710d012SVlastimil Babka	  providing a huge performance boost.  If this option is not enabled,
3740710d012SVlastimil Babka	  then the flag will be ignored.
3750710d012SVlastimil Babka
3760710d012SVlastimil Babka	  This is taken advantage of by uClibc's malloc(), and also by
3770710d012SVlastimil Babka	  ELF-FDPIC binfmt's brk and stack allocator.
3780710d012SVlastimil Babka
3790710d012SVlastimil Babka	  Because of the obvious security issues, this option should only be
3800710d012SVlastimil Babka	  enabled on embedded devices where you control what is run in
3810710d012SVlastimil Babka	  userspace.  Since that isn't generally a problem on no-MMU systems,
3820710d012SVlastimil Babka	  it is normally safe to say Y here.
3830710d012SVlastimil Babka
3840710d012SVlastimil Babka	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
3850710d012SVlastimil Babka
386e1785e85SDave Hansenconfig SELECT_MEMORY_MODEL
387e1785e85SDave Hansen	def_bool y
388a8826eebSKees Cook	depends on ARCH_SELECT_MEMORY_MODEL
389e1785e85SDave Hansen
3903a9da765SDave Hansenchoice
3913a9da765SDave Hansen	prompt "Memory model"
392e1785e85SDave Hansen	depends on SELECT_MEMORY_MODEL
393d41dee36SAndy Whitcroft	default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
394e1785e85SDave Hansen	default FLATMEM_MANUAL
395d66d109dSMike Rapoport	help
396d66d109dSMike Rapoport	  This option allows you to change some of the ways that
397d66d109dSMike Rapoport	  Linux manages its memory internally. Most users will
398d66d109dSMike Rapoport	  only have one option here selected by the architecture
399d66d109dSMike Rapoport	  configuration. This is normal.
4003a9da765SDave Hansen
401e1785e85SDave Hansenconfig FLATMEM_MANUAL
4023a9da765SDave Hansen	bool "Flat Memory"
403bb1c50d3SMike Rapoport	depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
4043a9da765SDave Hansen	help
405d66d109dSMike Rapoport	  This option is best suited for non-NUMA systems with
406d66d109dSMike Rapoport	  flat address space. The FLATMEM is the most efficient
407d66d109dSMike Rapoport	  system in terms of performance and resource consumption
408d66d109dSMike Rapoport	  and it is the best option for smaller systems.
4093a9da765SDave Hansen
410d66d109dSMike Rapoport	  For systems that have holes in their physical address
411d66d109dSMike Rapoport	  spaces and for features like NUMA and memory hotplug,
412dd33d29aSRandy Dunlap	  choose "Sparse Memory".
413d41dee36SAndy Whitcroft
414d41dee36SAndy Whitcroft	  If unsure, choose this option (Flat Memory) over any other.
4153a9da765SDave Hansen
416d41dee36SAndy Whitcroftconfig SPARSEMEM_MANUAL
417d41dee36SAndy Whitcroft	bool "Sparse Memory"
418d41dee36SAndy Whitcroft	depends on ARCH_SPARSEMEM_ENABLE
419d41dee36SAndy Whitcroft	help
420d41dee36SAndy Whitcroft	  This will be the only option for some systems, including
421d66d109dSMike Rapoport	  memory hot-plug systems.  This is normal.
422d41dee36SAndy Whitcroft
423d66d109dSMike Rapoport	  This option provides efficient support for systems with
424d66d109dSMike Rapoport	  holes is their physical address space and allows memory
425d66d109dSMike Rapoport	  hot-plug and hot-remove.
426d41dee36SAndy Whitcroft
427d66d109dSMike Rapoport	  If unsure, choose "Flat Memory" over this option.
428d41dee36SAndy Whitcroft
4293a9da765SDave Hansenendchoice
4303a9da765SDave Hansen
431d41dee36SAndy Whitcroftconfig SPARSEMEM
432d41dee36SAndy Whitcroft	def_bool y
4331a83e175SRussell King	depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
434d41dee36SAndy Whitcroft
435e1785e85SDave Hansenconfig FLATMEM
436e1785e85SDave Hansen	def_bool y
437bb1c50d3SMike Rapoport	depends on !SPARSEMEM || FLATMEM_MANUAL
438d41dee36SAndy Whitcroft
43993b7504eSDave Hansen#
4403e347261SBob Picco# SPARSEMEM_EXTREME (which is the default) does some bootmem
441c89ab04fSMike Rapoport# allocations when sparse_init() is called.  If this cannot
4423e347261SBob Picco# be done on your architecture, select this option.  However,
4433e347261SBob Picco# statically allocating the mem_section[] array can potentially
4443e347261SBob Picco# consume vast quantities of .bss, so be careful.
4453e347261SBob Picco#
4463e347261SBob Picco# This option will also potentially produce smaller runtime code
4473e347261SBob Picco# with gcc 3.4 and later.
4483e347261SBob Picco#
4493e347261SBob Piccoconfig SPARSEMEM_STATIC
4509ba16087SJan Beulich	bool
4513e347261SBob Picco
4523e347261SBob Picco#
45344c09201SMatt LaPlante# Architecture platforms which require a two level mem_section in SPARSEMEM
454802f192eSBob Picco# must select this option. This is usually for architecture platforms with
455802f192eSBob Picco# an extremely sparse physical address space.
456802f192eSBob Picco#
4573e347261SBob Piccoconfig SPARSEMEM_EXTREME
4583e347261SBob Picco	def_bool y
4593e347261SBob Picco	depends on SPARSEMEM && !SPARSEMEM_STATIC
4604c21e2f2SHugh Dickins
46129c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP_ENABLE
4629ba16087SJan Beulich	bool
46329c71111SAndy Whitcroft
46429c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP
465a5ee6daaSGeoff Levand	bool "Sparse Memory virtual memmap"
466a5ee6daaSGeoff Levand	depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
467a5ee6daaSGeoff Levand	default y
468a5ee6daaSGeoff Levand	help
469a5ee6daaSGeoff Levand	  SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
470a5ee6daaSGeoff Levand	  pfn_to_page and page_to_pfn operations.  This is the most
471a5ee6daaSGeoff Levand	  efficient option when sufficient kernel resources are available.
4720b376f1eSAneesh Kumar K.V#
4730b376f1eSAneesh Kumar K.V# Select this config option from the architecture Kconfig, if it is preferred
4740b376f1eSAneesh Kumar K.V# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
4750b376f1eSAneesh Kumar K.V#
4760b376f1eSAneesh Kumar K.Vconfig ARCH_WANT_OPTIMIZE_VMEMMAP
4770b376f1eSAneesh Kumar K.V	bool
47829c71111SAndy Whitcroft
47970210ed9SPhilipp Hachtmannconfig HAVE_MEMBLOCK_PHYS_MAP
4806341e62bSChristoph Jaeger	bool
48170210ed9SPhilipp Hachtmann
48267a929e0SChristoph Hellwigconfig HAVE_FAST_GUP
483050a9adcSChristoph Hellwig	depends on MMU
4846341e62bSChristoph Jaeger	bool
4852667f50eSSteve Capper
48652219aeaSDavid Hildenbrand# Don't discard allocated memory used to track "memory" and "reserved" memblocks
48752219aeaSDavid Hildenbrand# after early boot, so it can still be used to test for validity of memory.
48852219aeaSDavid Hildenbrand# Also, memblocks are updated with memory hot(un)plug.
489350e88baSMike Rapoportconfig ARCH_KEEP_MEMBLOCK
4906341e62bSChristoph Jaeger	bool
491c378ddd5STejun Heo
4921e5d8e1eSDan Williams# Keep arch NUMA mapping infrastructure post-init.
4931e5d8e1eSDan Williamsconfig NUMA_KEEP_MEMINFO
4941e5d8e1eSDan Williams	bool
4951e5d8e1eSDan Williams
496ee6f509cSMinchan Kimconfig MEMORY_ISOLATION
4976341e62bSChristoph Jaeger	bool
498ee6f509cSMinchan Kim
499a9e7b8d4SDavid Hildenbrand# IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked
500a9e7b8d4SDavid Hildenbrand# IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via
501a9e7b8d4SDavid Hildenbrand# /dev/mem.
502a9e7b8d4SDavid Hildenbrandconfig EXCLUSIVE_SYSTEM_RAM
503a9e7b8d4SDavid Hildenbrand	def_bool y
504a9e7b8d4SDavid Hildenbrand	depends on !DEVMEM || STRICT_DEVMEM
505a9e7b8d4SDavid Hildenbrand
50646723bfaSYasuaki Ishimatsu#
50746723bfaSYasuaki Ishimatsu# Only be set on architectures that have completely implemented memory hotplug
50846723bfaSYasuaki Ishimatsu# feature. If you are not sure, don't touch it.
50946723bfaSYasuaki Ishimatsu#
51046723bfaSYasuaki Ishimatsuconfig HAVE_BOOTMEM_INFO_NODE
51146723bfaSYasuaki Ishimatsu	def_bool n
51246723bfaSYasuaki Ishimatsu
51391024b3cSAnshuman Khandualconfig ARCH_ENABLE_MEMORY_HOTPLUG
51491024b3cSAnshuman Khandual	bool
51591024b3cSAnshuman Khandual
516519bcb79SJohannes Weinerconfig ARCH_ENABLE_MEMORY_HOTREMOVE
517519bcb79SJohannes Weiner	bool
518519bcb79SJohannes Weiner
5193947be19SDave Hansen# eventually, we can have this option just 'select SPARSEMEM'
520519bcb79SJohannes Weinermenuconfig MEMORY_HOTPLUG
521519bcb79SJohannes Weiner	bool "Memory hotplug"
522b30c5927SDavid Hildenbrand	select MEMORY_ISOLATION
52371b6f2ddSDavid Hildenbrand	depends on SPARSEMEM
52440b31360SStephen Rothwell	depends on ARCH_ENABLE_MEMORY_HOTPLUG
5257ec58a2bSDavid Hildenbrand	depends on 64BIT
5261e5d8e1eSDan Williams	select NUMA_KEEP_MEMINFO if NUMA
5273947be19SDave Hansen
528519bcb79SJohannes Weinerif MEMORY_HOTPLUG
529519bcb79SJohannes Weiner
5308604d9e5SVitaly Kuznetsovconfig MEMORY_HOTPLUG_DEFAULT_ONLINE
5318604d9e5SVitaly Kuznetsov	bool "Online the newly added memory blocks by default"
5328604d9e5SVitaly Kuznetsov	depends on MEMORY_HOTPLUG
5338604d9e5SVitaly Kuznetsov	help
5348604d9e5SVitaly Kuznetsov	  This option sets the default policy setting for memory hotplug
5358604d9e5SVitaly Kuznetsov	  onlining policy (/sys/devices/system/memory/auto_online_blocks) which
5368604d9e5SVitaly Kuznetsov	  determines what happens to newly added memory regions. Policy setting
5378604d9e5SVitaly Kuznetsov	  can always be changed at runtime.
538cb1aaebeSMauro Carvalho Chehab	  See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
5398604d9e5SVitaly Kuznetsov
5408604d9e5SVitaly Kuznetsov	  Say Y here if you want all hot-plugged memory blocks to appear in
5418604d9e5SVitaly Kuznetsov	  'online' state by default.
5428604d9e5SVitaly Kuznetsov	  Say N here if you want the default policy to keep all hot-plugged
5438604d9e5SVitaly Kuznetsov	  memory blocks in 'offline' state.
5448604d9e5SVitaly Kuznetsov
5450c0e6195SKAMEZAWA Hiroyukiconfig MEMORY_HOTREMOVE
5460c0e6195SKAMEZAWA Hiroyuki	bool "Allow for memory hot remove"
547f7e3334aSNathan Fontenot	select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
5480c0e6195SKAMEZAWA Hiroyuki	depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
5490c0e6195SKAMEZAWA Hiroyuki	depends on MIGRATION
5500c0e6195SKAMEZAWA Hiroyuki
551a08a2ae3SOscar Salvadorconfig MHP_MEMMAP_ON_MEMORY
552a08a2ae3SOscar Salvador	def_bool y
553a08a2ae3SOscar Salvador	depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
554a08a2ae3SOscar Salvador	depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
555a08a2ae3SOscar Salvador
556519bcb79SJohannes Weinerendif # MEMORY_HOTPLUG
557519bcb79SJohannes Weiner
5584c21e2f2SHugh Dickins# Heavily threaded applications may benefit from splitting the mm-wide
5594c21e2f2SHugh Dickins# page_table_lock, so that faults on different parts of the user address
5604c21e2f2SHugh Dickins# space can be handled with less contention: split it at this NR_CPUS.
5614c21e2f2SHugh Dickins# Default to 4 for wider testing, though 8 might be more appropriate.
5624c21e2f2SHugh Dickins# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
5637b6ac9dfSHugh Dickins# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
56460bccaa6SWill Deacon# SPARC32 allocates multiple pte tables within a single page, and therefore
56560bccaa6SWill Deacon# a per-page lock leads to problems when multiple tables need to be locked
56660bccaa6SWill Deacon# at the same time (e.g. copy_page_range()).
567a70caa8bSHugh Dickins# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
5684c21e2f2SHugh Dickins#
5694c21e2f2SHugh Dickinsconfig SPLIT_PTLOCK_CPUS
5704c21e2f2SHugh Dickins	int
5719164550eSKirill A. Shutemov	default "999999" if !MMU
572a70caa8bSHugh Dickins	default "999999" if ARM && !CPU_CACHE_VIPT
573a70caa8bSHugh Dickins	default "999999" if PARISC && !PA20
57460bccaa6SWill Deacon	default "999999" if SPARC32
5754c21e2f2SHugh Dickins	default "4"
5767cbe34cfSChristoph Lameter
577e009bb30SKirill A. Shutemovconfig ARCH_ENABLE_SPLIT_PMD_PTLOCK
5786341e62bSChristoph Jaeger	bool
579e009bb30SKirill A. Shutemov
5807cbe34cfSChristoph Lameter#
58109316c09SKonstantin Khlebnikov# support for memory balloon
58209316c09SKonstantin Khlebnikovconfig MEMORY_BALLOON
5836341e62bSChristoph Jaeger	bool
58409316c09SKonstantin Khlebnikov
58509316c09SKonstantin Khlebnikov#
58618468d93SRafael Aquini# support for memory balloon compaction
58718468d93SRafael Aquiniconfig BALLOON_COMPACTION
58818468d93SRafael Aquini	bool "Allow for balloon memory compaction/migration"
58918468d93SRafael Aquini	def_bool y
59009316c09SKonstantin Khlebnikov	depends on COMPACTION && MEMORY_BALLOON
59118468d93SRafael Aquini	help
59218468d93SRafael Aquini	  Memory fragmentation introduced by ballooning might reduce
59318468d93SRafael Aquini	  significantly the number of 2MB contiguous memory blocks that can be
59418468d93SRafael Aquini	  used within a guest, thus imposing performance penalties associated
59518468d93SRafael Aquini	  with the reduced number of transparent huge pages that could be used
59618468d93SRafael Aquini	  by the guest workload. Allowing the compaction & migration for memory
59718468d93SRafael Aquini	  pages enlisted as being part of memory balloon devices avoids the
59818468d93SRafael Aquini	  scenario aforementioned and helps improving memory defragmentation.
59918468d93SRafael Aquini
60018468d93SRafael Aquini#
601e9e96b39SMel Gorman# support for memory compaction
602e9e96b39SMel Gormanconfig COMPACTION
603e9e96b39SMel Gorman	bool "Allow for memory compaction"
60405106e6aSRik van Riel	def_bool y
605e9e96b39SMel Gorman	select MIGRATION
60633a93877SAndrea Arcangeli	depends on MMU
607e9e96b39SMel Gorman	help
608b32eaf71SMichal Hocko	  Compaction is the only memory management component to form
609b32eaf71SMichal Hocko	  high order (larger physically contiguous) memory blocks
610b32eaf71SMichal Hocko	  reliably. The page allocator relies on compaction heavily and
611b32eaf71SMichal Hocko	  the lack of the feature can lead to unexpected OOM killer
612b32eaf71SMichal Hocko	  invocations for high order memory requests. You shouldn't
613b32eaf71SMichal Hocko	  disable this option unless there really is a strong reason for
614b32eaf71SMichal Hocko	  it and then we would be really interested to hear about that at
615b32eaf71SMichal Hocko	  linux-mm@kvack.org.
616e9e96b39SMel Gorman
617c7e0b3d0SThomas Gleixnerconfig COMPACT_UNEVICTABLE_DEFAULT
618c7e0b3d0SThomas Gleixner	int
619c7e0b3d0SThomas Gleixner	depends on COMPACTION
620c7e0b3d0SThomas Gleixner	default 0 if PREEMPT_RT
621c7e0b3d0SThomas Gleixner	default 1
622c7e0b3d0SThomas Gleixner
623e9e96b39SMel Gorman#
62436e66c55SAlexander Duyck# support for free page reporting
62536e66c55SAlexander Duyckconfig PAGE_REPORTING
62636e66c55SAlexander Duyck	bool "Free page reporting"
62736e66c55SAlexander Duyck	def_bool n
62836e66c55SAlexander Duyck	help
62936e66c55SAlexander Duyck	  Free page reporting allows for the incremental acquisition of
63036e66c55SAlexander Duyck	  free pages from the buddy allocator for the purpose of reporting
63136e66c55SAlexander Duyck	  those pages to another entity, such as a hypervisor, so that the
63236e66c55SAlexander Duyck	  memory can be freed within the host for other uses.
63336e66c55SAlexander Duyck
63436e66c55SAlexander Duyck#
6357cbe34cfSChristoph Lameter# support for page migration
6367cbe34cfSChristoph Lameter#
6377cbe34cfSChristoph Lameterconfig MIGRATION
638b20a3503SChristoph Lameter	bool "Page migration"
6396c5240aeSChristoph Lameter	def_bool y
640de32a817SChen Gang	depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
641b20a3503SChristoph Lameter	help
642b20a3503SChristoph Lameter	  Allows the migration of the physical location of pages of processes
643e9e96b39SMel Gorman	  while the virtual addresses are not changed. This is useful in
644e9e96b39SMel Gorman	  two situations. The first is on NUMA systems to put pages nearer
645e9e96b39SMel Gorman	  to the processors accessing. The second is when allocating huge
646e9e96b39SMel Gorman	  pages as migration can relocate pages to satisfy a huge page
647e9e96b39SMel Gorman	  allocation instead of reclaiming.
6486550e07fSGreg Kroah-Hartman
64976cbbeadSChristoph Hellwigconfig DEVICE_MIGRATION
650d90a25f8SChristoph Hellwig	def_bool MIGRATION && ZONE_DEVICE
65176cbbeadSChristoph Hellwig
652c177c81eSNaoya Horiguchiconfig ARCH_ENABLE_HUGEPAGE_MIGRATION
6536341e62bSChristoph Jaeger	bool
654c177c81eSNaoya Horiguchi
6559c670ea3SNaoya Horiguchiconfig ARCH_ENABLE_THP_MIGRATION
6569c670ea3SNaoya Horiguchi	bool
6579c670ea3SNaoya Horiguchi
6584bfb68a0SAnshuman Khandualconfig HUGETLB_PAGE_SIZE_VARIABLE
6594bfb68a0SAnshuman Khandual	def_bool n
6604bfb68a0SAnshuman Khandual	help
6614bfb68a0SAnshuman Khandual	  Allows the pageblock_order value to be dynamic instead of just standard
6624bfb68a0SAnshuman Khandual	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
6634bfb68a0SAnshuman Khandual	  on a platform.
6644bfb68a0SAnshuman Khandual
66523baf831SKirill A. Shutemov	  Note that the pageblock_order cannot exceed MAX_ORDER and will be
66623baf831SKirill A. Shutemov	  clamped down to MAX_ORDER.
667b3d40a2bSDavid Hildenbrand
6688df995f6SAlexandre Ghiticonfig CONTIG_ALLOC
6698df995f6SAlexandre Ghiti	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
6708df995f6SAlexandre Ghiti
671600715dcSJeremy Fitzhardingeconfig PHYS_ADDR_T_64BIT
672d4a451d5SChristoph Hellwig	def_bool 64BIT
673600715dcSJeremy Fitzhardinge
6742a7326b5SChristoph Lameterconfig BOUNCE
6759ca24e2eSVinayak Menon	bool "Enable bounce buffers"
6769ca24e2eSVinayak Menon	default y
677ce288e05SChristoph Hellwig	depends on BLOCK && MMU && HIGHMEM
6789ca24e2eSVinayak Menon	help
679ce288e05SChristoph Hellwig	  Enable bounce buffers for devices that cannot access the full range of
680ce288e05SChristoph Hellwig	  memory available to the CPU. Enabled by default when HIGHMEM is
681ce288e05SChristoph Hellwig	  selected, but you may say n to override this.
6822a7326b5SChristoph Lameter
683cddb8a5cSAndrea Arcangeliconfig MMU_NOTIFIER
684cddb8a5cSAndrea Arcangeli	bool
68599cb252fSJason Gunthorpe	select INTERVAL_TREE
686fc4d5c29SDavid Howells
687f8af4da3SHugh Dickinsconfig KSM
688f8af4da3SHugh Dickins	bool "Enable KSM for page merging"
689f8af4da3SHugh Dickins	depends on MMU
69059e1a2f4STimofey Titovets	select XXHASH
691f8af4da3SHugh Dickins	help
692f8af4da3SHugh Dickins	  Enable Kernel Samepage Merging: KSM periodically scans those areas
693f8af4da3SHugh Dickins	  of an application's address space that an app has advised may be
694f8af4da3SHugh Dickins	  mergeable.  When it finds pages of identical content, it replaces
695d0f209f6SHugh Dickins	  the many instances by a single page with that content, so
696f8af4da3SHugh Dickins	  saving memory until one or another app needs to modify the content.
697f8af4da3SHugh Dickins	  Recommended for use with KVM, or with other duplicative applications.
698ee65728eSMike Rapoport	  See Documentation/mm/ksm.rst for more information: KSM is inactive
699c73602adSHugh Dickins	  until a program has madvised that an area is MADV_MERGEABLE, and
700c73602adSHugh Dickins	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
701f8af4da3SHugh Dickins
702e0a94c2aSChristoph Lameterconfig DEFAULT_MMAP_MIN_ADDR
703e0a94c2aSChristoph Lameter	int "Low address space to protect from user allocation"
7046e141546SDavid Howells	depends on MMU
705e0a94c2aSChristoph Lameter	default 4096
706e0a94c2aSChristoph Lameter	help
707e0a94c2aSChristoph Lameter	  This is the portion of low virtual memory which should be protected
708e0a94c2aSChristoph Lameter	  from userspace allocation.  Keeping a user from writing to low pages
709e0a94c2aSChristoph Lameter	  can help reduce the impact of kernel NULL pointer bugs.
710e0a94c2aSChristoph Lameter
711e0a94c2aSChristoph Lameter	  For most ia64, ppc64 and x86 users with lots of address space
712e0a94c2aSChristoph Lameter	  a value of 65536 is reasonable and should cause no problems.
713e0a94c2aSChristoph Lameter	  On arm and other archs it should not be higher than 32768.
714788084abSEric Paris	  Programs which use vm86 functionality or have some need to map
715788084abSEric Paris	  this low address space will need CAP_SYS_RAWIO or disable this
716788084abSEric Paris	  protection by setting the value to 0.
717e0a94c2aSChristoph Lameter
718e0a94c2aSChristoph Lameter	  This value can be changed after boot using the
719e0a94c2aSChristoph Lameter	  /proc/sys/vm/mmap_min_addr tunable.
720e0a94c2aSChristoph Lameter
721d949f36fSLinus Torvaldsconfig ARCH_SUPPORTS_MEMORY_FAILURE
722d949f36fSLinus Torvalds	bool
723e0a94c2aSChristoph Lameter
7246a46079cSAndi Kleenconfig MEMORY_FAILURE
7256a46079cSAndi Kleen	depends on MMU
726d949f36fSLinus Torvalds	depends on ARCH_SUPPORTS_MEMORY_FAILURE
7276a46079cSAndi Kleen	bool "Enable recovery from hardware memory errors"
728ee6f509cSMinchan Kim	select MEMORY_ISOLATION
72997f0b134SXie XiuQi	select RAS
7306a46079cSAndi Kleen	help
7316a46079cSAndi Kleen	  Enables code to recover from some memory failures on systems
7326a46079cSAndi Kleen	  with MCA recovery. This allows a system to continue running
7336a46079cSAndi Kleen	  even when some of its memory has uncorrected errors. This requires
7346a46079cSAndi Kleen	  special hardware support and typically ECC memory.
7356a46079cSAndi Kleen
736cae681fcSAndi Kleenconfig HWPOISON_INJECT
737413f9efbSAndi Kleen	tristate "HWPoison pages injector"
73827df5068SAndi Kleen	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
739478c5ffcSWu Fengguang	select PROC_PAGE_MONITOR
740cae681fcSAndi Kleen
741fc4d5c29SDavid Howellsconfig NOMMU_INITIAL_TRIM_EXCESS
742fc4d5c29SDavid Howells	int "Turn on mmap() excess space trimming before booting"
743fc4d5c29SDavid Howells	depends on !MMU
744fc4d5c29SDavid Howells	default 1
745fc4d5c29SDavid Howells	help
746fc4d5c29SDavid Howells	  The NOMMU mmap() frequently needs to allocate large contiguous chunks
747fc4d5c29SDavid Howells	  of memory on which to store mappings, but it can only ask the system
748fc4d5c29SDavid Howells	  allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
749fc4d5c29SDavid Howells	  more than it requires.  To deal with this, mmap() is able to trim off
750fc4d5c29SDavid Howells	  the excess and return it to the allocator.
751fc4d5c29SDavid Howells
752fc4d5c29SDavid Howells	  If trimming is enabled, the excess is trimmed off and returned to the
753fc4d5c29SDavid Howells	  system allocator, which can cause extra fragmentation, particularly
754fc4d5c29SDavid Howells	  if there are a lot of transient processes.
755fc4d5c29SDavid Howells
756fc4d5c29SDavid Howells	  If trimming is disabled, the excess is kept, but not used, which for
757fc4d5c29SDavid Howells	  long-term mappings means that the space is wasted.
758fc4d5c29SDavid Howells
759fc4d5c29SDavid Howells	  Trimming can be dynamically controlled through a sysctl option
760fc4d5c29SDavid Howells	  (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
761fc4d5c29SDavid Howells	  excess pages there must be before trimming should occur, or zero if
762fc4d5c29SDavid Howells	  no trimming is to occur.
763fc4d5c29SDavid Howells
764fc4d5c29SDavid Howells	  This option specifies the initial value of this option.  The default
765fc4d5c29SDavid Howells	  of 1 says that all excess pages should be trimmed.
766fc4d5c29SDavid Howells
767dd19d293SStephen Kitt	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
768bbddff05STejun Heo
769519bcb79SJohannes Weinerconfig ARCH_WANT_GENERAL_HUGETLB
770519bcb79SJohannes Weiner	bool
771519bcb79SJohannes Weiner
772519bcb79SJohannes Weinerconfig ARCH_WANTS_THP_SWAP
773519bcb79SJohannes Weiner	def_bool n
774519bcb79SJohannes Weiner
775519bcb79SJohannes Weinermenuconfig TRANSPARENT_HUGEPAGE
77613ece886SAndrea Arcangeli	bool "Transparent Hugepage Support"
777554b0f3cSSebastian Andrzej Siewior	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
7785d689240SAndrea Arcangeli	select COMPACTION
7793a08cd52SMatthew Wilcox	select XARRAY_MULTI
7804c76d9d1SAndrea Arcangeli	help
7814c76d9d1SAndrea Arcangeli	  Transparent Hugepages allows the kernel to use huge pages and
7824c76d9d1SAndrea Arcangeli	  huge tlb transparently to the applications whenever possible.
7834c76d9d1SAndrea Arcangeli	  This feature can improve computing performance to certain
7844c76d9d1SAndrea Arcangeli	  applications by speeding up page faults during memory
7854c76d9d1SAndrea Arcangeli	  allocation, by reducing the number of tlb misses and by speeding
7864c76d9d1SAndrea Arcangeli	  up the pagetable walking.
7874c76d9d1SAndrea Arcangeli
7884c76d9d1SAndrea Arcangeli	  If memory constrained on embedded, you may want to say N.
7894c76d9d1SAndrea Arcangeli
790519bcb79SJohannes Weinerif TRANSPARENT_HUGEPAGE
791519bcb79SJohannes Weiner
79213ece886SAndrea Arcangelichoice
79313ece886SAndrea Arcangeli	prompt "Transparent Hugepage Support sysfs defaults"
79413ece886SAndrea Arcangeli	depends on TRANSPARENT_HUGEPAGE
79513ece886SAndrea Arcangeli	default TRANSPARENT_HUGEPAGE_ALWAYS
79613ece886SAndrea Arcangeli	help
79713ece886SAndrea Arcangeli	  Selects the sysfs defaults for Transparent Hugepage Support.
79813ece886SAndrea Arcangeli
79913ece886SAndrea Arcangeli	config TRANSPARENT_HUGEPAGE_ALWAYS
80013ece886SAndrea Arcangeli		bool "always"
80113ece886SAndrea Arcangeli	help
80213ece886SAndrea Arcangeli	  Enabling Transparent Hugepage always, can increase the
80313ece886SAndrea Arcangeli	  memory footprint of applications without a guaranteed
80413ece886SAndrea Arcangeli	  benefit but it will work automatically for all applications.
80513ece886SAndrea Arcangeli
80613ece886SAndrea Arcangeli	config TRANSPARENT_HUGEPAGE_MADVISE
80713ece886SAndrea Arcangeli		bool "madvise"
80813ece886SAndrea Arcangeli	help
80913ece886SAndrea Arcangeli	  Enabling Transparent Hugepage madvise, will only provide a
81013ece886SAndrea Arcangeli	  performance improvement benefit to the applications using
81113ece886SAndrea Arcangeli	  madvise(MADV_HUGEPAGE) but it won't risk to increase the
81213ece886SAndrea Arcangeli	  memory footprint of applications without a guaranteed
81313ece886SAndrea Arcangeli	  benefit.
81413ece886SAndrea Arcangeliendchoice
81513ece886SAndrea Arcangeli
81638d8b4e6SHuang Yingconfig THP_SWAP
81738d8b4e6SHuang Ying	def_bool y
818dad6a5ebSHugh Dickins	depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT
81938d8b4e6SHuang Ying	help
82038d8b4e6SHuang Ying	  Swap transparent huge pages in one piece, without splitting.
82114fef284SHuang Ying	  XXX: For now, swap cluster backing transparent huge page
82214fef284SHuang Ying	  will be split after swapout.
82338d8b4e6SHuang Ying
82438d8b4e6SHuang Ying	  For selection by architectures with reasonable THP sizes.
82538d8b4e6SHuang Ying
826519bcb79SJohannes Weinerconfig READ_ONLY_THP_FOR_FS
827519bcb79SJohannes Weiner	bool "Read-only THP for filesystems (EXPERIMENTAL)"
828519bcb79SJohannes Weiner	depends on TRANSPARENT_HUGEPAGE && SHMEM
829519bcb79SJohannes Weiner
830519bcb79SJohannes Weiner	help
831519bcb79SJohannes Weiner	  Allow khugepaged to put read-only file-backed pages in THP.
832519bcb79SJohannes Weiner
833519bcb79SJohannes Weiner	  This is marked experimental because it is a new feature. Write
834519bcb79SJohannes Weiner	  support of file THPs will be developed in the next few release
835519bcb79SJohannes Weiner	  cycles.
836519bcb79SJohannes Weiner
837519bcb79SJohannes Weinerendif # TRANSPARENT_HUGEPAGE
838519bcb79SJohannes Weiner
839e496cf3dSKirill A. Shutemov#
840bbddff05STejun Heo# UP and nommu archs use km based percpu allocator
841bbddff05STejun Heo#
842bbddff05STejun Heoconfig NEED_PER_CPU_KM
8433583521aSVladimir Murzin	depends on !SMP || !MMU
844bbddff05STejun Heo	bool
845bbddff05STejun Heo	default y
846077b1f83SDan Magenheimer
8477ecd19cfSKefeng Wangconfig NEED_PER_CPU_EMBED_FIRST_CHUNK
8487ecd19cfSKefeng Wang	bool
8497ecd19cfSKefeng Wang
8507ecd19cfSKefeng Wangconfig NEED_PER_CPU_PAGE_FIRST_CHUNK
8517ecd19cfSKefeng Wang	bool
8527ecd19cfSKefeng Wang
8537ecd19cfSKefeng Wangconfig USE_PERCPU_NUMA_NODE_ID
8547ecd19cfSKefeng Wang	bool
8557ecd19cfSKefeng Wang
8567ecd19cfSKefeng Wangconfig HAVE_SETUP_PER_CPU_AREA
8577ecd19cfSKefeng Wang	bool
8587ecd19cfSKefeng Wang
85927c6aec2SDan Magenheimerconfig FRONTSWAP
8606e61dde8SChristoph Hellwig	bool
861f825c736SAneesh Kumar K.V
862f825c736SAneesh Kumar K.Vconfig CMA
863f825c736SAneesh Kumar K.V	bool "Contiguous Memory Allocator"
864aca52c39SMike Rapoport	depends on MMU
865f825c736SAneesh Kumar K.V	select MIGRATION
866f825c736SAneesh Kumar K.V	select MEMORY_ISOLATION
867f825c736SAneesh Kumar K.V	help
868f825c736SAneesh Kumar K.V	  This enables the Contiguous Memory Allocator which allows other
869f825c736SAneesh Kumar K.V	  subsystems to allocate big physically-contiguous blocks of memory.
870f825c736SAneesh Kumar K.V	  CMA reserves a region of memory and allows only movable pages to
871f825c736SAneesh Kumar K.V	  be allocated from it. This way, the kernel can use the memory for
872f825c736SAneesh Kumar K.V	  pagecache and when a subsystem requests for contiguous area, the
873f825c736SAneesh Kumar K.V	  allocated pages are migrated away to serve the contiguous request.
874f825c736SAneesh Kumar K.V
875f825c736SAneesh Kumar K.V	  If unsure, say "n".
876f825c736SAneesh Kumar K.V
877f825c736SAneesh Kumar K.Vconfig CMA_DEBUG
878f825c736SAneesh Kumar K.V	bool "CMA debug messages (DEVELOPMENT)"
879f825c736SAneesh Kumar K.V	depends on DEBUG_KERNEL && CMA
880f825c736SAneesh Kumar K.V	help
881f825c736SAneesh Kumar K.V	  Turns on debug messages in CMA.  This produces KERN_DEBUG
882f825c736SAneesh Kumar K.V	  messages for every CMA call as well as various messages while
883f825c736SAneesh Kumar K.V	  processing calls such as dma_alloc_from_contiguous().
884f825c736SAneesh Kumar K.V	  This option does not affect warning and error messages.
885bf550fc9SAlexander Graf
88628b24c1fSSasha Levinconfig CMA_DEBUGFS
88728b24c1fSSasha Levin	bool "CMA debugfs interface"
88828b24c1fSSasha Levin	depends on CMA && DEBUG_FS
88928b24c1fSSasha Levin	help
89028b24c1fSSasha Levin	  Turns on the DebugFS interface for CMA.
89128b24c1fSSasha Levin
89243ca106fSMinchan Kimconfig CMA_SYSFS
89343ca106fSMinchan Kim	bool "CMA information through sysfs interface"
89443ca106fSMinchan Kim	depends on CMA && SYSFS
89543ca106fSMinchan Kim	help
89643ca106fSMinchan Kim	  This option exposes some sysfs attributes to get information
89743ca106fSMinchan Kim	  from CMA.
89843ca106fSMinchan Kim
899a254129eSJoonsoo Kimconfig CMA_AREAS
900a254129eSJoonsoo Kim	int "Maximum count of the CMA areas"
901a254129eSJoonsoo Kim	depends on CMA
902b7176c26SBarry Song	default 19 if NUMA
903a254129eSJoonsoo Kim	default 7
904a254129eSJoonsoo Kim	help
905a254129eSJoonsoo Kim	  CMA allows to create CMA areas for particular purpose, mainly,
906a254129eSJoonsoo Kim	  used as device private area. This parameter sets the maximum
907a254129eSJoonsoo Kim	  number of CMA area in the system.
908a254129eSJoonsoo Kim
909b7176c26SBarry Song	  If unsure, leave the default value "7" in UMA and "19" in NUMA.
910a254129eSJoonsoo Kim
911af8d417aSDan Streetmanconfig MEM_SOFT_DIRTY
912af8d417aSDan Streetman	bool "Track memory changes"
913af8d417aSDan Streetman	depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
914af8d417aSDan Streetman	select PROC_PAGE_MONITOR
9154e2e2770SSeth Jennings	help
916af8d417aSDan Streetman	  This option enables memory changes tracking by introducing a
917af8d417aSDan Streetman	  soft-dirty bit on pte-s. This bit it set when someone writes
918af8d417aSDan Streetman	  into a page just as regular dirty bit, but unlike the latter
919af8d417aSDan Streetman	  it can be cleared by hands.
920af8d417aSDan Streetman
9211ad1335dSMike Rapoport	  See Documentation/admin-guide/mm/soft-dirty.rst for more details.
9224e2e2770SSeth Jennings
9239e5c33d7SMark Salterconfig GENERIC_EARLY_IOREMAP
9249e5c33d7SMark Salter	bool
925042d27acSHelge Deller
92622ee3ea5SHelge Dellerconfig STACK_MAX_DEFAULT_SIZE_MB
92722ee3ea5SHelge Deller	int "Default maximum user stack size for 32-bit processes (MB)"
92822ee3ea5SHelge Deller	default 100
929042d27acSHelge Deller	range 8 2048
930042d27acSHelge Deller	depends on STACK_GROWSUP && (!64BIT || COMPAT)
931042d27acSHelge Deller	help
932042d27acSHelge Deller	  This is the maximum stack size in Megabytes in the VM layout of 32-bit
933042d27acSHelge Deller	  user processes when the stack grows upwards (currently only on parisc
93422ee3ea5SHelge Deller	  arch) when the RLIMIT_STACK hard limit is unlimited.
935042d27acSHelge Deller
93622ee3ea5SHelge Deller	  A sane initial value is 100 MB.
9373a80a7faSMel Gorman
9383a80a7faSMel Gormanconfig DEFERRED_STRUCT_PAGE_INIT
9391ce22103SVlastimil Babka	bool "Defer initialisation of struct pages to kthreads"
940d39f8fb4SMike Rapoport	depends on SPARSEMEM
941ab1e8d89SPavel Tatashin	depends on !NEED_PER_CPU_KM
942889c695dSPasha Tatashin	depends on 64BIT
943e4443149SDaniel Jordan	select PADATA
9443a80a7faSMel Gorman	help
9453a80a7faSMel Gorman	  Ordinarily all struct pages are initialised during early boot in a
9463a80a7faSMel Gorman	  single thread. On very large machines this can take a considerable
9473a80a7faSMel Gorman	  amount of time. If this option is set, large machines will bring up
948e4443149SDaniel Jordan	  a subset of memmap at boot and then initialise the rest in parallel.
949e4443149SDaniel Jordan	  This has a potential performance impact on tasks running early in the
9501ce22103SVlastimil Babka	  lifetime of the system until these kthreads finish the
9511ce22103SVlastimil Babka	  initialisation.
952033fbae9SDan Williams
9531c676e0dSSeongJae Parkconfig PAGE_IDLE_FLAG
9541c676e0dSSeongJae Park	bool
9551c676e0dSSeongJae Park	select PAGE_EXTENSION if !64BIT
9561c676e0dSSeongJae Park	help
9571c676e0dSSeongJae Park	  This adds PG_idle and PG_young flags to 'struct page'.  PTE Accessed
9581c676e0dSSeongJae Park	  bit writers can set the state of the bit in the flags so that PTE
9591c676e0dSSeongJae Park	  Accessed bit readers may avoid disturbance.
9601c676e0dSSeongJae Park
96133c3fc71SVladimir Davydovconfig IDLE_PAGE_TRACKING
96233c3fc71SVladimir Davydov	bool "Enable idle page tracking"
96333c3fc71SVladimir Davydov	depends on SYSFS && MMU
9641c676e0dSSeongJae Park	select PAGE_IDLE_FLAG
96533c3fc71SVladimir Davydov	help
96633c3fc71SVladimir Davydov	  This feature allows to estimate the amount of user pages that have
96733c3fc71SVladimir Davydov	  not been touched during a given period of time. This information can
96833c3fc71SVladimir Davydov	  be useful to tune memory cgroup limits and/or for job placement
96933c3fc71SVladimir Davydov	  within a compute cluster.
97033c3fc71SVladimir Davydov
9711ad1335dSMike Rapoport	  See Documentation/admin-guide/mm/idle_page_tracking.rst for
9721ad1335dSMike Rapoport	  more details.
97333c3fc71SVladimir Davydov
974c2280be8SAnshuman Khandualconfig ARCH_HAS_CACHE_LINE_SIZE
975c2280be8SAnshuman Khandual	bool
976c2280be8SAnshuman Khandual
9772792d84eSKees Cookconfig ARCH_HAS_CURRENT_STACK_POINTER
9782792d84eSKees Cook	bool
9792792d84eSKees Cook	help
9802792d84eSKees Cook	  In support of HARDENED_USERCOPY performing stack variable lifetime
9812792d84eSKees Cook	  checking, an architecture-agnostic way to find the stack pointer
9822792d84eSKees Cook	  is needed. Once an architecture defines an unsigned long global
9832792d84eSKees Cook	  register alias named "current_stack_pointer", this config can be
9842792d84eSKees Cook	  selected.
9852792d84eSKees Cook
98617596731SRobin Murphyconfig ARCH_HAS_PTE_DEVMAP
98765f7d049SOliver O'Halloran	bool
98865f7d049SOliver O'Halloran
98963703f37SKefeng Wangconfig ARCH_HAS_ZONE_DMA_SET
99063703f37SKefeng Wang	bool
99163703f37SKefeng Wang
99263703f37SKefeng Wangconfig ZONE_DMA
99363703f37SKefeng Wang	bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
99463703f37SKefeng Wang	default y if ARM64 || X86
99563703f37SKefeng Wang
99663703f37SKefeng Wangconfig ZONE_DMA32
99763703f37SKefeng Wang	bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
99863703f37SKefeng Wang	depends on !X86_32
99963703f37SKefeng Wang	default y if ARM64
100063703f37SKefeng Wang
1001033fbae9SDan Williamsconfig ZONE_DEVICE
10025042db43SJérôme Glisse	bool "Device memory (pmem, HMM, etc...) hotplug support"
1003033fbae9SDan Williams	depends on MEMORY_HOTPLUG
1004033fbae9SDan Williams	depends on MEMORY_HOTREMOVE
100599490f16SDan Williams	depends on SPARSEMEM_VMEMMAP
100617596731SRobin Murphy	depends on ARCH_HAS_PTE_DEVMAP
10073a08cd52SMatthew Wilcox	select XARRAY_MULTI
1008033fbae9SDan Williams
1009033fbae9SDan Williams	help
1010033fbae9SDan Williams	  Device memory hotplug support allows for establishing pmem,
1011033fbae9SDan Williams	  or other device driver discovered memory regions, in the
1012033fbae9SDan Williams	  memmap. This allows pfn_to_page() lookups of otherwise
1013033fbae9SDan Williams	  "device-physical" addresses which is needed for using a DAX
1014033fbae9SDan Williams	  mapping in an O_DIRECT operation, among other things.
1015033fbae9SDan Williams
1016033fbae9SDan Williams	  If FS_DAX is enabled, then say Y.
101706a660adSLinus Torvalds
10189c240a7bSChristoph Hellwig#
10199c240a7bSChristoph Hellwig# Helpers to mirror range of the CPU page tables of a process into device page
10209c240a7bSChristoph Hellwig# tables.
10219c240a7bSChristoph Hellwig#
1022c0b12405SJérôme Glisseconfig HMM_MIRROR
10239c240a7bSChristoph Hellwig	bool
1024f442c283SChristoph Hellwig	depends on MMU
1025c0b12405SJérôme Glisse
102614b80582SDan Williamsconfig GET_FREE_REGION
102714b80582SDan Williams	depends on SPARSEMEM
102814b80582SDan Williams	bool
102914b80582SDan Williams
10305042db43SJérôme Glisseconfig DEVICE_PRIVATE
10315042db43SJérôme Glisse	bool "Unaddressable device memory (GPU memory, ...)"
10327328d9ccSChristoph Hellwig	depends on ZONE_DEVICE
103314b80582SDan Williams	select GET_FREE_REGION
10345042db43SJérôme Glisse
10355042db43SJérôme Glisse	help
10365042db43SJérôme Glisse	  Allows creation of struct pages to represent unaddressable device
10375042db43SJérôme Glisse	  memory; i.e., memory that is only accessible from the device (or
10385042db43SJérôme Glisse	  group of devices). You likely also want to select HMM_MIRROR.
10395042db43SJérôme Glisse
10403e9a9e25SChristoph Hellwigconfig VMAP_PFN
10413e9a9e25SChristoph Hellwig	bool
10423e9a9e25SChristoph Hellwig
104363c17fb8SDave Hansenconfig ARCH_USES_HIGH_VMA_FLAGS
104463c17fb8SDave Hansen	bool
104566d37570SDave Hansenconfig ARCH_HAS_PKEYS
104666d37570SDave Hansen	bool
104730a5b536SDennis Zhou
1048b0284cd2SCatalin Marinasconfig ARCH_USES_PG_ARCH_X
1049b0284cd2SCatalin Marinas	bool
1050b0284cd2SCatalin Marinas	help
1051b0284cd2SCatalin Marinas	  Enable the definition of PG_arch_x page flags with x > 1. Only
1052b0284cd2SCatalin Marinas	  suitable for 64-bit architectures with CONFIG_FLATMEM or
1053b0284cd2SCatalin Marinas	  CONFIG_SPARSEMEM_VMEMMAP enabled, otherwise there may not be
1054b0284cd2SCatalin Marinas	  enough room for additional bits in page->flags.
1055b0284cd2SCatalin Marinas
10560710d012SVlastimil Babkaconfig VM_EVENT_COUNTERS
10570710d012SVlastimil Babka	default y
10580710d012SVlastimil Babka	bool "Enable VM event counters for /proc/vmstat" if EXPERT
10590710d012SVlastimil Babka	help
10600710d012SVlastimil Babka	  VM event counters are needed for event counts to be shown.
10610710d012SVlastimil Babka	  This option allows the disabling of the VM event counters
10620710d012SVlastimil Babka	  on EXPERT systems.  /proc/vmstat will only show page counts
10630710d012SVlastimil Babka	  if VM event counters are disabled.
10640710d012SVlastimil Babka
106530a5b536SDennis Zhouconfig PERCPU_STATS
106630a5b536SDennis Zhou	bool "Collect percpu memory statistics"
106730a5b536SDennis Zhou	help
106830a5b536SDennis Zhou	  This feature collects and exposes statistics via debugfs. The
106930a5b536SDennis Zhou	  information includes global and per chunk statistics, which can
107030a5b536SDennis Zhou	  be used to help understand percpu memory usage.
107164c349f4SKirill A. Shutemov
10729c84f229SJohn Hubbardconfig GUP_TEST
10739c84f229SJohn Hubbard	bool "Enable infrastructure for get_user_pages()-related unit tests"
1074d0de8241SBarry Song	depends on DEBUG_FS
107564c349f4SKirill A. Shutemov	help
10769c84f229SJohn Hubbard	  Provides /sys/kernel/debug/gup_test, which in turn provides a way
10779c84f229SJohn Hubbard	  to make ioctl calls that can launch kernel-based unit tests for
10789c84f229SJohn Hubbard	  the get_user_pages*() and pin_user_pages*() family of API calls.
107964c349f4SKirill A. Shutemov
10809c84f229SJohn Hubbard	  These tests include benchmark testing of the _fast variants of
10819c84f229SJohn Hubbard	  get_user_pages*() and pin_user_pages*(), as well as smoke tests of
10829c84f229SJohn Hubbard	  the non-_fast variants.
10839c84f229SJohn Hubbard
1084f4f9bda4SJohn Hubbard	  There is also a sub-test that allows running dump_page() on any
1085f4f9bda4SJohn Hubbard	  of up to eight pages (selected by command line args) within the
1086f4f9bda4SJohn Hubbard	  range of user-space addresses. These pages are either pinned via
1087f4f9bda4SJohn Hubbard	  pin_user_pages*(), or pinned via get_user_pages*(), as specified
1088f4f9bda4SJohn Hubbard	  by other command line arguments.
1089f4f9bda4SJohn Hubbard
1090baa489faSSeongJae Park	  See tools/testing/selftests/mm/gup_test.c
10913010a5eaSLaurent Dufour
1092d0de8241SBarry Songcomment "GUP_TEST needs to have DEBUG_FS enabled"
1093d0de8241SBarry Song	depends on !GUP_TEST && !DEBUG_FS
10943010a5eaSLaurent Dufour
10956ca297d4SPeter Zijlstraconfig GUP_GET_PXX_LOW_HIGH
109639656e83SChristoph Hellwig	bool
109739656e83SChristoph Hellwig
1098def85743SKeith Buschconfig DMAPOOL_TEST
1099def85743SKeith Busch	tristate "Enable a module to run time tests on dma_pool"
1100def85743SKeith Busch	depends on HAS_DMA
1101def85743SKeith Busch	help
1102def85743SKeith Busch	  Provides a test module that will allocate and free many blocks of
1103def85743SKeith Busch	  various sizes and report how long it takes. This is intended to
1104def85743SKeith Busch	  provide a consistent way to measure how changes to the
1105def85743SKeith Busch	  dma_pool_alloc/free routines affect performance.
1106def85743SKeith Busch
11073010a5eaSLaurent Dufourconfig ARCH_HAS_PTE_SPECIAL
11083010a5eaSLaurent Dufour	bool
110959e0b520SChristoph Hellwig
1110cbd34da7SChristoph Hellwig#
1111cbd34da7SChristoph Hellwig# Some architectures require a special hugepage directory format that is
1112cbd34da7SChristoph Hellwig# required to support multiple hugepage sizes. For example a4fe3ce76
1113cbd34da7SChristoph Hellwig# "powerpc/mm: Allow more flexible layouts for hugepage pagetables"
1114cbd34da7SChristoph Hellwig# introduced it on powerpc.  This allows for a more flexible hugepage
1115cbd34da7SChristoph Hellwig# pagetable layouts.
1116cbd34da7SChristoph Hellwig#
1117cbd34da7SChristoph Hellwigconfig ARCH_HAS_HUGEPD
1118cbd34da7SChristoph Hellwig	bool
1119cbd34da7SChristoph Hellwig
1120c5acad84SThomas Hellstromconfig MAPPING_DIRTY_HELPERS
1121c5acad84SThomas Hellstrom        bool
1122c5acad84SThomas Hellstrom
1123298fa1adSThomas Gleixnerconfig KMAP_LOCAL
1124298fa1adSThomas Gleixner	bool
1125298fa1adSThomas Gleixner
1126825c43f5SArd Biesheuvelconfig KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
1127825c43f5SArd Biesheuvel	bool
1128825c43f5SArd Biesheuvel
11291fbaf8fcSChristoph Hellwig# struct io_mapping based helper.  Selected by drivers that need them
11301fbaf8fcSChristoph Hellwigconfig IO_MAPPING
11311fbaf8fcSChristoph Hellwig	bool
11321507f512SMike Rapoport
11331507f512SMike Rapoportconfig SECRETMEM
113474947724SLukas Bulwahn	default y
113574947724SLukas Bulwahn	bool "Enable memfd_secret() system call" if EXPERT
113674947724SLukas Bulwahn	depends on ARCH_HAS_SET_DIRECT_MAP
113774947724SLukas Bulwahn	help
113874947724SLukas Bulwahn	  Enable the memfd_secret() system call with the ability to create
113974947724SLukas Bulwahn	  memory areas visible only in the context of the owning process and
114074947724SLukas Bulwahn	  not mapped to other processes and other kernel page tables.
11411507f512SMike Rapoport
11429a10064fSColin Crossconfig ANON_VMA_NAME
11439a10064fSColin Cross	bool "Anonymous VMA name support"
11449a10064fSColin Cross	depends on PROC_FS && ADVISE_SYSCALLS && MMU
11459a10064fSColin Cross
11469a10064fSColin Cross	help
11479a10064fSColin Cross	  Allow naming anonymous virtual memory areas.
11489a10064fSColin Cross
11499a10064fSColin Cross	  This feature allows assigning names to virtual memory areas. Assigned
11509a10064fSColin Cross	  names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
11519a10064fSColin Cross	  and help identifying individual anonymous memory areas.
11529a10064fSColin Cross	  Assigning a name to anonymous virtual memory area might prevent that
11539a10064fSColin Cross	  area from being merged with adjacent virtual memory areas due to the
11549a10064fSColin Cross	  difference in their name.
11559a10064fSColin Cross
1156430529b5SPeter Xuconfig USERFAULTFD
1157430529b5SPeter Xu	bool "Enable userfaultfd() system call"
1158430529b5SPeter Xu	depends on MMU
1159430529b5SPeter Xu	help
1160430529b5SPeter Xu	  Enable the userfaultfd() system call that allows to intercept and
1161430529b5SPeter Xu	  handle page faults in userland.
1162430529b5SPeter Xu
1163430529b5SPeter Xuconfig HAVE_ARCH_USERFAULTFD_WP
1164430529b5SPeter Xu	bool
1165430529b5SPeter Xu	help
1166430529b5SPeter Xu	  Arch has userfaultfd write protection support
1167430529b5SPeter Xu
1168430529b5SPeter Xuconfig HAVE_ARCH_USERFAULTFD_MINOR
1169430529b5SPeter Xu	bool
1170430529b5SPeter Xu	help
1171430529b5SPeter Xu	  Arch has userfaultfd minor fault support
1172430529b5SPeter Xu
11731db9dbc2SPeter Xuconfig PTE_MARKER_UFFD_WP
117481e0f15fSPeter Xu	bool "Userfaultfd write protection support for shmem/hugetlbfs"
117581e0f15fSPeter Xu	default y
117681e0f15fSPeter Xu	depends on HAVE_ARCH_USERFAULTFD_WP
11771db9dbc2SPeter Xu
11781db9dbc2SPeter Xu	help
11791db9dbc2SPeter Xu	  Allows to create marker PTEs for userfaultfd write protection
11801db9dbc2SPeter Xu	  purposes.  It is required to enable userfaultfd write protection on
11811db9dbc2SPeter Xu	  file-backed memory types like shmem and hugetlbfs.
11821db9dbc2SPeter Xu
1183ac35a490SYu Zhao# multi-gen LRU {
1184ec1c86b2SYu Zhaoconfig LRU_GEN
1185ec1c86b2SYu Zhao	bool "Multi-Gen LRU"
1186ec1c86b2SYu Zhao	depends on MMU
1187ec1c86b2SYu Zhao	# make sure folio->flags has enough spare bits
1188ec1c86b2SYu Zhao	depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
1189ec1c86b2SYu Zhao	help
119007017acbSYu Zhao	  A high performance LRU implementation to overcommit memory. See
119107017acbSYu Zhao	  Documentation/admin-guide/mm/multigen_lru.rst for details.
1192ec1c86b2SYu Zhao
1193354ed597SYu Zhaoconfig LRU_GEN_ENABLED
1194354ed597SYu Zhao	bool "Enable by default"
1195354ed597SYu Zhao	depends on LRU_GEN
1196354ed597SYu Zhao	help
1197354ed597SYu Zhao	  This option enables the multi-gen LRU by default.
1198354ed597SYu Zhao
1199ac35a490SYu Zhaoconfig LRU_GEN_STATS
1200ac35a490SYu Zhao	bool "Full stats for debugging"
1201ac35a490SYu Zhao	depends on LRU_GEN
1202ac35a490SYu Zhao	help
1203ac35a490SYu Zhao	  Do not enable this option unless you plan to look at historical stats
1204ac35a490SYu Zhao	  from evicted generations for debugging purpose.
1205ac35a490SYu Zhao
1206ac35a490SYu Zhao	  This option has a per-memcg and per-node memory overhead.
1207ac35a490SYu Zhao# }
1208ac35a490SYu Zhao
12090b6cc04fSSuren Baghdasaryanconfig ARCH_SUPPORTS_PER_VMA_LOCK
12100b6cc04fSSuren Baghdasaryan       def_bool n
12110b6cc04fSSuren Baghdasaryan
12120b6cc04fSSuren Baghdasaryanconfig PER_VMA_LOCK
12130b6cc04fSSuren Baghdasaryan	def_bool y
12140b6cc04fSSuren Baghdasaryan	depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP
12150b6cc04fSSuren Baghdasaryan	help
12160b6cc04fSSuren Baghdasaryan	  Allow per-vma locking during page fault handling.
12170b6cc04fSSuren Baghdasaryan
12180b6cc04fSSuren Baghdasaryan	  This feature allows locking each virtual memory area separately when
12190b6cc04fSSuren Baghdasaryan	  handling page faults instead of taking mmap_lock.
12200b6cc04fSSuren Baghdasaryan
12212224d848SSeongJae Parksource "mm/damon/Kconfig"
12222224d848SSeongJae Park
122359e0b520SChristoph Hellwigendmenu
1224