xref: /linux/mm/Kconfig (revision b7191581a973ab2fca45d2ca64416065f1660ae0)
1ec8f24b7SThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
259e0b520SChristoph Hellwig
359e0b520SChristoph Hellwigmenu "Memory Management options"
459e0b520SChristoph Hellwig
57b42f104SJohannes Weiner#
67b42f104SJohannes Weiner# For some reason microblaze and nios2 hard code SWAP=n.  Hopefully we can
77b42f104SJohannes Weiner# add proper SWAP support to them, in which case this can be remove.
87b42f104SJohannes Weiner#
97b42f104SJohannes Weinerconfig ARCH_NO_SWAP
107b42f104SJohannes Weiner	bool
117b42f104SJohannes Weiner
12b3fbd58fSJohannes Weinerconfig ZPOOL
13b3fbd58fSJohannes Weiner	bool
14b3fbd58fSJohannes Weiner
15519bcb79SJohannes Weinermenuconfig SWAP
167b42f104SJohannes Weiner	bool "Support for paging of anonymous memory (swap)"
177b42f104SJohannes Weiner	depends on MMU && BLOCK && !ARCH_NO_SWAP
187b42f104SJohannes Weiner	default y
197b42f104SJohannes Weiner	help
207b42f104SJohannes Weiner	  This option allows you to choose whether you want to have support
217b42f104SJohannes Weiner	  for so called swap devices or swap files in your kernel that are
227b42f104SJohannes Weiner	  used to provide more virtual memory than the actual RAM present
237b42f104SJohannes Weiner	  in your computer.  If unsure say Y.
247b42f104SJohannes Weiner
25519bcb79SJohannes Weinerconfig ZSWAP
26fcab9b44SDavid Heidelberg	bool "Compressed cache for swap pages"
27b3fbd58fSJohannes Weiner	depends on SWAP
28b3fbd58fSJohannes Weiner	select CRYPTO
29519bcb79SJohannes Weiner	select ZPOOL
30519bcb79SJohannes Weiner	help
31519bcb79SJohannes Weiner	  A lightweight compressed cache for swap pages.  It takes
32519bcb79SJohannes Weiner	  pages that are in the process of being swapped out and attempts to
33519bcb79SJohannes Weiner	  compress them into a dynamically allocated RAM-based memory pool.
34519bcb79SJohannes Weiner	  This can result in a significant I/O reduction on swap device and,
351a44131dSSophia Gabriella	  in the case where decompressing from RAM is faster than swap device
36519bcb79SJohannes Weiner	  reads, can also improve workload performance.
37519bcb79SJohannes Weiner
38b3fbd58fSJohannes Weinerconfig ZSWAP_DEFAULT_ON
39b3fbd58fSJohannes Weiner	bool "Enable the compressed cache for swap pages by default"
40b3fbd58fSJohannes Weiner	depends on ZSWAP
41b3fbd58fSJohannes Weiner	help
42b3fbd58fSJohannes Weiner	  If selected, the compressed cache for swap pages will be enabled
43b3fbd58fSJohannes Weiner	  at boot, otherwise it will be disabled.
44b3fbd58fSJohannes Weiner
45b3fbd58fSJohannes Weiner	  The selection made here can be overridden by using the kernel
46b3fbd58fSJohannes Weiner	  command line 'zswap.enabled=' option.
47b3fbd58fSJohannes Weiner
48b5ba474fSNhat Phamconfig ZSWAP_SHRINKER_DEFAULT_ON
49b5ba474fSNhat Pham	bool "Shrink the zswap pool on memory pressure"
50b5ba474fSNhat Pham	depends on ZSWAP
51b5ba474fSNhat Pham	default n
52b5ba474fSNhat Pham	help
53b5ba474fSNhat Pham	  If selected, the zswap shrinker will be enabled, and the pages
54b5ba474fSNhat Pham	  stored in the zswap pool will become available for reclaim (i.e
55b5ba474fSNhat Pham	  written back to the backing swap device) on memory pressure.
56b5ba474fSNhat Pham
57b5ba474fSNhat Pham	  This means that zswap writeback could happen even if the pool is
58b5ba474fSNhat Pham	  not yet full, or the cgroup zswap limit has not been reached,
59b5ba474fSNhat Pham	  reducing the chance that cold pages will reside in the zswap pool
60b5ba474fSNhat Pham	  and consume memory indefinitely.
61b5ba474fSNhat Pham
62519bcb79SJohannes Weinerchoice
63b3fbd58fSJohannes Weiner	prompt "Default compressor"
64519bcb79SJohannes Weiner	depends on ZSWAP
65519bcb79SJohannes Weiner	default ZSWAP_COMPRESSOR_DEFAULT_LZO
66519bcb79SJohannes Weiner	help
67519bcb79SJohannes Weiner	  Selects the default compression algorithm for the compressed cache
68519bcb79SJohannes Weiner	  for swap pages.
69519bcb79SJohannes Weiner
70519bcb79SJohannes Weiner	  For an overview what kind of performance can be expected from
71519bcb79SJohannes Weiner	  a particular compression algorithm please refer to the benchmarks
72519bcb79SJohannes Weiner	  available at the following LWN page:
73519bcb79SJohannes Weiner	  https://lwn.net/Articles/751795/
74519bcb79SJohannes Weiner
75519bcb79SJohannes Weiner	  If in doubt, select 'LZO'.
76519bcb79SJohannes Weiner
77519bcb79SJohannes Weiner	  The selection made here can be overridden by using the kernel
78519bcb79SJohannes Weiner	  command line 'zswap.compressor=' option.
79519bcb79SJohannes Weiner
80519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
81519bcb79SJohannes Weiner	bool "Deflate"
82519bcb79SJohannes Weiner	select CRYPTO_DEFLATE
83519bcb79SJohannes Weiner	help
84519bcb79SJohannes Weiner	  Use the Deflate algorithm as the default compression algorithm.
85519bcb79SJohannes Weiner
86519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZO
87519bcb79SJohannes Weiner	bool "LZO"
88519bcb79SJohannes Weiner	select CRYPTO_LZO
89519bcb79SJohannes Weiner	help
90519bcb79SJohannes Weiner	  Use the LZO algorithm as the default compression algorithm.
91519bcb79SJohannes Weiner
92519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_842
93519bcb79SJohannes Weiner	bool "842"
94519bcb79SJohannes Weiner	select CRYPTO_842
95519bcb79SJohannes Weiner	help
96519bcb79SJohannes Weiner	  Use the 842 algorithm as the default compression algorithm.
97519bcb79SJohannes Weiner
98519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4
99519bcb79SJohannes Weiner	bool "LZ4"
100519bcb79SJohannes Weiner	select CRYPTO_LZ4
101519bcb79SJohannes Weiner	help
102519bcb79SJohannes Weiner	  Use the LZ4 algorithm as the default compression algorithm.
103519bcb79SJohannes Weiner
104519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
105519bcb79SJohannes Weiner	bool "LZ4HC"
106519bcb79SJohannes Weiner	select CRYPTO_LZ4HC
107519bcb79SJohannes Weiner	help
108519bcb79SJohannes Weiner	  Use the LZ4HC algorithm as the default compression algorithm.
109519bcb79SJohannes Weiner
110519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT_ZSTD
111519bcb79SJohannes Weiner	bool "zstd"
112519bcb79SJohannes Weiner	select CRYPTO_ZSTD
113519bcb79SJohannes Weiner	help
114519bcb79SJohannes Weiner	  Use the zstd algorithm as the default compression algorithm.
115519bcb79SJohannes Weinerendchoice
116519bcb79SJohannes Weiner
117519bcb79SJohannes Weinerconfig ZSWAP_COMPRESSOR_DEFAULT
118519bcb79SJohannes Weiner       string
119519bcb79SJohannes Weiner       depends on ZSWAP
120519bcb79SJohannes Weiner       default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
121519bcb79SJohannes Weiner       default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
122519bcb79SJohannes Weiner       default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
123519bcb79SJohannes Weiner       default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
124519bcb79SJohannes Weiner       default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
125519bcb79SJohannes Weiner       default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
126519bcb79SJohannes Weiner       default ""
127519bcb79SJohannes Weiner
128519bcb79SJohannes Weinerchoice
129b3fbd58fSJohannes Weiner	prompt "Default allocator"
130519bcb79SJohannes Weiner	depends on ZSWAP
13104cb7502SMatthew Wilcox (Oracle)	default ZSWAP_ZPOOL_DEFAULT_ZSMALLOC if MMU
132519bcb79SJohannes Weiner	help
133519bcb79SJohannes Weiner	  Selects the default allocator for the compressed cache for
134519bcb79SJohannes Weiner	  swap pages.
135519bcb79SJohannes Weiner	  The default is 'zbud' for compatibility, however please do
136519bcb79SJohannes Weiner	  read the description of each of the allocators below before
137519bcb79SJohannes Weiner	  making a right choice.
138519bcb79SJohannes Weiner
139519bcb79SJohannes Weiner	  The selection made here can be overridden by using the kernel
140519bcb79SJohannes Weiner	  command line 'zswap.zpool=' option.
141519bcb79SJohannes Weiner
142519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
143519bcb79SJohannes Weiner	bool "zsmalloc"
144519bcb79SJohannes Weiner	select ZSMALLOC
145519bcb79SJohannes Weiner	help
146519bcb79SJohannes Weiner	  Use the zsmalloc allocator as the default allocator.
147519bcb79SJohannes Weinerendchoice
148519bcb79SJohannes Weiner
149519bcb79SJohannes Weinerconfig ZSWAP_ZPOOL_DEFAULT
150519bcb79SJohannes Weiner       string
151519bcb79SJohannes Weiner       depends on ZSWAP
152519bcb79SJohannes Weiner       default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
153519bcb79SJohannes Weiner       default ""
154519bcb79SJohannes Weiner
155519bcb79SJohannes Weinerconfig ZSMALLOC
156b3fbd58fSJohannes Weiner	tristate
1575ad7a998SSergey Senozhatsky	prompt "N:1 compression allocator (zsmalloc)" if (ZSWAP || ZRAM)
15804cb7502SMatthew Wilcox (Oracle)	depends on MMU
159519bcb79SJohannes Weiner	help
160519bcb79SJohannes Weiner	  zsmalloc is a slab-based memory allocator designed to store
161b3fbd58fSJohannes Weiner	  pages of various compression levels efficiently. It achieves
162b3fbd58fSJohannes Weiner	  the highest storage density with the least amount of fragmentation.
163519bcb79SJohannes Weiner
164519bcb79SJohannes Weinerconfig ZSMALLOC_STAT
165519bcb79SJohannes Weiner	bool "Export zsmalloc statistics"
166519bcb79SJohannes Weiner	depends on ZSMALLOC
167519bcb79SJohannes Weiner	select DEBUG_FS
168519bcb79SJohannes Weiner	help
169519bcb79SJohannes Weiner	  This option enables code in the zsmalloc to collect various
170519bcb79SJohannes Weiner	  statistics about what's happening in zsmalloc and exports that
171519bcb79SJohannes Weiner	  information to userspace via debugfs.
172519bcb79SJohannes Weiner	  If unsure, say N.
173519bcb79SJohannes Weiner
1744ff93b29SSergey Senozhatskyconfig ZSMALLOC_CHAIN_SIZE
1754ff93b29SSergey Senozhatsky	int "Maximum number of physical pages per-zspage"
176b46402faSSergey Senozhatsky	default 8
1774ff93b29SSergey Senozhatsky	range 4 16
1784ff93b29SSergey Senozhatsky	depends on ZSMALLOC
1794ff93b29SSergey Senozhatsky	help
1804ff93b29SSergey Senozhatsky	  This option sets the upper limit on the number of physical pages
1814ff93b29SSergey Senozhatsky	  that a zmalloc page (zspage) can consist of. The optimal zspage
1824ff93b29SSergey Senozhatsky	  chain size is calculated for each size class during the
1834ff93b29SSergey Senozhatsky	  initialization of the pool.
1844ff93b29SSergey Senozhatsky
1854ff93b29SSergey Senozhatsky	  Changing this option can alter the characteristics of size classes,
1864ff93b29SSergey Senozhatsky	  such as the number of pages per zspage and the number of objects
1874ff93b29SSergey Senozhatsky	  per zspage. This can also result in different configurations of
1884ff93b29SSergey Senozhatsky	  the pool, as zsmalloc merges size classes with similar
1894ff93b29SSergey Senozhatsky	  characteristics.
1904ff93b29SSergey Senozhatsky
1914ff93b29SSergey Senozhatsky	  For more information, see zsmalloc documentation.
1924ff93b29SSergey Senozhatsky
1932a19be61SVlastimil Babkamenu "Slab allocator options"
1947b42f104SJohannes Weiner
1957b42f104SJohannes Weinerconfig SLUB
1962a19be61SVlastimil Babka	def_bool y
197eb07c4f3SVlastimil Babka
198c9f8f124SVlastimil Babkaconfig KVFREE_RCU_BATCHED
199c9f8f124SVlastimil Babka	def_bool y
200c9f8f124SVlastimil Babka	depends on !SLUB_TINY && !TINY_RCU
201c9f8f124SVlastimil Babka
202e240e53aSVlastimil Babkaconfig SLUB_TINY
2032a19be61SVlastimil Babka	bool "Configure for minimal memory footprint"
2046f110a5eSLinus Torvalds	depends on EXPERT && !COMPILE_TEST
205e240e53aSVlastimil Babka	select SLAB_MERGE_DEFAULT
206e240e53aSVlastimil Babka	help
2072a19be61SVlastimil Babka	   Configures the slab allocator in a way to achieve minimal memory
208e240e53aSVlastimil Babka	   footprint, sacrificing scalability, debugging and other features.
209e240e53aSVlastimil Babka	   This is intended only for the smallest system that had used the
210e240e53aSVlastimil Babka	   SLOB allocator and is not recommended for systems with more than
211e240e53aSVlastimil Babka	   16MB RAM.
212e240e53aSVlastimil Babka
213e240e53aSVlastimil Babka	   If unsure, say N.
214e240e53aSVlastimil Babka
2157b42f104SJohannes Weinerconfig SLAB_MERGE_DEFAULT
2167b42f104SJohannes Weiner	bool "Allow slab caches to be merged"
2177b42f104SJohannes Weiner	default y
2187b42f104SJohannes Weiner	help
2197b42f104SJohannes Weiner	  For reduced kernel memory fragmentation, slab caches can be
2207b42f104SJohannes Weiner	  merged when they share the same size and other characteristics.
2217b42f104SJohannes Weiner	  This carries a risk of kernel heap overflows being able to
2227b42f104SJohannes Weiner	  overwrite objects from merged caches (and more easily control
2237b42f104SJohannes Weiner	  cache layout), which makes such heap attacks easier to exploit
2247b42f104SJohannes Weiner	  by attackers. By keeping caches unmerged, these kinds of exploits
2257b42f104SJohannes Weiner	  can usually only damage objects in the same cache. To disable
2267b42f104SJohannes Weiner	  merging at runtime, "slab_nomerge" can be passed on the kernel
2277b42f104SJohannes Weiner	  command line.
2287b42f104SJohannes Weiner
2297b42f104SJohannes Weinerconfig SLAB_FREELIST_RANDOM
2307b42f104SJohannes Weiner	bool "Randomize slab freelist"
2312a19be61SVlastimil Babka	depends on !SLUB_TINY
2327b42f104SJohannes Weiner	help
2337b42f104SJohannes Weiner	  Randomizes the freelist order used on creating new pages. This
2347b42f104SJohannes Weiner	  security feature reduces the predictability of the kernel slab
2357b42f104SJohannes Weiner	  allocator against heap overflows.
2367b42f104SJohannes Weiner
2377b42f104SJohannes Weinerconfig SLAB_FREELIST_HARDENED
2387b42f104SJohannes Weiner	bool "Harden slab freelist metadata"
2392a19be61SVlastimil Babka	depends on !SLUB_TINY
2407b42f104SJohannes Weiner	help
2417b42f104SJohannes Weiner	  Many kernel heap attacks try to target slab cache metadata and
2427b42f104SJohannes Weiner	  other infrastructure. This options makes minor performance
2437b42f104SJohannes Weiner	  sacrifices to harden the kernel slab allocator against common
2442a19be61SVlastimil Babka	  freelist exploit methods.
2457b42f104SJohannes Weiner
24667f2df3bSKees Cookconfig SLAB_BUCKETS
24767f2df3bSKees Cook	bool "Support allocation from separate kmalloc buckets"
24867f2df3bSKees Cook	depends on !SLUB_TINY
24967f2df3bSKees Cook	default SLAB_FREELIST_HARDENED
25067f2df3bSKees Cook	help
25167f2df3bSKees Cook	  Kernel heap attacks frequently depend on being able to create
25267f2df3bSKees Cook	  specifically-sized allocations with user-controlled contents
25367f2df3bSKees Cook	  that will be allocated into the same kmalloc bucket as a
25467f2df3bSKees Cook	  target object. To avoid sharing these allocation buckets,
25567f2df3bSKees Cook	  provide an explicitly separated set of buckets to be used for
25667f2df3bSKees Cook	  user-controlled allocations. This may very slightly increase
25767f2df3bSKees Cook	  memory fragmentation, though in practice it's only a handful
25867f2df3bSKees Cook	  of extra pages since the bulk of user-controlled allocations
25967f2df3bSKees Cook	  are relatively long-lived.
26067f2df3bSKees Cook
26167f2df3bSKees Cook	  If unsure, say Y.
26267f2df3bSKees Cook
2630710d012SVlastimil Babkaconfig SLUB_STATS
2640710d012SVlastimil Babka	default n
2652a19be61SVlastimil Babka	bool "Enable performance statistics"
2662a19be61SVlastimil Babka	depends on SYSFS && !SLUB_TINY
2670710d012SVlastimil Babka	help
2682a19be61SVlastimil Babka	  The statistics are useful to debug slab allocation behavior in
2690710d012SVlastimil Babka	  order find ways to optimize the allocator. This should never be
2700710d012SVlastimil Babka	  enabled for production use since keeping statistics slows down
2710710d012SVlastimil Babka	  the allocator by a few percentage points. The slabinfo command
2720710d012SVlastimil Babka	  supports the determination of the most active slabs to figure
2730710d012SVlastimil Babka	  out which slabs are relevant to a particular load.
2740710d012SVlastimil Babka	  Try running: slabinfo -DA
2750710d012SVlastimil Babka
276519bcb79SJohannes Weinerconfig SLUB_CPU_PARTIAL
277519bcb79SJohannes Weiner	default y
2782a19be61SVlastimil Babka	depends on SMP && !SLUB_TINY
2792a19be61SVlastimil Babka	bool "Enable per cpu partial caches"
280519bcb79SJohannes Weiner	help
281519bcb79SJohannes Weiner	  Per cpu partial caches accelerate objects allocation and freeing
282519bcb79SJohannes Weiner	  that is local to a processor at the price of more indeterminism
283519bcb79SJohannes Weiner	  in the latency of the free. On overflow these caches will be cleared
284519bcb79SJohannes Weiner	  which requires the taking of locks that may cause latency spikes.
285519bcb79SJohannes Weiner	  Typically one would choose no for a realtime system.
286519bcb79SJohannes Weiner
2873c615294SGONG, Ruiqiconfig RANDOM_KMALLOC_CACHES
2883c615294SGONG, Ruiqi	default n
2892a19be61SVlastimil Babka	depends on !SLUB_TINY
2903c615294SGONG, Ruiqi	bool "Randomize slab caches for normal kmalloc"
2913c615294SGONG, Ruiqi	help
2923c615294SGONG, Ruiqi	  A hardening feature that creates multiple copies of slab caches for
2933c615294SGONG, Ruiqi	  normal kmalloc allocation and makes kmalloc randomly pick one based
2943c615294SGONG, Ruiqi	  on code address, which makes the attackers more difficult to spray
2953c615294SGONG, Ruiqi	  vulnerable memory objects on the heap for the purpose of exploiting
2963c615294SGONG, Ruiqi	  memory vulnerabilities.
2973c615294SGONG, Ruiqi
2983c615294SGONG, Ruiqi	  Currently the number of copies is set to 16, a reasonably large value
2993c615294SGONG, Ruiqi	  that effectively diverges the memory objects allocated for different
3003c615294SGONG, Ruiqi	  subsystems or modules into different caches, at the expense of a
3013c615294SGONG, Ruiqi	  limited degree of memory and CPU overhead that relates to hardware and
3023c615294SGONG, Ruiqi	  system workload.
3033c615294SGONG, Ruiqi
3042a19be61SVlastimil Babkaendmenu # Slab allocator options
305519bcb79SJohannes Weiner
3067b42f104SJohannes Weinerconfig SHUFFLE_PAGE_ALLOCATOR
3077b42f104SJohannes Weiner	bool "Page allocator randomization"
3087b42f104SJohannes Weiner	default SLAB_FREELIST_RANDOM && ACPI_NUMA
3097b42f104SJohannes Weiner	help
3107b42f104SJohannes Weiner	  Randomization of the page allocator improves the average
3117b42f104SJohannes Weiner	  utilization of a direct-mapped memory-side-cache. See section
3127b42f104SJohannes Weiner	  5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
3137b42f104SJohannes Weiner	  6.2a specification for an example of how a platform advertises
3147b42f104SJohannes Weiner	  the presence of a memory-side-cache. There are also incidental
3157b42f104SJohannes Weiner	  security benefits as it reduces the predictability of page
3167b42f104SJohannes Weiner	  allocations to compliment SLAB_FREELIST_RANDOM, but the
3175e0a760bSKirill A. Shutemov	  default granularity of shuffling on the MAX_PAGE_ORDER i.e, 10th
31823baf831SKirill A. Shutemov	  order of pages is selected based on cache utilization benefits
31923baf831SKirill A. Shutemov	  on x86.
3207b42f104SJohannes Weiner
3217b42f104SJohannes Weiner	  While the randomization improves cache utilization it may
3227b42f104SJohannes Weiner	  negatively impact workloads on platforms without a cache. For
323b413f9cdSMaíra Canal	  this reason, by default, the randomization is not enabled even
324b413f9cdSMaíra Canal	  if SHUFFLE_PAGE_ALLOCATOR=y. The randomization may be force enabled
325b413f9cdSMaíra Canal	  with the 'page_alloc.shuffle' kernel command line parameter.
3267b42f104SJohannes Weiner
3277b42f104SJohannes Weiner	  Say Y if unsure.
3287b42f104SJohannes Weiner
3290710d012SVlastimil Babkaconfig COMPAT_BRK
3300710d012SVlastimil Babka	bool "Disable heap randomization"
3310710d012SVlastimil Babka	default y
3320710d012SVlastimil Babka	help
3330710d012SVlastimil Babka	  Randomizing heap placement makes heap exploits harder, but it
3340710d012SVlastimil Babka	  also breaks ancient binaries (including anything libc5 based).
3350710d012SVlastimil Babka	  This option changes the bootup default to heap randomization
3360710d012SVlastimil Babka	  disabled, and can be overridden at runtime by setting
3370710d012SVlastimil Babka	  /proc/sys/kernel/randomize_va_space to 2.
3380710d012SVlastimil Babka
3390710d012SVlastimil Babka	  On non-ancient distros (post-2000 ones) N is usually a safe choice.
3400710d012SVlastimil Babka
3410710d012SVlastimil Babkaconfig MMAP_ALLOW_UNINITIALIZED
3420710d012SVlastimil Babka	bool "Allow mmapped anonymous memory to be uninitialized"
3430710d012SVlastimil Babka	depends on EXPERT && !MMU
3440710d012SVlastimil Babka	default n
3450710d012SVlastimil Babka	help
3460710d012SVlastimil Babka	  Normally, and according to the Linux spec, anonymous memory obtained
3470710d012SVlastimil Babka	  from mmap() has its contents cleared before it is passed to
3480710d012SVlastimil Babka	  userspace.  Enabling this config option allows you to request that
3490710d012SVlastimil Babka	  mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
3500710d012SVlastimil Babka	  providing a huge performance boost.  If this option is not enabled,
3510710d012SVlastimil Babka	  then the flag will be ignored.
3520710d012SVlastimil Babka
3530710d012SVlastimil Babka	  This is taken advantage of by uClibc's malloc(), and also by
3540710d012SVlastimil Babka	  ELF-FDPIC binfmt's brk and stack allocator.
3550710d012SVlastimil Babka
3560710d012SVlastimil Babka	  Because of the obvious security issues, this option should only be
3570710d012SVlastimil Babka	  enabled on embedded devices where you control what is run in
3580710d012SVlastimil Babka	  userspace.  Since that isn't generally a problem on no-MMU systems,
3590710d012SVlastimil Babka	  it is normally safe to say Y here.
3600710d012SVlastimil Babka
3610710d012SVlastimil Babka	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
3620710d012SVlastimil Babka
363e1785e85SDave Hansenconfig SELECT_MEMORY_MODEL
364e1785e85SDave Hansen	def_bool y
365a8826eebSKees Cook	depends on ARCH_SELECT_MEMORY_MODEL
366e1785e85SDave Hansen
3673a9da765SDave Hansenchoice
3683a9da765SDave Hansen	prompt "Memory model"
369e1785e85SDave Hansen	depends on SELECT_MEMORY_MODEL
370d41dee36SAndy Whitcroft	default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
371e1785e85SDave Hansen	default FLATMEM_MANUAL
372d66d109dSMike Rapoport	help
373d66d109dSMike Rapoport	  This option allows you to change some of the ways that
374d66d109dSMike Rapoport	  Linux manages its memory internally. Most users will
375d66d109dSMike Rapoport	  only have one option here selected by the architecture
376d66d109dSMike Rapoport	  configuration. This is normal.
3773a9da765SDave Hansen
378e1785e85SDave Hansenconfig FLATMEM_MANUAL
3793a9da765SDave Hansen	bool "Flat Memory"
380bb1c50d3SMike Rapoport	depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
3813a9da765SDave Hansen	help
382d66d109dSMike Rapoport	  This option is best suited for non-NUMA systems with
383d66d109dSMike Rapoport	  flat address space. The FLATMEM is the most efficient
384d66d109dSMike Rapoport	  system in terms of performance and resource consumption
385d66d109dSMike Rapoport	  and it is the best option for smaller systems.
3863a9da765SDave Hansen
387d66d109dSMike Rapoport	  For systems that have holes in their physical address
388d66d109dSMike Rapoport	  spaces and for features like NUMA and memory hotplug,
389dd33d29aSRandy Dunlap	  choose "Sparse Memory".
390d41dee36SAndy Whitcroft
391d41dee36SAndy Whitcroft	  If unsure, choose this option (Flat Memory) over any other.
3923a9da765SDave Hansen
393d41dee36SAndy Whitcroftconfig SPARSEMEM_MANUAL
394d41dee36SAndy Whitcroft	bool "Sparse Memory"
395d41dee36SAndy Whitcroft	depends on ARCH_SPARSEMEM_ENABLE
396d41dee36SAndy Whitcroft	help
397d41dee36SAndy Whitcroft	  This will be the only option for some systems, including
398d66d109dSMike Rapoport	  memory hot-plug systems.  This is normal.
399d41dee36SAndy Whitcroft
400d66d109dSMike Rapoport	  This option provides efficient support for systems with
401d66d109dSMike Rapoport	  holes is their physical address space and allows memory
402d66d109dSMike Rapoport	  hot-plug and hot-remove.
403d41dee36SAndy Whitcroft
404d66d109dSMike Rapoport	  If unsure, choose "Flat Memory" over this option.
405d41dee36SAndy Whitcroft
4063a9da765SDave Hansenendchoice
4073a9da765SDave Hansen
408d41dee36SAndy Whitcroftconfig SPARSEMEM
409d41dee36SAndy Whitcroft	def_bool y
4101a83e175SRussell King	depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
411d41dee36SAndy Whitcroft
412e1785e85SDave Hansenconfig FLATMEM
413e1785e85SDave Hansen	def_bool y
414bb1c50d3SMike Rapoport	depends on !SPARSEMEM || FLATMEM_MANUAL
415d41dee36SAndy Whitcroft
41693b7504eSDave Hansen#
4173e347261SBob Picco# SPARSEMEM_EXTREME (which is the default) does some bootmem
418c89ab04fSMike Rapoport# allocations when sparse_init() is called.  If this cannot
4193e347261SBob Picco# be done on your architecture, select this option.  However,
4203e347261SBob Picco# statically allocating the mem_section[] array can potentially
4213e347261SBob Picco# consume vast quantities of .bss, so be careful.
4223e347261SBob Picco#
4233e347261SBob Picco# This option will also potentially produce smaller runtime code
4243e347261SBob Picco# with gcc 3.4 and later.
4253e347261SBob Picco#
4263e347261SBob Piccoconfig SPARSEMEM_STATIC
4279ba16087SJan Beulich	bool
4283e347261SBob Picco
4293e347261SBob Picco#
43044c09201SMatt LaPlante# Architecture platforms which require a two level mem_section in SPARSEMEM
431802f192eSBob Picco# must select this option. This is usually for architecture platforms with
432802f192eSBob Picco# an extremely sparse physical address space.
433802f192eSBob Picco#
4343e347261SBob Piccoconfig SPARSEMEM_EXTREME
4353e347261SBob Picco	def_bool y
4363e347261SBob Picco	depends on SPARSEMEM && !SPARSEMEM_STATIC
4374c21e2f2SHugh Dickins
43829c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP_ENABLE
4399ba16087SJan Beulich	bool
44029c71111SAndy Whitcroft
44129c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP
442a5ee6daaSGeoff Levand	bool "Sparse Memory virtual memmap"
443a5ee6daaSGeoff Levand	depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
444a5ee6daaSGeoff Levand	default y
445a5ee6daaSGeoff Levand	help
446a5ee6daaSGeoff Levand	  SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
447a5ee6daaSGeoff Levand	  pfn_to_page and page_to_pfn operations.  This is the most
448a5ee6daaSGeoff Levand	  efficient option when sufficient kernel resources are available.
449d65917c4SFrank van der Linden
450d65917c4SFrank van der Lindenconfig SPARSEMEM_VMEMMAP_PREINIT
451d65917c4SFrank van der Linden	bool
4520b376f1eSAneesh Kumar K.V#
4530b376f1eSAneesh Kumar K.V# Select this config option from the architecture Kconfig, if it is preferred
4540b376f1eSAneesh Kumar K.V# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
4550b376f1eSAneesh Kumar K.V#
4560b6f1582SAneesh Kumar K.Vconfig ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
4570b6f1582SAneesh Kumar K.V	bool
4580b6f1582SAneesh Kumar K.V
4590b6f1582SAneesh Kumar K.Vconfig ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
4600b376f1eSAneesh Kumar K.V	bool
46129c71111SAndy Whitcroft
462d65917c4SFrank van der Lindenconfig ARCH_WANT_HUGETLB_VMEMMAP_PREINIT
463d65917c4SFrank van der Linden	bool
464d65917c4SFrank van der Linden
46570210ed9SPhilipp Hachtmannconfig HAVE_MEMBLOCK_PHYS_MAP
4666341e62bSChristoph Jaeger	bool
46770210ed9SPhilipp Hachtmann
46825176ad0SDavid Hildenbrandconfig HAVE_GUP_FAST
469050a9adcSChristoph Hellwig	depends on MMU
4706341e62bSChristoph Jaeger	bool
4712667f50eSSteve Capper
472d59f43b5SAlexander Graf# Enable memblock support for scratch memory which is needed for kexec handover
473d59f43b5SAlexander Grafconfig MEMBLOCK_KHO_SCRATCH
474d59f43b5SAlexander Graf	bool
475d59f43b5SAlexander Graf
47652219aeaSDavid Hildenbrand# Don't discard allocated memory used to track "memory" and "reserved" memblocks
47752219aeaSDavid Hildenbrand# after early boot, so it can still be used to test for validity of memory.
47852219aeaSDavid Hildenbrand# Also, memblocks are updated with memory hot(un)plug.
479350e88baSMike Rapoportconfig ARCH_KEEP_MEMBLOCK
4806341e62bSChristoph Jaeger	bool
481c378ddd5STejun Heo
4821e5d8e1eSDan Williams# Keep arch NUMA mapping infrastructure post-init.
4831e5d8e1eSDan Williamsconfig NUMA_KEEP_MEMINFO
4841e5d8e1eSDan Williams	bool
4851e5d8e1eSDan Williams
486ee6f509cSMinchan Kimconfig MEMORY_ISOLATION
4876341e62bSChristoph Jaeger	bool
488ee6f509cSMinchan Kim
489a9e7b8d4SDavid Hildenbrand# IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked
490a9e7b8d4SDavid Hildenbrand# IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via
491a9e7b8d4SDavid Hildenbrand# /dev/mem.
492a9e7b8d4SDavid Hildenbrandconfig EXCLUSIVE_SYSTEM_RAM
493a9e7b8d4SDavid Hildenbrand	def_bool y
494a9e7b8d4SDavid Hildenbrand	depends on !DEVMEM || STRICT_DEVMEM
495a9e7b8d4SDavid Hildenbrand
49646723bfaSYasuaki Ishimatsu#
49746723bfaSYasuaki Ishimatsu# Only be set on architectures that have completely implemented memory hotplug
49846723bfaSYasuaki Ishimatsu# feature. If you are not sure, don't touch it.
49946723bfaSYasuaki Ishimatsu#
50046723bfaSYasuaki Ishimatsuconfig HAVE_BOOTMEM_INFO_NODE
50146723bfaSYasuaki Ishimatsu	def_bool n
50246723bfaSYasuaki Ishimatsu
50391024b3cSAnshuman Khandualconfig ARCH_ENABLE_MEMORY_HOTPLUG
50491024b3cSAnshuman Khandual	bool
50591024b3cSAnshuman Khandual
506519bcb79SJohannes Weinerconfig ARCH_ENABLE_MEMORY_HOTREMOVE
507519bcb79SJohannes Weiner	bool
508519bcb79SJohannes Weiner
5093947be19SDave Hansen# eventually, we can have this option just 'select SPARSEMEM'
510519bcb79SJohannes Weinermenuconfig MEMORY_HOTPLUG
511519bcb79SJohannes Weiner	bool "Memory hotplug"
512b30c5927SDavid Hildenbrand	select MEMORY_ISOLATION
51371b6f2ddSDavid Hildenbrand	depends on SPARSEMEM
51440b31360SStephen Rothwell	depends on ARCH_ENABLE_MEMORY_HOTPLUG
5157ec58a2bSDavid Hildenbrand	depends on 64BIT
5161e5d8e1eSDan Williams	select NUMA_KEEP_MEMINFO if NUMA
5173947be19SDave Hansen
518519bcb79SJohannes Weinerif MEMORY_HOTPLUG
519519bcb79SJohannes Weiner
52044d46b76SGregory Pricechoice
52144d46b76SGregory Price	prompt "Memory Hotplug Default Online Type"
52244d46b76SGregory Price	default MHP_DEFAULT_ONLINE_TYPE_OFFLINE
5238604d9e5SVitaly Kuznetsov	help
52444d46b76SGregory Price	  Default memory type for hotplugged memory.
52544d46b76SGregory Price
5268604d9e5SVitaly Kuznetsov	  This option sets the default policy setting for memory hotplug
5278604d9e5SVitaly Kuznetsov	  onlining policy (/sys/devices/system/memory/auto_online_blocks) which
5288604d9e5SVitaly Kuznetsov	  determines what happens to newly added memory regions. Policy setting
5298604d9e5SVitaly Kuznetsov	  can always be changed at runtime.
53044d46b76SGregory Price
53144d46b76SGregory Price	  The default is 'offline'.
53244d46b76SGregory Price
53344d46b76SGregory Price	  Select offline to defer onlining to drivers and user policy.
53444d46b76SGregory Price	  Select auto to let the kernel choose what zones to utilize.
53544d46b76SGregory Price	  Select online_kernel to generally allow kernel usage of this memory.
53644d46b76SGregory Price	  Select online_movable to generally disallow kernel usage of this memory.
53744d46b76SGregory Price
53844d46b76SGregory Price	  Example kernel usage would be page structs and page tables.
53944d46b76SGregory Price
540cb1aaebeSMauro Carvalho Chehab	  See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
5418604d9e5SVitaly Kuznetsov
54244d46b76SGregory Priceconfig MHP_DEFAULT_ONLINE_TYPE_OFFLINE
54344d46b76SGregory Price	bool "offline"
54444d46b76SGregory Price	help
54544d46b76SGregory Price	  Hotplugged memory will not be onlined by default.
54644d46b76SGregory Price	  Choose this for systems with drivers and user policy that
54744d46b76SGregory Price	  handle onlining of hotplug memory policy.
54844d46b76SGregory Price
54944d46b76SGregory Priceconfig MHP_DEFAULT_ONLINE_TYPE_ONLINE_AUTO
55044d46b76SGregory Price	bool "auto"
55144d46b76SGregory Price	help
55244d46b76SGregory Price	  Select this if you want the kernel to automatically online
55344d46b76SGregory Price	  hotplugged memory into the zone it thinks is reasonable.
55444d46b76SGregory Price	  This memory may be utilized for kernel data.
55544d46b76SGregory Price
55644d46b76SGregory Priceconfig MHP_DEFAULT_ONLINE_TYPE_ONLINE_KERNEL
55744d46b76SGregory Price	bool "kernel"
55844d46b76SGregory Price	help
55944d46b76SGregory Price	  Select this if you want the kernel to automatically online
56044d46b76SGregory Price	  hotplugged memory into a zone capable of being used for kernel
56144d46b76SGregory Price	  data. This typically means ZONE_NORMAL.
56244d46b76SGregory Price
56344d46b76SGregory Priceconfig MHP_DEFAULT_ONLINE_TYPE_ONLINE_MOVABLE
56444d46b76SGregory Price	bool "movable"
56544d46b76SGregory Price	help
56644d46b76SGregory Price	  Select this if you want the kernel to automatically online
56744d46b76SGregory Price	  hotplug memory into ZONE_MOVABLE. This memory will generally
56844d46b76SGregory Price	  not be utilized for kernel data.
56944d46b76SGregory Price
57044d46b76SGregory Price	  This should only be used when the admin knows sufficient
57144d46b76SGregory Price	  ZONE_NORMAL memory is available to describe hotplug memory,
57244d46b76SGregory Price	  otherwise hotplug memory may fail to online. For example,
57344d46b76SGregory Price	  sufficient kernel-capable memory (ZONE_NORMAL) must be
57444d46b76SGregory Price	  available to allocate page structs to describe ZONE_MOVABLE.
57544d46b76SGregory Price
57644d46b76SGregory Priceendchoice
5778604d9e5SVitaly Kuznetsov
5780c0e6195SKAMEZAWA Hiroyukiconfig MEMORY_HOTREMOVE
5790c0e6195SKAMEZAWA Hiroyuki	bool "Allow for memory hot remove"
580f7e3334aSNathan Fontenot	select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
5810c0e6195SKAMEZAWA Hiroyuki	depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
5820c0e6195SKAMEZAWA Hiroyuki	depends on MIGRATION
5830c0e6195SKAMEZAWA Hiroyuki
584a08a2ae3SOscar Salvadorconfig MHP_MEMMAP_ON_MEMORY
585a08a2ae3SOscar Salvador	def_bool y
586a08a2ae3SOscar Salvador	depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
587a08a2ae3SOscar Salvador	depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
588a08a2ae3SOscar Salvador
589519bcb79SJohannes Weinerendif # MEMORY_HOTPLUG
590519bcb79SJohannes Weiner
59104d5ea46SAneesh Kumar K.Vconfig ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
59204d5ea46SAneesh Kumar K.V       bool
59304d5ea46SAneesh Kumar K.V
5944c21e2f2SHugh Dickins# Heavily threaded applications may benefit from splitting the mm-wide
5954c21e2f2SHugh Dickins# page_table_lock, so that faults on different parts of the user address
5964c21e2f2SHugh Dickins# space can be handled with less contention: split it at this NR_CPUS.
5974c21e2f2SHugh Dickins# Default to 4 for wider testing, though 8 might be more appropriate.
5984c21e2f2SHugh Dickins# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
5997b6ac9dfSHugh Dickins# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
60060bccaa6SWill Deacon# SPARC32 allocates multiple pte tables within a single page, and therefore
60160bccaa6SWill Deacon# a per-page lock leads to problems when multiple tables need to be locked
60260bccaa6SWill Deacon# at the same time (e.g. copy_page_range()).
603a70caa8bSHugh Dickins# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
6044c21e2f2SHugh Dickins#
605394290cbSDavid Hildenbrandconfig SPLIT_PTE_PTLOCKS
606394290cbSDavid Hildenbrand	def_bool y
607394290cbSDavid Hildenbrand	depends on MMU
608a3344078SGuenter Roeck	depends on SMP
609394290cbSDavid Hildenbrand	depends on NR_CPUS >= 4
610394290cbSDavid Hildenbrand	depends on !ARM || CPU_CACHE_VIPT
611394290cbSDavid Hildenbrand	depends on !PARISC || PA20
612394290cbSDavid Hildenbrand	depends on !SPARC32
6137cbe34cfSChristoph Lameter
614e009bb30SKirill A. Shutemovconfig ARCH_ENABLE_SPLIT_PMD_PTLOCK
6156341e62bSChristoph Jaeger	bool
616e009bb30SKirill A. Shutemov
617394290cbSDavid Hildenbrandconfig SPLIT_PMD_PTLOCKS
618394290cbSDavid Hildenbrand	def_bool y
619394290cbSDavid Hildenbrand	depends on SPLIT_PTE_PTLOCKS && ARCH_ENABLE_SPLIT_PMD_PTLOCK
620394290cbSDavid Hildenbrand
6217cbe34cfSChristoph Lameter#
62209316c09SKonstantin Khlebnikov# support for memory balloon
62309316c09SKonstantin Khlebnikovconfig MEMORY_BALLOON
6246341e62bSChristoph Jaeger	bool
62509316c09SKonstantin Khlebnikov
62609316c09SKonstantin Khlebnikov#
62718468d93SRafael Aquini# support for memory balloon compaction
62818468d93SRafael Aquiniconfig BALLOON_COMPACTION
62918468d93SRafael Aquini	bool "Allow for balloon memory compaction/migration"
630cd14b018SMasahiro Yamada	default y
63109316c09SKonstantin Khlebnikov	depends on COMPACTION && MEMORY_BALLOON
63218468d93SRafael Aquini	help
63318468d93SRafael Aquini	  Memory fragmentation introduced by ballooning might reduce
63418468d93SRafael Aquini	  significantly the number of 2MB contiguous memory blocks that can be
63518468d93SRafael Aquini	  used within a guest, thus imposing performance penalties associated
63618468d93SRafael Aquini	  with the reduced number of transparent huge pages that could be used
63718468d93SRafael Aquini	  by the guest workload. Allowing the compaction & migration for memory
63818468d93SRafael Aquini	  pages enlisted as being part of memory balloon devices avoids the
63918468d93SRafael Aquini	  scenario aforementioned and helps improving memory defragmentation.
64018468d93SRafael Aquini
64118468d93SRafael Aquini#
642e9e96b39SMel Gorman# support for memory compaction
643e9e96b39SMel Gormanconfig COMPACTION
644e9e96b39SMel Gorman	bool "Allow for memory compaction"
645cd14b018SMasahiro Yamada	default y
646e9e96b39SMel Gorman	select MIGRATION
64733a93877SAndrea Arcangeli	depends on MMU
648e9e96b39SMel Gorman	help
649b32eaf71SMichal Hocko	  Compaction is the only memory management component to form
650b32eaf71SMichal Hocko	  high order (larger physically contiguous) memory blocks
651b32eaf71SMichal Hocko	  reliably. The page allocator relies on compaction heavily and
652b32eaf71SMichal Hocko	  the lack of the feature can lead to unexpected OOM killer
653b32eaf71SMichal Hocko	  invocations for high order memory requests. You shouldn't
654b32eaf71SMichal Hocko	  disable this option unless there really is a strong reason for
655b32eaf71SMichal Hocko	  it and then we would be really interested to hear about that at
656b32eaf71SMichal Hocko	  linux-mm@kvack.org.
657e9e96b39SMel Gorman
658c7e0b3d0SThomas Gleixnerconfig COMPACT_UNEVICTABLE_DEFAULT
659c7e0b3d0SThomas Gleixner	int
660c7e0b3d0SThomas Gleixner	depends on COMPACTION
661c7e0b3d0SThomas Gleixner	default 0 if PREEMPT_RT
662c7e0b3d0SThomas Gleixner	default 1
663c7e0b3d0SThomas Gleixner
664e9e96b39SMel Gorman#
66536e66c55SAlexander Duyck# support for free page reporting
66636e66c55SAlexander Duyckconfig PAGE_REPORTING
66736e66c55SAlexander Duyck	bool "Free page reporting"
66836e66c55SAlexander Duyck	help
66936e66c55SAlexander Duyck	  Free page reporting allows for the incremental acquisition of
67036e66c55SAlexander Duyck	  free pages from the buddy allocator for the purpose of reporting
67136e66c55SAlexander Duyck	  those pages to another entity, such as a hypervisor, so that the
67236e66c55SAlexander Duyck	  memory can be freed within the host for other uses.
67336e66c55SAlexander Duyck
67436e66c55SAlexander Duyck#
6757cbe34cfSChristoph Lameter# support for page migration
6767cbe34cfSChristoph Lameter#
6777cbe34cfSChristoph Lameterconfig MIGRATION
678b20a3503SChristoph Lameter	bool "Page migration"
679cd14b018SMasahiro Yamada	default y
680de32a817SChen Gang	depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
681b20a3503SChristoph Lameter	help
682b20a3503SChristoph Lameter	  Allows the migration of the physical location of pages of processes
683e9e96b39SMel Gorman	  while the virtual addresses are not changed. This is useful in
684e9e96b39SMel Gorman	  two situations. The first is on NUMA systems to put pages nearer
685e9e96b39SMel Gorman	  to the processors accessing. The second is when allocating huge
686e9e96b39SMel Gorman	  pages as migration can relocate pages to satisfy a huge page
687e9e96b39SMel Gorman	  allocation instead of reclaiming.
6886550e07fSGreg Kroah-Hartman
68976cbbeadSChristoph Hellwigconfig DEVICE_MIGRATION
690d90a25f8SChristoph Hellwig	def_bool MIGRATION && ZONE_DEVICE
69176cbbeadSChristoph Hellwig
692c177c81eSNaoya Horiguchiconfig ARCH_ENABLE_HUGEPAGE_MIGRATION
6936341e62bSChristoph Jaeger	bool
694c177c81eSNaoya Horiguchi
6959c670ea3SNaoya Horiguchiconfig ARCH_ENABLE_THP_MIGRATION
6969c670ea3SNaoya Horiguchi	bool
6979c670ea3SNaoya Horiguchi
6984bfb68a0SAnshuman Khandualconfig HUGETLB_PAGE_SIZE_VARIABLE
6994bfb68a0SAnshuman Khandual	def_bool n
7004bfb68a0SAnshuman Khandual	help
7014bfb68a0SAnshuman Khandual	  Allows the pageblock_order value to be dynamic instead of just standard
7024bfb68a0SAnshuman Khandual	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
7034bfb68a0SAnshuman Khandual	  on a platform.
7044bfb68a0SAnshuman Khandual
7055e0a760bSKirill A. Shutemov	  Note that the pageblock_order cannot exceed MAX_PAGE_ORDER and will be
7065e0a760bSKirill A. Shutemov	  clamped down to MAX_PAGE_ORDER.
707b3d40a2bSDavid Hildenbrand
7088df995f6SAlexandre Ghiticonfig CONTIG_ALLOC
7098df995f6SAlexandre Ghiti	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
7108df995f6SAlexandre Ghiti
71152166607SHuang Yingconfig PCP_BATCH_SCALE_MAX
71252166607SHuang Ying	int "Maximum scale factor of PCP (Per-CPU pageset) batch allocate/free"
71352166607SHuang Ying	default 5
71452166607SHuang Ying	range 0 6
71552166607SHuang Ying	help
71652166607SHuang Ying	  In page allocator, PCP (Per-CPU pageset) is refilled and drained in
71752166607SHuang Ying	  batches.  The batch number is scaled automatically to improve page
71852166607SHuang Ying	  allocation/free throughput.  But too large scale factor may hurt
71952166607SHuang Ying	  latency.  This option sets the upper limit of scale factor to limit
72052166607SHuang Ying	  the maximum latency.
72152166607SHuang Ying
722600715dcSJeremy Fitzhardingeconfig PHYS_ADDR_T_64BIT
723d4a451d5SChristoph Hellwig	def_bool 64BIT
724600715dcSJeremy Fitzhardinge
7252a7326b5SChristoph Lameterconfig BOUNCE
7269ca24e2eSVinayak Menon	bool "Enable bounce buffers"
7279ca24e2eSVinayak Menon	default y
728ce288e05SChristoph Hellwig	depends on BLOCK && MMU && HIGHMEM
7299ca24e2eSVinayak Menon	help
730ce288e05SChristoph Hellwig	  Enable bounce buffers for devices that cannot access the full range of
731ce288e05SChristoph Hellwig	  memory available to the CPU. Enabled by default when HIGHMEM is
732ce288e05SChristoph Hellwig	  selected, but you may say n to override this.
7332a7326b5SChristoph Lameter
734cddb8a5cSAndrea Arcangeliconfig MMU_NOTIFIER
735cddb8a5cSAndrea Arcangeli	bool
73699cb252fSJason Gunthorpe	select INTERVAL_TREE
737fc4d5c29SDavid Howells
738f8af4da3SHugh Dickinsconfig KSM
739f8af4da3SHugh Dickins	bool "Enable KSM for page merging"
740f8af4da3SHugh Dickins	depends on MMU
74159e1a2f4STimofey Titovets	select XXHASH
742f8af4da3SHugh Dickins	help
743f8af4da3SHugh Dickins	  Enable Kernel Samepage Merging: KSM periodically scans those areas
744f8af4da3SHugh Dickins	  of an application's address space that an app has advised may be
745f8af4da3SHugh Dickins	  mergeable.  When it finds pages of identical content, it replaces
746d0f209f6SHugh Dickins	  the many instances by a single page with that content, so
747f8af4da3SHugh Dickins	  saving memory until one or another app needs to modify the content.
748f8af4da3SHugh Dickins	  Recommended for use with KVM, or with other duplicative applications.
749ee65728eSMike Rapoport	  See Documentation/mm/ksm.rst for more information: KSM is inactive
750c73602adSHugh Dickins	  until a program has madvised that an area is MADV_MERGEABLE, and
751c73602adSHugh Dickins	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
752f8af4da3SHugh Dickins
753e0a94c2aSChristoph Lameterconfig DEFAULT_MMAP_MIN_ADDR
754e0a94c2aSChristoph Lameter	int "Low address space to protect from user allocation"
7556e141546SDavid Howells	depends on MMU
756e0a94c2aSChristoph Lameter	default 4096
757e0a94c2aSChristoph Lameter	help
758e0a94c2aSChristoph Lameter	  This is the portion of low virtual memory which should be protected
759e0a94c2aSChristoph Lameter	  from userspace allocation.  Keeping a user from writing to low pages
760e0a94c2aSChristoph Lameter	  can help reduce the impact of kernel NULL pointer bugs.
761e0a94c2aSChristoph Lameter
76234f7c528SJavier Martinez Canillas	  For most arm64, ppc64 and x86 users with lots of address space
763e0a94c2aSChristoph Lameter	  a value of 65536 is reasonable and should cause no problems.
764e0a94c2aSChristoph Lameter	  On arm and other archs it should not be higher than 32768.
765788084abSEric Paris	  Programs which use vm86 functionality or have some need to map
766788084abSEric Paris	  this low address space will need CAP_SYS_RAWIO or disable this
767788084abSEric Paris	  protection by setting the value to 0.
768e0a94c2aSChristoph Lameter
769e0a94c2aSChristoph Lameter	  This value can be changed after boot using the
770e0a94c2aSChristoph Lameter	  /proc/sys/vm/mmap_min_addr tunable.
771e0a94c2aSChristoph Lameter
772d949f36fSLinus Torvaldsconfig ARCH_SUPPORTS_MEMORY_FAILURE
773d949f36fSLinus Torvalds	bool
774e0a94c2aSChristoph Lameter
7756a46079cSAndi Kleenconfig MEMORY_FAILURE
7766a46079cSAndi Kleen	depends on MMU
777d949f36fSLinus Torvalds	depends on ARCH_SUPPORTS_MEMORY_FAILURE
7786a46079cSAndi Kleen	bool "Enable recovery from hardware memory errors"
779ee6f509cSMinchan Kim	select MEMORY_ISOLATION
78097f0b134SXie XiuQi	select RAS
7816a46079cSAndi Kleen	help
7826a46079cSAndi Kleen	  Enables code to recover from some memory failures on systems
7836a46079cSAndi Kleen	  with MCA recovery. This allows a system to continue running
7846a46079cSAndi Kleen	  even when some of its memory has uncorrected errors. This requires
7856a46079cSAndi Kleen	  special hardware support and typically ECC memory.
7866a46079cSAndi Kleen
787cae681fcSAndi Kleenconfig HWPOISON_INJECT
788413f9efbSAndi Kleen	tristate "HWPoison pages injector"
78927df5068SAndi Kleen	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
790478c5ffcSWu Fengguang	select PROC_PAGE_MONITOR
791cae681fcSAndi Kleen
792fc4d5c29SDavid Howellsconfig NOMMU_INITIAL_TRIM_EXCESS
793fc4d5c29SDavid Howells	int "Turn on mmap() excess space trimming before booting"
794fc4d5c29SDavid Howells	depends on !MMU
795fc4d5c29SDavid Howells	default 1
796fc4d5c29SDavid Howells	help
797fc4d5c29SDavid Howells	  The NOMMU mmap() frequently needs to allocate large contiguous chunks
798fc4d5c29SDavid Howells	  of memory on which to store mappings, but it can only ask the system
799fc4d5c29SDavid Howells	  allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
800fc4d5c29SDavid Howells	  more than it requires.  To deal with this, mmap() is able to trim off
801fc4d5c29SDavid Howells	  the excess and return it to the allocator.
802fc4d5c29SDavid Howells
803fc4d5c29SDavid Howells	  If trimming is enabled, the excess is trimmed off and returned to the
804fc4d5c29SDavid Howells	  system allocator, which can cause extra fragmentation, particularly
805fc4d5c29SDavid Howells	  if there are a lot of transient processes.
806fc4d5c29SDavid Howells
807fc4d5c29SDavid Howells	  If trimming is disabled, the excess is kept, but not used, which for
808fc4d5c29SDavid Howells	  long-term mappings means that the space is wasted.
809fc4d5c29SDavid Howells
810fc4d5c29SDavid Howells	  Trimming can be dynamically controlled through a sysctl option
811fc4d5c29SDavid Howells	  (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
812fc4d5c29SDavid Howells	  excess pages there must be before trimming should occur, or zero if
813fc4d5c29SDavid Howells	  no trimming is to occur.
814fc4d5c29SDavid Howells
815fc4d5c29SDavid Howells	  This option specifies the initial value of this option.  The default
816fc4d5c29SDavid Howells	  of 1 says that all excess pages should be trimmed.
817fc4d5c29SDavid Howells
818dd19d293SStephen Kitt	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
819bbddff05STejun Heo
820519bcb79SJohannes Weinerconfig ARCH_WANT_GENERAL_HUGETLB
821519bcb79SJohannes Weiner	bool
822519bcb79SJohannes Weiner
823519bcb79SJohannes Weinerconfig ARCH_WANTS_THP_SWAP
824519bcb79SJohannes Weiner	def_bool n
825519bcb79SJohannes Weiner
8266af8cb80SDavid Hildenbrandconfig MM_ID
8276af8cb80SDavid Hildenbrand	def_bool n
8286af8cb80SDavid Hildenbrand
829519bcb79SJohannes Weinermenuconfig TRANSPARENT_HUGEPAGE
83013ece886SAndrea Arcangeli	bool "Transparent Hugepage Support"
831554b0f3cSSebastian Andrzej Siewior	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
8325d689240SAndrea Arcangeli	select COMPACTION
8333a08cd52SMatthew Wilcox	select XARRAY_MULTI
8346af8cb80SDavid Hildenbrand	select MM_ID
8354c76d9d1SAndrea Arcangeli	help
8364c76d9d1SAndrea Arcangeli	  Transparent Hugepages allows the kernel to use huge pages and
8374c76d9d1SAndrea Arcangeli	  huge tlb transparently to the applications whenever possible.
8384c76d9d1SAndrea Arcangeli	  This feature can improve computing performance to certain
8394c76d9d1SAndrea Arcangeli	  applications by speeding up page faults during memory
8404c76d9d1SAndrea Arcangeli	  allocation, by reducing the number of tlb misses and by speeding
8414c76d9d1SAndrea Arcangeli	  up the pagetable walking.
8424c76d9d1SAndrea Arcangeli
8434c76d9d1SAndrea Arcangeli	  If memory constrained on embedded, you may want to say N.
8444c76d9d1SAndrea Arcangeli
845519bcb79SJohannes Weinerif TRANSPARENT_HUGEPAGE
846519bcb79SJohannes Weiner
84713ece886SAndrea Arcangelichoice
84813ece886SAndrea Arcangeli	prompt "Transparent Hugepage Support sysfs defaults"
84913ece886SAndrea Arcangeli	depends on TRANSPARENT_HUGEPAGE
85013ece886SAndrea Arcangeli	default TRANSPARENT_HUGEPAGE_ALWAYS
85113ece886SAndrea Arcangeli	help
85213ece886SAndrea Arcangeli	  Selects the sysfs defaults for Transparent Hugepage Support.
85313ece886SAndrea Arcangeli
85413ece886SAndrea Arcangeli	config TRANSPARENT_HUGEPAGE_ALWAYS
85513ece886SAndrea Arcangeli		bool "always"
85613ece886SAndrea Arcangeli	help
85713ece886SAndrea Arcangeli	  Enabling Transparent Hugepage always, can increase the
85813ece886SAndrea Arcangeli	  memory footprint of applications without a guaranteed
85913ece886SAndrea Arcangeli	  benefit but it will work automatically for all applications.
86013ece886SAndrea Arcangeli
86113ece886SAndrea Arcangeli	config TRANSPARENT_HUGEPAGE_MADVISE
86213ece886SAndrea Arcangeli		bool "madvise"
86313ece886SAndrea Arcangeli	help
86413ece886SAndrea Arcangeli	  Enabling Transparent Hugepage madvise, will only provide a
86513ece886SAndrea Arcangeli	  performance improvement benefit to the applications using
86613ece886SAndrea Arcangeli	  madvise(MADV_HUGEPAGE) but it won't risk to increase the
86713ece886SAndrea Arcangeli	  memory footprint of applications without a guaranteed
86813ece886SAndrea Arcangeli	  benefit.
869683ec99fSDmytro Maluka
870683ec99fSDmytro Maluka	config TRANSPARENT_HUGEPAGE_NEVER
871683ec99fSDmytro Maluka		bool "never"
872683ec99fSDmytro Maluka	help
873683ec99fSDmytro Maluka	  Disable Transparent Hugepage by default. It can still be
874683ec99fSDmytro Maluka	  enabled at runtime via sysfs.
87513ece886SAndrea Arcangeliendchoice
87613ece886SAndrea Arcangeli
87738d8b4e6SHuang Yingconfig THP_SWAP
87838d8b4e6SHuang Ying	def_bool y
879dad6a5ebSHugh Dickins	depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT
88038d8b4e6SHuang Ying	help
88138d8b4e6SHuang Ying	  Swap transparent huge pages in one piece, without splitting.
88214fef284SHuang Ying	  XXX: For now, swap cluster backing transparent huge page
88314fef284SHuang Ying	  will be split after swapout.
88438d8b4e6SHuang Ying
88538d8b4e6SHuang Ying	  For selection by architectures with reasonable THP sizes.
88638d8b4e6SHuang Ying
887519bcb79SJohannes Weinerconfig READ_ONLY_THP_FOR_FS
888519bcb79SJohannes Weiner	bool "Read-only THP for filesystems (EXPERIMENTAL)"
889cc79061bSBaolin Wang	depends on TRANSPARENT_HUGEPAGE
890519bcb79SJohannes Weiner
891519bcb79SJohannes Weiner	help
892519bcb79SJohannes Weiner	  Allow khugepaged to put read-only file-backed pages in THP.
893519bcb79SJohannes Weiner
894519bcb79SJohannes Weiner	  This is marked experimental because it is a new feature. Write
895519bcb79SJohannes Weiner	  support of file THPs will be developed in the next few release
896519bcb79SJohannes Weiner	  cycles.
897519bcb79SJohannes Weiner
898e63ee43eSDavid Hildenbrandconfig NO_PAGE_MAPCOUNT
899e63ee43eSDavid Hildenbrand	bool "No per-page mapcount (EXPERIMENTAL)"
900e63ee43eSDavid Hildenbrand	help
901e63ee43eSDavid Hildenbrand	  Do not maintain per-page mapcounts for pages part of larger
902e63ee43eSDavid Hildenbrand	  allocations, such as transparent huge pages.
903e63ee43eSDavid Hildenbrand
904e63ee43eSDavid Hildenbrand	  When this config option is enabled, some interfaces that relied on
905e63ee43eSDavid Hildenbrand	  this information will rely on less-precise per-allocation information
906e63ee43eSDavid Hildenbrand	  instead: for example, using the average per-page mapcount in such
907e63ee43eSDavid Hildenbrand	  a large allocation instead of the per-page mapcount.
908e63ee43eSDavid Hildenbrand
909e63ee43eSDavid Hildenbrand	  EXPERIMENTAL because the impact of some changes is still unclear.
910e63ee43eSDavid Hildenbrand
911519bcb79SJohannes Weinerendif # TRANSPARENT_HUGEPAGE
912519bcb79SJohannes Weiner
913e63ee43eSDavid Hildenbrand# simple helper to make the code a bit easier to read
914e63ee43eSDavid Hildenbrandconfig PAGE_MAPCOUNT
915e63ee43eSDavid Hildenbrand	def_bool !NO_PAGE_MAPCOUNT
916e63ee43eSDavid Hildenbrand
917e496cf3dSKirill A. Shutemov#
918ac3830c3SPeter Xu# The architecture supports pgtable leaves that is larger than PAGE_SIZE
919ac3830c3SPeter Xu#
920ac3830c3SPeter Xuconfig PGTABLE_HAS_HUGE_LEAVES
921ac3830c3SPeter Xu	def_bool TRANSPARENT_HUGEPAGE || HUGETLB_PAGE
922ac3830c3SPeter Xu
9236857be5fSPeter Xu# TODO: Allow to be enabled without THP
9246857be5fSPeter Xuconfig ARCH_SUPPORTS_HUGE_PFNMAP
9256857be5fSPeter Xu	def_bool n
9266857be5fSPeter Xu	depends on TRANSPARENT_HUGEPAGE
9276857be5fSPeter Xu
9286857be5fSPeter Xuconfig ARCH_SUPPORTS_PMD_PFNMAP
9296857be5fSPeter Xu	def_bool y
9306857be5fSPeter Xu	depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE
9316857be5fSPeter Xu
9326857be5fSPeter Xuconfig ARCH_SUPPORTS_PUD_PFNMAP
9336857be5fSPeter Xu	def_bool y
9346857be5fSPeter Xu	depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
9356857be5fSPeter Xu
936ac3830c3SPeter Xu#
937bbddff05STejun Heo# UP and nommu archs use km based percpu allocator
938bbddff05STejun Heo#
939bbddff05STejun Heoconfig NEED_PER_CPU_KM
9403583521aSVladimir Murzin	depends on !SMP || !MMU
941bbddff05STejun Heo	bool
942bbddff05STejun Heo	default y
943077b1f83SDan Magenheimer
9447ecd19cfSKefeng Wangconfig NEED_PER_CPU_EMBED_FIRST_CHUNK
9457ecd19cfSKefeng Wang	bool
9467ecd19cfSKefeng Wang
9477ecd19cfSKefeng Wangconfig NEED_PER_CPU_PAGE_FIRST_CHUNK
9487ecd19cfSKefeng Wang	bool
9497ecd19cfSKefeng Wang
9507ecd19cfSKefeng Wangconfig USE_PERCPU_NUMA_NODE_ID
9517ecd19cfSKefeng Wang	bool
9527ecd19cfSKefeng Wang
9537ecd19cfSKefeng Wangconfig HAVE_SETUP_PER_CPU_AREA
9547ecd19cfSKefeng Wang	bool
9557ecd19cfSKefeng Wang
956f825c736SAneesh Kumar K.Vconfig CMA
957f825c736SAneesh Kumar K.V	bool "Contiguous Memory Allocator"
958aca52c39SMike Rapoport	depends on MMU
959f825c736SAneesh Kumar K.V	select MIGRATION
960f825c736SAneesh Kumar K.V	select MEMORY_ISOLATION
961f825c736SAneesh Kumar K.V	help
962f825c736SAneesh Kumar K.V	  This enables the Contiguous Memory Allocator which allows other
963f825c736SAneesh Kumar K.V	  subsystems to allocate big physically-contiguous blocks of memory.
964f825c736SAneesh Kumar K.V	  CMA reserves a region of memory and allows only movable pages to
965f825c736SAneesh Kumar K.V	  be allocated from it. This way, the kernel can use the memory for
966f825c736SAneesh Kumar K.V	  pagecache and when a subsystem requests for contiguous area, the
967f825c736SAneesh Kumar K.V	  allocated pages are migrated away to serve the contiguous request.
968f825c736SAneesh Kumar K.V
969f825c736SAneesh Kumar K.V	  If unsure, say "n".
970f825c736SAneesh Kumar K.V
97128b24c1fSSasha Levinconfig CMA_DEBUGFS
97228b24c1fSSasha Levin	bool "CMA debugfs interface"
97328b24c1fSSasha Levin	depends on CMA && DEBUG_FS
97428b24c1fSSasha Levin	help
97528b24c1fSSasha Levin	  Turns on the DebugFS interface for CMA.
97628b24c1fSSasha Levin
97743ca106fSMinchan Kimconfig CMA_SYSFS
97843ca106fSMinchan Kim	bool "CMA information through sysfs interface"
97943ca106fSMinchan Kim	depends on CMA && SYSFS
98043ca106fSMinchan Kim	help
98143ca106fSMinchan Kim	  This option exposes some sysfs attributes to get information
98243ca106fSMinchan Kim	  from CMA.
98343ca106fSMinchan Kim
984a254129eSJoonsoo Kimconfig CMA_AREAS
985a254129eSJoonsoo Kim	int "Maximum count of the CMA areas"
986a254129eSJoonsoo Kim	depends on CMA
98773307523SAnshuman Khandual	default 20 if NUMA
98873307523SAnshuman Khandual	default 8
989a254129eSJoonsoo Kim	help
990a254129eSJoonsoo Kim	  CMA allows to create CMA areas for particular purpose, mainly,
991a254129eSJoonsoo Kim	  used as device private area. This parameter sets the maximum
992a254129eSJoonsoo Kim	  number of CMA area in the system.
993a254129eSJoonsoo Kim
99473307523SAnshuman Khandual	  If unsure, leave the default value "8" in UMA and "20" in NUMA.
995a254129eSJoonsoo Kim
996e13e7922SJuan Yescas#
997e13e7922SJuan Yescas# Select this config option from the architecture Kconfig, if available, to set
998e13e7922SJuan Yescas# the max page order for physically contiguous allocations.
999e13e7922SJuan Yescas#
1000e13e7922SJuan Yescasconfig ARCH_FORCE_MAX_ORDER
1001e13e7922SJuan Yescas	int
1002e13e7922SJuan Yescas
1003e13e7922SJuan Yescas#
1004e13e7922SJuan Yescas# When ARCH_FORCE_MAX_ORDER is not defined,
1005e13e7922SJuan Yescas# the default page block order is MAX_PAGE_ORDER (10) as per
1006e13e7922SJuan Yescas# include/linux/mmzone.h.
1007e13e7922SJuan Yescas#
1008e13e7922SJuan Yescasconfig PAGE_BLOCK_ORDER
1009e13e7922SJuan Yescas	int "Page Block Order"
1010e13e7922SJuan Yescas	range 1 10 if ARCH_FORCE_MAX_ORDER = 0
1011e13e7922SJuan Yescas	default 10 if ARCH_FORCE_MAX_ORDER = 0
1012e13e7922SJuan Yescas	range 1 ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0
1013e13e7922SJuan Yescas	default ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0
1014e13e7922SJuan Yescas	help
1015e13e7922SJuan Yescas	  The page block order refers to the power of two number of pages that
1016e13e7922SJuan Yescas	  are physically contiguous and can have a migrate type associated to
1017e13e7922SJuan Yescas	  them. The maximum size of the page block order is limited by
1018e13e7922SJuan Yescas	  ARCH_FORCE_MAX_ORDER.
1019e13e7922SJuan Yescas
1020e13e7922SJuan Yescas	  This config allows overriding the default page block order when the
1021e13e7922SJuan Yescas	  page block order is required to be smaller than ARCH_FORCE_MAX_ORDER
1022e13e7922SJuan Yescas	  or MAX_PAGE_ORDER.
1023e13e7922SJuan Yescas
1024e13e7922SJuan Yescas	  Reducing pageblock order can negatively impact THP generation
1025e13e7922SJuan Yescas	  success rate. If your workloads uses THP heavily, please use this
1026e13e7922SJuan Yescas	  option with caution.
1027e13e7922SJuan Yescas
1028e13e7922SJuan Yescas	  Don't change if unsure.
1029e13e7922SJuan Yescas
1030af8d417aSDan Streetmanconfig MEM_SOFT_DIRTY
1031af8d417aSDan Streetman	bool "Track memory changes"
1032af8d417aSDan Streetman	depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
1033af8d417aSDan Streetman	select PROC_PAGE_MONITOR
10344e2e2770SSeth Jennings	help
1035af8d417aSDan Streetman	  This option enables memory changes tracking by introducing a
1036af8d417aSDan Streetman	  soft-dirty bit on pte-s. This bit it set when someone writes
1037af8d417aSDan Streetman	  into a page just as regular dirty bit, but unlike the latter
1038af8d417aSDan Streetman	  it can be cleared by hands.
1039af8d417aSDan Streetman
10401ad1335dSMike Rapoport	  See Documentation/admin-guide/mm/soft-dirty.rst for more details.
10414e2e2770SSeth Jennings
10429e5c33d7SMark Salterconfig GENERIC_EARLY_IOREMAP
10439e5c33d7SMark Salter	bool
1044042d27acSHelge Deller
104522ee3ea5SHelge Dellerconfig STACK_MAX_DEFAULT_SIZE_MB
104622ee3ea5SHelge Deller	int "Default maximum user stack size for 32-bit processes (MB)"
104722ee3ea5SHelge Deller	default 100
1048042d27acSHelge Deller	range 8 2048
1049042d27acSHelge Deller	depends on STACK_GROWSUP && (!64BIT || COMPAT)
1050042d27acSHelge Deller	help
1051042d27acSHelge Deller	  This is the maximum stack size in Megabytes in the VM layout of 32-bit
1052042d27acSHelge Deller	  user processes when the stack grows upwards (currently only on parisc
105322ee3ea5SHelge Deller	  arch) when the RLIMIT_STACK hard limit is unlimited.
1054042d27acSHelge Deller
105522ee3ea5SHelge Deller	  A sane initial value is 100 MB.
10563a80a7faSMel Gorman
10573a80a7faSMel Gormanconfig DEFERRED_STRUCT_PAGE_INIT
10581ce22103SVlastimil Babka	bool "Defer initialisation of struct pages to kthreads"
1059d39f8fb4SMike Rapoport	depends on SPARSEMEM
1060ab1e8d89SPavel Tatashin	depends on !NEED_PER_CPU_KM
1061889c695dSPasha Tatashin	depends on 64BIT
1062854fa98dSIlya Leoshkevich	depends on !KMSAN
1063e4443149SDaniel Jordan	select PADATA
10643a80a7faSMel Gorman	help
10653a80a7faSMel Gorman	  Ordinarily all struct pages are initialised during early boot in a
10663a80a7faSMel Gorman	  single thread. On very large machines this can take a considerable
10673a80a7faSMel Gorman	  amount of time. If this option is set, large machines will bring up
1068e4443149SDaniel Jordan	  a subset of memmap at boot and then initialise the rest in parallel.
1069e4443149SDaniel Jordan	  This has a potential performance impact on tasks running early in the
10701ce22103SVlastimil Babka	  lifetime of the system until these kthreads finish the
10711ce22103SVlastimil Babka	  initialisation.
1072033fbae9SDan Williams
10731c676e0dSSeongJae Parkconfig PAGE_IDLE_FLAG
10741c676e0dSSeongJae Park	bool
10751c676e0dSSeongJae Park	select PAGE_EXTENSION if !64BIT
10761c676e0dSSeongJae Park	help
10771c676e0dSSeongJae Park	  This adds PG_idle and PG_young flags to 'struct page'.  PTE Accessed
10781c676e0dSSeongJae Park	  bit writers can set the state of the bit in the flags so that PTE
10791c676e0dSSeongJae Park	  Accessed bit readers may avoid disturbance.
10801c676e0dSSeongJae Park
108133c3fc71SVladimir Davydovconfig IDLE_PAGE_TRACKING
108233c3fc71SVladimir Davydov	bool "Enable idle page tracking"
108333c3fc71SVladimir Davydov	depends on SYSFS && MMU
10841c676e0dSSeongJae Park	select PAGE_IDLE_FLAG
108533c3fc71SVladimir Davydov	help
108633c3fc71SVladimir Davydov	  This feature allows to estimate the amount of user pages that have
108733c3fc71SVladimir Davydov	  not been touched during a given period of time. This information can
108833c3fc71SVladimir Davydov	  be useful to tune memory cgroup limits and/or for job placement
108933c3fc71SVladimir Davydov	  within a compute cluster.
109033c3fc71SVladimir Davydov
10911ad1335dSMike Rapoport	  See Documentation/admin-guide/mm/idle_page_tracking.rst for
10921ad1335dSMike Rapoport	  more details.
109333c3fc71SVladimir Davydov
10948690bbcfSMathieu Desnoyers# Architectures which implement cpu_dcache_is_aliasing() to query
10958690bbcfSMathieu Desnoyers# whether the data caches are aliased (VIVT or VIPT with dcache
10968690bbcfSMathieu Desnoyers# aliasing) need to select this.
10978690bbcfSMathieu Desnoyersconfig ARCH_HAS_CPU_CACHE_ALIASING
10988690bbcfSMathieu Desnoyers	bool
10998690bbcfSMathieu Desnoyers
1100c2280be8SAnshuman Khandualconfig ARCH_HAS_CACHE_LINE_SIZE
1101c2280be8SAnshuman Khandual	bool
1102c2280be8SAnshuman Khandual
11032792d84eSKees Cookconfig ARCH_HAS_CURRENT_STACK_POINTER
11042792d84eSKees Cook	bool
11052792d84eSKees Cook	help
11062792d84eSKees Cook	  In support of HARDENED_USERCOPY performing stack variable lifetime
11072792d84eSKees Cook	  checking, an architecture-agnostic way to find the stack pointer
11082792d84eSKees Cook	  is needed. Once an architecture defines an unsigned long global
11092792d84eSKees Cook	  register alias named "current_stack_pointer", this config can be
11102792d84eSKees Cook	  selected.
11112792d84eSKees Cook
111217596731SRobin Murphyconfig ARCH_HAS_PTE_DEVMAP
111365f7d049SOliver O'Halloran	bool
111465f7d049SOliver O'Halloran
111563703f37SKefeng Wangconfig ARCH_HAS_ZONE_DMA_SET
111663703f37SKefeng Wang	bool
111763703f37SKefeng Wang
111863703f37SKefeng Wangconfig ZONE_DMA
111963703f37SKefeng Wang	bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
112063703f37SKefeng Wang	default y if ARM64 || X86
112163703f37SKefeng Wang
112263703f37SKefeng Wangconfig ZONE_DMA32
112363703f37SKefeng Wang	bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
112463703f37SKefeng Wang	depends on !X86_32
112563703f37SKefeng Wang	default y if ARM64
112663703f37SKefeng Wang
1127033fbae9SDan Williamsconfig ZONE_DEVICE
11285042db43SJérôme Glisse	bool "Device memory (pmem, HMM, etc...) hotplug support"
1129033fbae9SDan Williams	depends on MEMORY_HOTPLUG
1130033fbae9SDan Williams	depends on MEMORY_HOTREMOVE
113199490f16SDan Williams	depends on SPARSEMEM_VMEMMAP
113217596731SRobin Murphy	depends on ARCH_HAS_PTE_DEVMAP
11333a08cd52SMatthew Wilcox	select XARRAY_MULTI
1134033fbae9SDan Williams
1135033fbae9SDan Williams	help
1136033fbae9SDan Williams	  Device memory hotplug support allows for establishing pmem,
1137033fbae9SDan Williams	  or other device driver discovered memory regions, in the
1138033fbae9SDan Williams	  memmap. This allows pfn_to_page() lookups of otherwise
1139033fbae9SDan Williams	  "device-physical" addresses which is needed for using a DAX
1140033fbae9SDan Williams	  mapping in an O_DIRECT operation, among other things.
1141033fbae9SDan Williams
1142033fbae9SDan Williams	  If FS_DAX is enabled, then say Y.
114306a660adSLinus Torvalds
11449c240a7bSChristoph Hellwig#
11459c240a7bSChristoph Hellwig# Helpers to mirror range of the CPU page tables of a process into device page
11469c240a7bSChristoph Hellwig# tables.
11479c240a7bSChristoph Hellwig#
1148c0b12405SJérôme Glisseconfig HMM_MIRROR
11499c240a7bSChristoph Hellwig	bool
1150f442c283SChristoph Hellwig	depends on MMU
1151c0b12405SJérôme Glisse
115214b80582SDan Williamsconfig GET_FREE_REGION
115314b80582SDan Williams	bool
115414b80582SDan Williams
11555042db43SJérôme Glisseconfig DEVICE_PRIVATE
11565042db43SJérôme Glisse	bool "Unaddressable device memory (GPU memory, ...)"
11577328d9ccSChristoph Hellwig	depends on ZONE_DEVICE
115814b80582SDan Williams	select GET_FREE_REGION
11595042db43SJérôme Glisse
11605042db43SJérôme Glisse	help
11615042db43SJérôme Glisse	  Allows creation of struct pages to represent unaddressable device
11625042db43SJérôme Glisse	  memory; i.e., memory that is only accessible from the device (or
11635042db43SJérôme Glisse	  group of devices). You likely also want to select HMM_MIRROR.
11645042db43SJérôme Glisse
11653e9a9e25SChristoph Hellwigconfig VMAP_PFN
11663e9a9e25SChristoph Hellwig	bool
11673e9a9e25SChristoph Hellwig
116863c17fb8SDave Hansenconfig ARCH_USES_HIGH_VMA_FLAGS
116963c17fb8SDave Hansen	bool
117066d37570SDave Hansenconfig ARCH_HAS_PKEYS
117166d37570SDave Hansen	bool
117230a5b536SDennis Zhou
11737a87225aSMatthew Wilcox (Oracle)config ARCH_USES_PG_ARCH_2
1174b0284cd2SCatalin Marinas	bool
11757a87225aSMatthew Wilcox (Oracle)config ARCH_USES_PG_ARCH_3
11767a87225aSMatthew Wilcox (Oracle)	bool
1177b0284cd2SCatalin Marinas
11780710d012SVlastimil Babkaconfig VM_EVENT_COUNTERS
11790710d012SVlastimil Babka	default y
11800710d012SVlastimil Babka	bool "Enable VM event counters for /proc/vmstat" if EXPERT
11810710d012SVlastimil Babka	help
11820710d012SVlastimil Babka	  VM event counters are needed for event counts to be shown.
11830710d012SVlastimil Babka	  This option allows the disabling of the VM event counters
11840710d012SVlastimil Babka	  on EXPERT systems.  /proc/vmstat will only show page counts
11850710d012SVlastimil Babka	  if VM event counters are disabled.
11860710d012SVlastimil Babka
118730a5b536SDennis Zhouconfig PERCPU_STATS
118830a5b536SDennis Zhou	bool "Collect percpu memory statistics"
118930a5b536SDennis Zhou	help
119030a5b536SDennis Zhou	  This feature collects and exposes statistics via debugfs. The
119130a5b536SDennis Zhou	  information includes global and per chunk statistics, which can
119230a5b536SDennis Zhou	  be used to help understand percpu memory usage.
119364c349f4SKirill A. Shutemov
11949c84f229SJohn Hubbardconfig GUP_TEST
11959c84f229SJohn Hubbard	bool "Enable infrastructure for get_user_pages()-related unit tests"
1196d0de8241SBarry Song	depends on DEBUG_FS
119764c349f4SKirill A. Shutemov	help
11989c84f229SJohn Hubbard	  Provides /sys/kernel/debug/gup_test, which in turn provides a way
11999c84f229SJohn Hubbard	  to make ioctl calls that can launch kernel-based unit tests for
12009c84f229SJohn Hubbard	  the get_user_pages*() and pin_user_pages*() family of API calls.
120164c349f4SKirill A. Shutemov
12029c84f229SJohn Hubbard	  These tests include benchmark testing of the _fast variants of
12039c84f229SJohn Hubbard	  get_user_pages*() and pin_user_pages*(), as well as smoke tests of
12049c84f229SJohn Hubbard	  the non-_fast variants.
12059c84f229SJohn Hubbard
1206f4f9bda4SJohn Hubbard	  There is also a sub-test that allows running dump_page() on any
1207f4f9bda4SJohn Hubbard	  of up to eight pages (selected by command line args) within the
1208f4f9bda4SJohn Hubbard	  range of user-space addresses. These pages are either pinned via
1209f4f9bda4SJohn Hubbard	  pin_user_pages*(), or pinned via get_user_pages*(), as specified
1210f4f9bda4SJohn Hubbard	  by other command line arguments.
1211f4f9bda4SJohn Hubbard
1212baa489faSSeongJae Park	  See tools/testing/selftests/mm/gup_test.c
12133010a5eaSLaurent Dufour
1214d0de8241SBarry Songcomment "GUP_TEST needs to have DEBUG_FS enabled"
1215d0de8241SBarry Song	depends on !GUP_TEST && !DEBUG_FS
12163010a5eaSLaurent Dufour
12176ca297d4SPeter Zijlstraconfig GUP_GET_PXX_LOW_HIGH
121839656e83SChristoph Hellwig	bool
121939656e83SChristoph Hellwig
1220def85743SKeith Buschconfig DMAPOOL_TEST
1221def85743SKeith Busch	tristate "Enable a module to run time tests on dma_pool"
1222def85743SKeith Busch	depends on HAS_DMA
1223def85743SKeith Busch	help
1224def85743SKeith Busch	  Provides a test module that will allocate and free many blocks of
1225def85743SKeith Busch	  various sizes and report how long it takes. This is intended to
1226def85743SKeith Busch	  provide a consistent way to measure how changes to the
1227def85743SKeith Busch	  dma_pool_alloc/free routines affect performance.
1228def85743SKeith Busch
12293010a5eaSLaurent Dufourconfig ARCH_HAS_PTE_SPECIAL
12303010a5eaSLaurent Dufour	bool
123159e0b520SChristoph Hellwig
1232c5acad84SThomas Hellstromconfig MAPPING_DIRTY_HELPERS
1233c5acad84SThomas Hellstrom        bool
1234c5acad84SThomas Hellstrom
1235298fa1adSThomas Gleixnerconfig KMAP_LOCAL
1236298fa1adSThomas Gleixner	bool
1237298fa1adSThomas Gleixner
1238825c43f5SArd Biesheuvelconfig KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
1239825c43f5SArd Biesheuvel	bool
1240825c43f5SArd Biesheuvel
12411fbaf8fcSChristoph Hellwig# struct io_mapping based helper.  Selected by drivers that need them
12421fbaf8fcSChristoph Hellwigconfig IO_MAPPING
12431fbaf8fcSChristoph Hellwig	bool
12441507f512SMike Rapoport
1245626e98cbSThomas Weißschuhconfig MEMFD_CREATE
1246626e98cbSThomas Weißschuh	bool "Enable memfd_create() system call" if EXPERT
1247626e98cbSThomas Weißschuh
12481507f512SMike Rapoportconfig SECRETMEM
124974947724SLukas Bulwahn	default y
125074947724SLukas Bulwahn	bool "Enable memfd_secret() system call" if EXPERT
125174947724SLukas Bulwahn	depends on ARCH_HAS_SET_DIRECT_MAP
125274947724SLukas Bulwahn	help
125374947724SLukas Bulwahn	  Enable the memfd_secret() system call with the ability to create
125474947724SLukas Bulwahn	  memory areas visible only in the context of the owning process and
125574947724SLukas Bulwahn	  not mapped to other processes and other kernel page tables.
12561507f512SMike Rapoport
12579a10064fSColin Crossconfig ANON_VMA_NAME
12589a10064fSColin Cross	bool "Anonymous VMA name support"
12599a10064fSColin Cross	depends on PROC_FS && ADVISE_SYSCALLS && MMU
12609a10064fSColin Cross
12619a10064fSColin Cross	help
12629a10064fSColin Cross	  Allow naming anonymous virtual memory areas.
12639a10064fSColin Cross
12649a10064fSColin Cross	  This feature allows assigning names to virtual memory areas. Assigned
12659a10064fSColin Cross	  names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
12669a10064fSColin Cross	  and help identifying individual anonymous memory areas.
12679a10064fSColin Cross	  Assigning a name to anonymous virtual memory area might prevent that
12689a10064fSColin Cross	  area from being merged with adjacent virtual memory areas due to the
12699a10064fSColin Cross	  difference in their name.
12709a10064fSColin Cross
1271430529b5SPeter Xuconfig HAVE_ARCH_USERFAULTFD_WP
1272430529b5SPeter Xu	bool
1273430529b5SPeter Xu	help
1274430529b5SPeter Xu	  Arch has userfaultfd write protection support
1275430529b5SPeter Xu
1276430529b5SPeter Xuconfig HAVE_ARCH_USERFAULTFD_MINOR
1277430529b5SPeter Xu	bool
1278430529b5SPeter Xu	help
1279430529b5SPeter Xu	  Arch has userfaultfd minor fault support
1280430529b5SPeter Xu
128197219cc3SPeter Xumenuconfig USERFAULTFD
128297219cc3SPeter Xu	bool "Enable userfaultfd() system call"
128397219cc3SPeter Xu	depends on MMU
128497219cc3SPeter Xu	help
128597219cc3SPeter Xu	  Enable the userfaultfd() system call that allows to intercept and
128697219cc3SPeter Xu	  handle page faults in userland.
128797219cc3SPeter Xu
128897219cc3SPeter Xuif USERFAULTFD
12891db9dbc2SPeter Xuconfig PTE_MARKER_UFFD_WP
129081e0f15fSPeter Xu	bool "Userfaultfd write protection support for shmem/hugetlbfs"
129181e0f15fSPeter Xu	default y
129281e0f15fSPeter Xu	depends on HAVE_ARCH_USERFAULTFD_WP
12931db9dbc2SPeter Xu
12941db9dbc2SPeter Xu	help
12951db9dbc2SPeter Xu	  Allows to create marker PTEs for userfaultfd write protection
12961db9dbc2SPeter Xu	  purposes.  It is required to enable userfaultfd write protection on
12971db9dbc2SPeter Xu	  file-backed memory types like shmem and hugetlbfs.
129897219cc3SPeter Xuendif # USERFAULTFD
12991db9dbc2SPeter Xu
1300ac35a490SYu Zhao# multi-gen LRU {
1301ec1c86b2SYu Zhaoconfig LRU_GEN
1302ec1c86b2SYu Zhao	bool "Multi-Gen LRU"
1303ec1c86b2SYu Zhao	depends on MMU
1304ec1c86b2SYu Zhao	# make sure folio->flags has enough spare bits
1305ec1c86b2SYu Zhao	depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
1306ec1c86b2SYu Zhao	help
130707017acbSYu Zhao	  A high performance LRU implementation to overcommit memory. See
130807017acbSYu Zhao	  Documentation/admin-guide/mm/multigen_lru.rst for details.
1309ec1c86b2SYu Zhao
1310354ed597SYu Zhaoconfig LRU_GEN_ENABLED
1311354ed597SYu Zhao	bool "Enable by default"
1312354ed597SYu Zhao	depends on LRU_GEN
1313354ed597SYu Zhao	help
1314354ed597SYu Zhao	  This option enables the multi-gen LRU by default.
1315354ed597SYu Zhao
1316ac35a490SYu Zhaoconfig LRU_GEN_STATS
1317ac35a490SYu Zhao	bool "Full stats for debugging"
1318ac35a490SYu Zhao	depends on LRU_GEN
1319ac35a490SYu Zhao	help
1320ac35a490SYu Zhao	  Do not enable this option unless you plan to look at historical stats
1321ac35a490SYu Zhao	  from evicted generations for debugging purpose.
1322ac35a490SYu Zhao
1323ac35a490SYu Zhao	  This option has a per-memcg and per-node memory overhead.
132461dd3f24SKinsey Ho
132561dd3f24SKinsey Hoconfig LRU_GEN_WALKS_MMU
132661dd3f24SKinsey Ho	def_bool y
132761dd3f24SKinsey Ho	depends on LRU_GEN && ARCH_HAS_HW_PTE_YOUNG
1328ac35a490SYu Zhao# }
1329ac35a490SYu Zhao
13300b6cc04fSSuren Baghdasaryanconfig ARCH_SUPPORTS_PER_VMA_LOCK
13310b6cc04fSSuren Baghdasaryan       def_bool n
13320b6cc04fSSuren Baghdasaryan
13330b6cc04fSSuren Baghdasaryanconfig PER_VMA_LOCK
13340b6cc04fSSuren Baghdasaryan	def_bool y
13350b6cc04fSSuren Baghdasaryan	depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP
13360b6cc04fSSuren Baghdasaryan	help
13370b6cc04fSSuren Baghdasaryan	  Allow per-vma locking during page fault handling.
13380b6cc04fSSuren Baghdasaryan
13390b6cc04fSSuren Baghdasaryan	  This feature allows locking each virtual memory area separately when
13400b6cc04fSSuren Baghdasaryan	  handling page faults instead of taking mmap_lock.
13410b6cc04fSSuren Baghdasaryan
1342c2508ec5SLinus Torvaldsconfig LOCK_MM_AND_FIND_VMA
1343c2508ec5SLinus Torvalds	bool
1344c2508ec5SLinus Torvalds	depends on !STACK_GROWSUP
1345c2508ec5SLinus Torvalds
13468f23f5dbSJason Gunthorpeconfig IOMMU_MM_DATA
13478f23f5dbSJason Gunthorpe	bool
13488f23f5dbSJason Gunthorpe
134912af2b83SMike Rapoport (IBM)config EXECMEM
135012af2b83SMike Rapoport (IBM)	bool
135112af2b83SMike Rapoport (IBM)
135287482708SMike Rapoport (Microsoft)config NUMA_MEMBLKS
135387482708SMike Rapoport (Microsoft)	bool
135487482708SMike Rapoport (Microsoft)
1355b0c4e27cSMike Rapoport (Microsoft)config NUMA_EMU
1356b0c4e27cSMike Rapoport (Microsoft)	bool "NUMA emulation"
1357b0c4e27cSMike Rapoport (Microsoft)	depends on NUMA_MEMBLKS
1358*a24f2fb7SHuacai Chen	depends on X86 || GENERIC_ARCH_NUMA
1359b0c4e27cSMike Rapoport (Microsoft)	help
1360b0c4e27cSMike Rapoport (Microsoft)	  Enable NUMA emulation. A flat machine will be split
1361b0c4e27cSMike Rapoport (Microsoft)	  into virtual nodes when booted with "numa=fake=N", where N is the
1362b0c4e27cSMike Rapoport (Microsoft)	  number of nodes. This is only useful for debugging.
1363b0c4e27cSMike Rapoport (Microsoft)
1364bcc9d04eSMark Brownconfig ARCH_HAS_USER_SHADOW_STACK
1365bcc9d04eSMark Brown	bool
1366bcc9d04eSMark Brown	help
1367bcc9d04eSMark Brown	  The architecture has hardware support for userspace shadow call
1368bcc9d04eSMark Brown          stacks (eg, x86 CET, arm64 GCS or RISC-V Zicfiss).
1369bcc9d04eSMark Brown
13706375e95fSQi Zhengconfig ARCH_SUPPORTS_PT_RECLAIM
13716375e95fSQi Zheng	def_bool n
13726375e95fSQi Zheng
13736375e95fSQi Zhengconfig PT_RECLAIM
13746375e95fSQi Zheng	bool "reclaim empty user page table pages"
13756375e95fSQi Zheng	default y
13766375e95fSQi Zheng	depends on ARCH_SUPPORTS_PT_RECLAIM && MMU && SMP
13776375e95fSQi Zheng	select MMU_GATHER_RCU_TABLE_FREE
13786375e95fSQi Zheng	help
13796375e95fSQi Zheng	  Try to reclaim empty user page table pages in paths other than munmap
13806375e95fSQi Zheng	  and exit_mmap path.
13816375e95fSQi Zheng
13826375e95fSQi Zheng	  Note: now only empty user PTE page table pages will be reclaimed.
13836375e95fSQi Zheng
13846375e95fSQi Zheng
13852224d848SSeongJae Parksource "mm/damon/Kconfig"
13862224d848SSeongJae Park
138759e0b520SChristoph Hellwigendmenu
1388