xref: /linux/mm/Kconfig (revision 3774c56cc38b9ddcdf46dd717d4de954b40d8986)
1# SPDX-License-Identifier: GPL-2.0-only
2
3menu "Memory Management options"
4
5#
6# For some reason microblaze and nios2 hard code SWAP=n.  Hopefully we can
7# add proper SWAP support to them, in which case this can be remove.
8#
9config ARCH_NO_SWAP
10	bool
11
12menuconfig SWAP
13	bool "Support for paging of anonymous memory (swap)"
14	depends on MMU && BLOCK && !ARCH_NO_SWAP
15	default y
16	help
17	  This option allows you to choose whether you want to have support
18	  for so called swap devices or swap files in your kernel that are
19	  used to provide more virtual memory than the actual RAM present
20	  in your computer.  If unsure say Y.
21
22config ZSWAP
23	bool "Compressed cache for swap pages"
24	depends on SWAP
25	select CRYPTO
26	select ZSMALLOC
27	help
28	  A lightweight compressed cache for swap pages.  It takes
29	  pages that are in the process of being swapped out and attempts to
30	  compress them into a dynamically allocated RAM-based memory pool.
31	  This can result in a significant I/O reduction on swap device and,
32	  in the case where decompressing from RAM is faster than swap device
33	  reads, can also improve workload performance.
34
35config ZSWAP_DEFAULT_ON
36	bool "Enable the compressed cache for swap pages by default"
37	depends on ZSWAP
38	help
39	  If selected, the compressed cache for swap pages will be enabled
40	  at boot, otherwise it will be disabled.
41
42	  The selection made here can be overridden by using the kernel
43	  command line 'zswap.enabled=' option.
44
45config ZSWAP_SHRINKER_DEFAULT_ON
46	bool "Shrink the zswap pool on memory pressure"
47	depends on ZSWAP
48	default n
49	help
50	  If selected, the zswap shrinker will be enabled, and the pages
51	  stored in the zswap pool will become available for reclaim (i.e
52	  written back to the backing swap device) on memory pressure.
53
54	  This means that zswap writeback could happen even if the pool is
55	  not yet full, or the cgroup zswap limit has not been reached,
56	  reducing the chance that cold pages will reside in the zswap pool
57	  and consume memory indefinitely.
58
59choice
60	prompt "Default compressor"
61	depends on ZSWAP
62	default ZSWAP_COMPRESSOR_DEFAULT_LZO
63	help
64	  Selects the default compression algorithm for the compressed cache
65	  for swap pages.
66
67	  For an overview what kind of performance can be expected from
68	  a particular compression algorithm please refer to the benchmarks
69	  available at the following LWN page:
70	  https://lwn.net/Articles/751795/
71
72	  If in doubt, select 'LZO'.
73
74	  The selection made here can be overridden by using the kernel
75	  command line 'zswap.compressor=' option.
76
77config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
78	bool "Deflate"
79	select CRYPTO_DEFLATE
80	help
81	  Use the Deflate algorithm as the default compression algorithm.
82
83config ZSWAP_COMPRESSOR_DEFAULT_LZO
84	bool "LZO"
85	select CRYPTO_LZO
86	help
87	  Use the LZO algorithm as the default compression algorithm.
88
89config ZSWAP_COMPRESSOR_DEFAULT_842
90	bool "842"
91	select CRYPTO_842
92	help
93	  Use the 842 algorithm as the default compression algorithm.
94
95config ZSWAP_COMPRESSOR_DEFAULT_LZ4
96	bool "LZ4"
97	select CRYPTO_LZ4
98	help
99	  Use the LZ4 algorithm as the default compression algorithm.
100
101config ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
102	bool "LZ4HC"
103	select CRYPTO_LZ4HC
104	help
105	  Use the LZ4HC algorithm as the default compression algorithm.
106
107config ZSWAP_COMPRESSOR_DEFAULT_ZSTD
108	bool "zstd"
109	select CRYPTO_ZSTD
110	help
111	  Use the zstd algorithm as the default compression algorithm.
112endchoice
113
114config ZSWAP_COMPRESSOR_DEFAULT
115       string
116       depends on ZSWAP
117       default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
118       default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
119       default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
120       default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
121       default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
122       default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
123       default ""
124
125config ZSMALLOC
126	tristate
127
128menu "Zsmalloc allocator options"
129	depends on ZSMALLOC
130
131comment "Zsmalloc is a common backend allocator for zswap & zram"
132
133config ZSMALLOC_STAT
134	bool "Export zsmalloc statistics"
135	select DEBUG_FS
136	help
137	  This option enables code in the zsmalloc to collect various
138	  statistics about what's happening in zsmalloc and exports that
139	  information to userspace via debugfs.
140	  If unsure, say N.
141
142config ZSMALLOC_CHAIN_SIZE
143	int "Maximum number of physical pages per-zspage"
144	default 8
145	range 4 16
146	help
147	  This option sets the upper limit on the number of physical pages
148	  that a zmalloc page (zspage) can consist of. The optimal zspage
149	  chain size is calculated for each size class during the
150	  initialization of the pool.
151
152	  Changing this option can alter the characteristics of size classes,
153	  such as the number of pages per zspage and the number of objects
154	  per zspage. This can also result in different configurations of
155	  the pool, as zsmalloc merges size classes with similar
156	  characteristics.
157
158	  For more information, see zsmalloc documentation.
159
160endmenu
161
162menu "Slab allocator options"
163
164config SLUB
165	def_bool y
166	select IRQ_WORK
167
168config KVFREE_RCU_BATCHED
169	def_bool y
170	depends on !SLUB_TINY && !TINY_RCU
171	depends on !RCU_STRICT_GRACE_PERIOD
172
173config SLUB_TINY
174	bool "Configure for minimal memory footprint"
175	depends on EXPERT && !COMPILE_TEST
176	select SLAB_MERGE_DEFAULT
177	help
178	   Configures the slab allocator in a way to achieve minimal memory
179	   footprint, sacrificing scalability, debugging and other features.
180	   This is intended only for the smallest system that had used the
181	   SLOB allocator and is not recommended for systems with more than
182	   16MB RAM.
183
184	   If unsure, say N.
185
186config SLAB_MERGE_DEFAULT
187	bool "Allow slab caches to be merged"
188	default y
189	help
190	  For reduced kernel memory fragmentation, slab caches can be
191	  merged when they share the same size and other characteristics.
192	  This carries a risk of kernel heap overflows being able to
193	  overwrite objects from merged caches (and more easily control
194	  cache layout), which makes such heap attacks easier to exploit
195	  by attackers. By keeping caches unmerged, these kinds of exploits
196	  can usually only damage objects in the same cache. To disable
197	  merging at runtime, "slab_nomerge" can be passed on the kernel
198	  command line.
199
200config SLAB_FREELIST_RANDOM
201	bool "Randomize slab freelist"
202	depends on !SLUB_TINY
203	help
204	  Randomizes the freelist order used on creating new pages. This
205	  security feature reduces the predictability of the kernel slab
206	  allocator against heap overflows.
207
208config SLAB_FREELIST_HARDENED
209	bool "Harden slab freelist metadata"
210	depends on !SLUB_TINY
211	help
212	  Many kernel heap attacks try to target slab cache metadata and
213	  other infrastructure. This options makes minor performance
214	  sacrifices to harden the kernel slab allocator against common
215	  freelist exploit methods.
216
217config SLAB_BUCKETS
218	bool "Support allocation from separate kmalloc buckets"
219	depends on !SLUB_TINY
220	default SLAB_FREELIST_HARDENED
221	help
222	  Kernel heap attacks frequently depend on being able to create
223	  specifically-sized allocations with user-controlled contents
224	  that will be allocated into the same kmalloc bucket as a
225	  target object. To avoid sharing these allocation buckets,
226	  provide an explicitly separated set of buckets to be used for
227	  user-controlled allocations. This may very slightly increase
228	  memory fragmentation, though in practice it's only a handful
229	  of extra pages since the bulk of user-controlled allocations
230	  are relatively long-lived.
231
232	  If unsure, say Y.
233
234config SLUB_STATS
235	default n
236	bool "Enable performance statistics"
237	depends on SYSFS && !SLUB_TINY
238	help
239	  The statistics are useful to debug slab allocation behavior in
240	  order find ways to optimize the allocator. This should never be
241	  enabled for production use since keeping statistics slows down
242	  the allocator by a few percentage points. The slabinfo command
243	  supports the determination of the most active slabs to figure
244	  out which slabs are relevant to a particular load.
245	  Try running: slabinfo -DA
246
247config KMALLOC_PARTITION_CACHES
248	depends on !SLUB_TINY
249	bool "Partitioned slab caches for normal kmalloc"
250	default RANDOM_KMALLOC_CACHES
251	help
252	  A hardening feature that creates multiple isolated copies of slab
253	  caches for normal kmalloc allocations. This makes it more difficult
254	  to exploit memory-safety vulnerabilities by attacking vulnerable
255	  co-located memory objects. Several modes are provided.
256
257	  Currently the number of copies is set to 16, a reasonably large value
258	  that effectively diverges the memory objects allocated for different
259	  subsystems or modules into different caches, at the expense of a
260	  limited degree of memory and CPU overhead that relates to hardware
261	  and system workload.
262
263choice
264	prompt "Partitioned slab cache mode"
265	depends on KMALLOC_PARTITION_CACHES
266	default KMALLOC_PARTITION_TYPED if CC_HAS_ALLOC_TOKEN
267	default KMALLOC_PARTITION_RANDOM
268	help
269	  Selects the slab cache partitioning mode.
270
271config KMALLOC_PARTITION_RANDOM
272	bool "Randomize slab caches for normal kmalloc"
273	help
274	  Randomly pick a slab cache based on code address and a per-boot
275	  random seed.
276
277	  This makes it harder for attackers to predict object co-location.
278	  The placement is random: while attackers don't know which kmalloc
279	  cache an object will be allocated from, they might circumvent
280	  the randomization by retrying attacks across multiple machines until
281	  the target objects are co-located.
282
283config KMALLOC_PARTITION_TYPED
284	bool "Type based slab cache selection for normal kmalloc"
285	depends on CC_HAS_ALLOC_TOKEN
286	help
287	  Rely on Clang's allocation tokens to choose a slab cache, where token
288	  IDs are derived from the allocated type.
289
290	  Unlike KMALLOC_PARTITION_RANDOM, cache assignment is deterministic based
291	  on type, which guarantees that objects of certain types are not
292	  placed in the same cache. This effectively mitigates certain classes
293	  of exploits that probabilistic defenses like KMALLOC_PARTITION_RANDOM
294	  only make harder but not impossible. However, this also means the
295	  cache assignment is predictable.
296
297	  Clang's default token ID calculation returns a bounded hash with
298	  disjoint ranges for pointer-containing and pointerless objects: when
299	  used as the slab cache index, this prevents buffer overflows on
300	  primitive buffers from directly corrupting pointer-containing
301	  objects.
302
303	  The current effectiveness of Clang's type inference can be judged by
304	  -Rpass=alloc-token, which provides diagnostics where (after dead-code
305	  elimination) type inference failed.
306
307	  Requires Clang 22 or later.
308
309endchoice
310
311config RANDOM_KMALLOC_CACHES
312	bool
313	transitional
314	help
315	  Transitional config for migration to KMALLOC_PARTITION_CACHES.
316
317endmenu # Slab allocator options
318
319config SHUFFLE_PAGE_ALLOCATOR
320	bool "Page allocator randomization"
321	default SLAB_FREELIST_RANDOM && ACPI_NUMA
322	help
323	  Randomization of the page allocator improves the average
324	  utilization of a direct-mapped memory-side-cache. See section
325	  5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
326	  6.2a specification for an example of how a platform advertises
327	  the presence of a memory-side-cache. There are also incidental
328	  security benefits as it reduces the predictability of page
329	  allocations to compliment SLAB_FREELIST_RANDOM, but the
330	  default granularity of shuffling on the MAX_PAGE_ORDER i.e, 10th
331	  order of pages is selected based on cache utilization benefits
332	  on x86.
333
334	  While the randomization improves cache utilization it may
335	  negatively impact workloads on platforms without a cache. For
336	  this reason, by default, the randomization is not enabled even
337	  if SHUFFLE_PAGE_ALLOCATOR=y. The randomization may be force enabled
338	  with the 'page_alloc.shuffle' kernel command line parameter.
339
340	  Say Y if unsure.
341
342config COMPAT_BRK
343	bool "Disable heap randomization"
344	default y
345	help
346	  Randomizing heap placement makes heap exploits harder, but it
347	  also breaks ancient binaries (including anything libc5 based).
348	  This option changes the bootup default to heap randomization
349	  disabled, and can be overridden at runtime by setting
350	  /proc/sys/kernel/randomize_va_space to 2.
351
352	  On non-ancient distros (post-2000 ones) N is usually a safe choice.
353
354config MMAP_ALLOW_UNINITIALIZED
355	bool "Allow mmapped anonymous memory to be uninitialized"
356	depends on EXPERT && !MMU
357	default n
358	help
359	  Normally, and according to the Linux spec, anonymous memory obtained
360	  from mmap() has its contents cleared before it is passed to
361	  userspace.  Enabling this config option allows you to request that
362	  mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
363	  providing a huge performance boost.  If this option is not enabled,
364	  then the flag will be ignored.
365
366	  This is taken advantage of by uClibc's malloc(), and also by
367	  ELF-FDPIC binfmt's brk and stack allocator.
368
369	  Because of the obvious security issues, this option should only be
370	  enabled on embedded devices where you control what is run in
371	  userspace.  Since that isn't generally a problem on no-MMU systems,
372	  it is normally safe to say Y here.
373
374	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
375
376config SELECT_MEMORY_MODEL
377	def_bool y
378	depends on ARCH_SELECT_MEMORY_MODEL
379
380choice
381	prompt "Memory model"
382	depends on SELECT_MEMORY_MODEL
383	default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
384	default FLATMEM_MANUAL
385	help
386	  This option allows you to change some of the ways that
387	  Linux manages its memory internally. Most users will
388	  only have one option here selected by the architecture
389	  configuration. This is normal.
390
391config FLATMEM_MANUAL
392	bool "Flat Memory"
393	depends on !NUMA
394	depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
395	help
396	  This option is best suited for non-NUMA systems with
397	  flat address space. The FLATMEM is the most efficient
398	  system in terms of performance and resource consumption
399	  and it is the best option for smaller systems.
400
401	  For systems that have holes in their physical address
402	  spaces and for features like NUMA and memory hotplug,
403	  choose "Sparse Memory".
404
405	  If unsure, choose this option (Flat Memory) over any other.
406
407config SPARSEMEM_MANUAL
408	bool "Sparse Memory"
409	depends on ARCH_SPARSEMEM_ENABLE
410	help
411	  This will be the only option for some systems, including
412	  memory hot-plug systems.  This is normal.
413
414	  This option provides efficient support for systems with
415	  holes is their physical address space and allows memory
416	  hot-plug and hot-remove.
417
418	  If unsure, choose "Flat Memory" over this option.
419
420endchoice
421
422config SPARSEMEM
423	def_bool y
424	depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
425
426config FLATMEM
427	def_bool y
428	depends on !NUMA
429	depends on !SPARSEMEM || FLATMEM_MANUAL
430
431#
432# SPARSEMEM_EXTREME (which is the default) does some bootmem
433# allocations when sparse_init() is called.  If this cannot
434# be done on your architecture, select this option.  However,
435# statically allocating the mem_section[] array can potentially
436# consume vast quantities of .bss, so be careful.
437#
438# This option will also potentially produce smaller runtime code
439# with gcc 3.4 and later.
440#
441config SPARSEMEM_STATIC
442	bool
443
444#
445# Architecture platforms which require a two level mem_section in SPARSEMEM
446# must select this option. This is usually for architecture platforms with
447# an extremely sparse physical address space.
448#
449config SPARSEMEM_EXTREME
450	def_bool y
451	depends on SPARSEMEM && !SPARSEMEM_STATIC
452
453config SPARSEMEM_VMEMMAP_ENABLE
454	bool
455
456config SPARSEMEM_VMEMMAP
457	def_bool y
458	depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
459	help
460	  SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
461	  pfn_to_page and page_to_pfn operations.  This is the most
462	  efficient option when sufficient kernel resources are available.
463
464config SPARSEMEM_VMEMMAP_PREINIT
465	bool
466#
467# Select this config option from the architecture Kconfig, if it is preferred
468# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
469#
470config ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
471	bool
472
473config ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
474	bool
475
476config ARCH_WANT_HUGETLB_VMEMMAP_PREINIT
477	bool
478
479config HAVE_MEMBLOCK_PHYS_MAP
480	bool
481
482config HAVE_GUP_FAST
483	depends on MMU
484	bool
485
486# Enable memblock support for scratch memory which is needed for kexec handover
487config MEMBLOCK_KHO_SCRATCH
488	bool
489
490# Don't discard allocated memory used to track "memory" and "reserved" memblocks
491# after early boot, so it can still be used to test for validity of memory.
492# Also, memblocks are updated with memory hot(un)plug.
493config ARCH_KEEP_MEMBLOCK
494	bool
495
496# Keep arch NUMA mapping infrastructure post-init.
497config NUMA_KEEP_MEMINFO
498	bool
499
500config MEMORY_ISOLATION
501	bool
502
503# IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked
504# IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via
505# /dev/mem.
506config EXCLUSIVE_SYSTEM_RAM
507	def_bool y
508	depends on !DEVMEM || STRICT_DEVMEM
509
510config ARCH_ENABLE_MEMORY_HOTPLUG
511	bool
512
513# eventually, we can have this option just 'select SPARSEMEM'
514menuconfig MEMORY_HOTPLUG
515	bool "Memory hotplug"
516	select MEMORY_ISOLATION
517	depends on SPARSEMEM_VMEMMAP
518	depends on ARCH_ENABLE_MEMORY_HOTPLUG
519	depends on 64BIT
520	select NUMA_KEEP_MEMINFO if NUMA
521
522if MEMORY_HOTPLUG
523
524choice
525	prompt "Memory Hotplug Default Online Type"
526	default MHP_DEFAULT_ONLINE_TYPE_OFFLINE
527	help
528	  Default memory type for hotplugged memory.
529
530	  This option sets the default policy setting for memory hotplug
531	  onlining policy (/sys/devices/system/memory/auto_online_blocks) which
532	  determines what happens to newly added memory regions. Policy setting
533	  can always be changed at runtime.
534
535	  The default is 'offline'.
536
537	  Select offline to defer onlining to drivers and user policy.
538	  Select auto to let the kernel choose what zones to utilize.
539	  Select online_kernel to generally allow kernel usage of this memory.
540	  Select online_movable to generally disallow kernel usage of this memory.
541
542	  Example kernel usage would be page structs and page tables.
543
544	  See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
545
546config MHP_DEFAULT_ONLINE_TYPE_OFFLINE
547	bool "offline"
548	help
549	  Hotplugged memory will not be onlined by default.
550	  Choose this for systems with drivers and user policy that
551	  handle onlining of hotplug memory policy.
552
553config MHP_DEFAULT_ONLINE_TYPE_ONLINE_AUTO
554	bool "auto"
555	help
556	  Select this if you want the kernel to automatically online
557	  hotplugged memory into the zone it thinks is reasonable.
558	  This memory may be utilized for kernel data.
559
560config MHP_DEFAULT_ONLINE_TYPE_ONLINE_KERNEL
561	bool "kernel"
562	help
563	  Select this if you want the kernel to automatically online
564	  hotplugged memory into a zone capable of being used for kernel
565	  data. This typically means ZONE_NORMAL.
566
567config MHP_DEFAULT_ONLINE_TYPE_ONLINE_MOVABLE
568	bool "movable"
569	help
570	  Select this if you want the kernel to automatically online
571	  hotplug memory into ZONE_MOVABLE. This memory will generally
572	  not be utilized for kernel data.
573
574	  This should only be used when the admin knows sufficient
575	  ZONE_NORMAL memory is available to describe hotplug memory,
576	  otherwise hotplug memory may fail to online. For example,
577	  sufficient kernel-capable memory (ZONE_NORMAL) must be
578	  available to allocate page structs to describe ZONE_MOVABLE.
579
580endchoice
581
582config MEMORY_HOTREMOVE
583	bool "Allow for memory hot remove"
584	select MIGRATION
585
586config MHP_MEMMAP_ON_MEMORY
587	def_bool y
588	depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
589
590endif # MEMORY_HOTPLUG
591
592config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
593       bool
594
595# Heavily threaded applications may benefit from splitting the mm-wide
596# page_table_lock, so that faults on different parts of the user address
597# space can be handled with less contention: split it at this NR_CPUS.
598# Default to 4 for wider testing, though 8 might be more appropriate.
599# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
600# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
601# SPARC32 allocates multiple pte tables within a single page, and therefore
602# a per-page lock leads to problems when multiple tables need to be locked
603# at the same time (e.g. copy_page_range()).
604# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
605#
606config SPLIT_PTE_PTLOCKS
607	def_bool y
608	depends on MMU
609	depends on SMP
610	depends on NR_CPUS >= 4
611	depends on !ARM || CPU_CACHE_VIPT
612	depends on !PARISC || PA20
613	depends on !SPARC32
614	depends on !UML
615
616config ARCH_ENABLE_SPLIT_PMD_PTLOCK
617	bool
618
619config SPLIT_PMD_PTLOCKS
620	def_bool y
621	depends on SPLIT_PTE_PTLOCKS && ARCH_ENABLE_SPLIT_PMD_PTLOCK
622
623#
624# support for memory balloon
625config BALLOON
626	bool
627
628#
629# support for memory balloon page migration
630config BALLOON_MIGRATION
631	bool "Allow for balloon memory migration"
632	default y
633	depends on MIGRATION && BALLOON
634	help
635	  Allow for migration of pages inflated in a memory balloon such that
636	  they can be allocated from memory areas only available for movable
637	  allocations (e.g., ZONE_MOVABLE, CMA) and such that they can be
638	  migrated for memory defragmentation purposes by memory compaction.
639
640#
641# support for memory compaction
642config COMPACTION
643	bool "Allow for memory compaction"
644	default y
645	select MIGRATION
646	depends on MMU
647	help
648	  Compaction is the only memory management component to form
649	  high order (larger physically contiguous) memory blocks
650	  reliably. The page allocator relies on compaction heavily and
651	  the lack of the feature can lead to unexpected OOM killer
652	  invocations for high order memory requests. You shouldn't
653	  disable this option unless there really is a strong reason for
654	  it and then we would be really interested to hear about that at
655	  linux-mm@kvack.org.
656
657config COMPACT_UNEVICTABLE_DEFAULT
658	int
659	depends on COMPACTION
660	default 0 if PREEMPT_RT
661	default 1
662
663#
664# support for free page reporting
665config PAGE_REPORTING
666	bool "Free page reporting"
667	help
668	  Free page reporting allows for the incremental acquisition of
669	  free pages from the buddy allocator for the purpose of reporting
670	  those pages to another entity, such as a hypervisor, so that the
671	  memory can be freed within the host for other uses.
672
673config NUMA_MIGRATION
674	bool "NUMA page migration"
675	default y
676	depends on NUMA && MMU
677	select MIGRATION
678	help
679	  Support the migration of pages to other NUMA nodes, available to
680	  user space through interfaces like migrate_pages(), move_pages(),
681	  and mbind(). Selecting this option also enables support for page
682	  demotion for memory tiering.
683
684config MIGRATION
685	bool
686	depends on MMU
687
688config DEVICE_MIGRATION
689	def_bool MIGRATION && ZONE_DEVICE
690
691config ARCH_ENABLE_HUGEPAGE_MIGRATION
692	bool
693
694config ARCH_HAS_PMD_SOFTLEAVES
695	bool
696
697config HUGETLB_PAGE_SIZE_VARIABLE
698	def_bool n
699	help
700	  Allows the pageblock_order value to be dynamic instead of just standard
701	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
702	  on a platform.
703
704	  Note that the pageblock_order cannot exceed MAX_PAGE_ORDER and will be
705	  clamped down to MAX_PAGE_ORDER.
706
707config CONTIG_ALLOC
708	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
709
710config PCP_BATCH_SCALE_MAX
711	int "Maximum scale factor of PCP (Per-CPU pageset) batch allocate/free"
712	default 5
713	range 0 6
714	help
715	  In page allocator, PCP (Per-CPU pageset) is refilled and drained in
716	  batches.  The batch number is scaled automatically to improve page
717	  allocation/free throughput.  But too large scale factor may hurt
718	  latency.  This option sets the upper limit of scale factor to limit
719	  the maximum latency.
720
721config PHYS_ADDR_T_64BIT
722	def_bool 64BIT
723
724config MMU_NOTIFIER
725	bool
726	select INTERVAL_TREE
727
728config KSM
729	bool "Enable KSM for page merging"
730	depends on MMU
731	select XXHASH
732	help
733	  Enable Kernel Samepage Merging: KSM periodically scans those areas
734	  of an application's address space that an app has advised may be
735	  mergeable.  When it finds pages of identical content, it replaces
736	  the many instances by a single page with that content, so
737	  saving memory until one or another app needs to modify the content.
738	  Recommended for use with KVM, or with other duplicative applications.
739	  See Documentation/mm/ksm.rst for more information: KSM is inactive
740	  until a program has madvised that an area is MADV_MERGEABLE, and
741	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
742
743config DEFAULT_MMAP_MIN_ADDR
744	int "Low address space to protect from user allocation"
745	depends on MMU
746	default 4096
747	help
748	  This is the portion of low virtual memory which should be protected
749	  from userspace allocation.  Keeping a user from writing to low pages
750	  can help reduce the impact of kernel NULL pointer bugs.
751
752	  For most arm64, ppc64 and x86 users with lots of address space
753	  a value of 65536 is reasonable and should cause no problems.
754	  On arm and other archs it should not be higher than 32768.
755	  Programs which use vm86 functionality or have some need to map
756	  this low address space will need CAP_SYS_RAWIO or disable this
757	  protection by setting the value to 0.
758
759	  This value can be changed after boot using the
760	  /proc/sys/vm/mmap_min_addr tunable.
761
762config ARCH_SUPPORTS_MEMORY_FAILURE
763	bool
764
765config MEMORY_FAILURE
766	depends on MMU
767	depends on ARCH_SUPPORTS_MEMORY_FAILURE
768	bool "Enable recovery from hardware memory errors"
769	select INTERVAL_TREE
770	help
771	  Enables code to recover from some memory failures on systems
772	  with MCA recovery. This allows a system to continue running
773	  even when some of its memory has uncorrected errors. This requires
774	  special hardware support and typically ECC memory.
775
776config HWPOISON_INJECT
777	tristate "HWPoison pages injector"
778	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
779	select PROC_PAGE_MONITOR
780
781config NOMMU_INITIAL_TRIM_EXCESS
782	int "Turn on mmap() excess space trimming before booting"
783	depends on !MMU
784	default 1
785	help
786	  The NOMMU mmap() frequently needs to allocate large contiguous chunks
787	  of memory on which to store mappings, but it can only ask the system
788	  allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
789	  more than it requires.  To deal with this, mmap() is able to trim off
790	  the excess and return it to the allocator.
791
792	  If trimming is enabled, the excess is trimmed off and returned to the
793	  system allocator, which can cause extra fragmentation, particularly
794	  if there are a lot of transient processes.
795
796	  If trimming is disabled, the excess is kept, but not used, which for
797	  long-term mappings means that the space is wasted.
798
799	  Trimming can be dynamically controlled through a sysctl option
800	  (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
801	  excess pages there must be before trimming should occur, or zero if
802	  no trimming is to occur.
803
804	  This option specifies the initial value of this option.  The default
805	  of 1 says that all excess pages should be trimmed.
806
807	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
808
809config ARCH_WANT_GENERAL_HUGETLB
810	bool
811
812config ARCH_WANTS_THP_SWAP
813	def_bool n
814
815config PERSISTENT_HUGE_ZERO_FOLIO
816	bool "Allocate a PMD sized folio for zeroing"
817	depends on TRANSPARENT_HUGEPAGE
818	help
819	  Enable this option to reduce the runtime refcounting overhead
820	  of the huge zero folio and expand the places in the kernel
821	  that can use huge zero folios. For instance, block I/O benefits
822	  from access to large folios for zeroing memory.
823
824	  With this option enabled, the huge zero folio is allocated
825	  once and never freed. One full huge page's worth of memory shall
826	  be used.
827
828	  Say Y if your system has lots of memory. Say N if you are
829	  memory constrained.
830
831config MM_ID
832	def_bool n
833
834menuconfig TRANSPARENT_HUGEPAGE
835	bool "Transparent Hugepage Support"
836	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
837	select COMPACTION
838	select XARRAY_MULTI
839	select MM_ID
840	help
841	  Transparent Hugepages allows the kernel to use huge pages and
842	  huge tlb transparently to the applications whenever possible.
843	  This feature can improve computing performance to certain
844	  applications by speeding up page faults during memory
845	  allocation, by reducing the number of tlb misses and by speeding
846	  up the pagetable walking.
847
848	  If memory constrained on embedded, you may want to say N.
849
850if TRANSPARENT_HUGEPAGE
851
852choice
853	prompt "Transparent Hugepage Support sysfs defaults"
854	default TRANSPARENT_HUGEPAGE_ALWAYS
855	help
856	  Selects the sysfs defaults for Transparent Hugepage Support.
857
858	config TRANSPARENT_HUGEPAGE_ALWAYS
859		bool "always"
860	help
861	  Enabling Transparent Hugepage always, can increase the
862	  memory footprint of applications without a guaranteed
863	  benefit but it will work automatically for all applications.
864
865	config TRANSPARENT_HUGEPAGE_MADVISE
866		bool "madvise"
867	help
868	  Enabling Transparent Hugepage madvise, will only provide a
869	  performance improvement benefit to the applications using
870	  madvise(MADV_HUGEPAGE) but it won't risk to increase the
871	  memory footprint of applications without a guaranteed
872	  benefit.
873
874	config TRANSPARENT_HUGEPAGE_NEVER
875		bool "never"
876	help
877	  Disable Transparent Hugepage by default. It can still be
878	  enabled at runtime via sysfs.
879endchoice
880
881choice
882	prompt "Shmem hugepage allocation defaults"
883	default TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER
884	help
885	  Selects the hugepage allocation policy defaults for
886	  the internal shmem mount.
887
888	  The selection made here can be overridden by using the kernel
889	  command line 'transparent_hugepage_shmem=' option.
890
891	config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER
892		bool "never"
893	help
894	  Disable hugepage allocation for shmem mount by default. It can
895	  still be enabled with the kernel command line
896	  'transparent_hugepage_shmem=' option or at runtime via sysfs
897	  knob. Note that madvise(MADV_COLLAPSE) can still cause
898	  transparent huge pages to be obtained even if this mode is
899	  specified.
900
901	config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ALWAYS
902		bool "always"
903	help
904	  Always attempt to allocate hugepage for shmem mount, can
905	  increase the memory footprint of applications without a
906	  guaranteed benefit but it will work automatically for all
907	  applications.
908
909	config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_WITHIN_SIZE
910		bool "within_size"
911	help
912	  Enable hugepage allocation for shmem mount if the allocation
913	  will be fully within the i_size. This configuration also takes
914	  into account any madvise(MADV_HUGEPAGE) hints that may be
915	  provided by the applications.
916
917	config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ADVISE
918		bool "advise"
919	help
920	  Enable hugepage allocation for the shmem mount exclusively when
921	  applications supply the madvise(MADV_HUGEPAGE) hint.
922	  This ensures that hugepages are used only in response to explicit
923	  requests from applications.
924endchoice
925
926choice
927	prompt "Tmpfs hugepage allocation defaults"
928	default TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER
929	help
930	  Selects the hugepage allocation policy defaults for
931	  the tmpfs mount.
932
933	  The selection made here can be overridden by using the kernel
934	  command line 'transparent_hugepage_tmpfs=' option.
935
936	config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER
937		bool "never"
938	help
939	  Disable hugepage allocation for tmpfs mount by default. It can
940	  still be enabled with the kernel command line
941	  'transparent_hugepage_tmpfs=' option. Note that
942	  madvise(MADV_COLLAPSE) can still cause transparent huge pages
943	  to be obtained even if this mode is specified.
944
945	config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ALWAYS
946		bool "always"
947	help
948	  Always attempt to allocate hugepage for tmpfs mount, can
949	  increase the memory footprint of applications without a
950	  guaranteed benefit but it will work automatically for all
951	  applications.
952
953	config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_WITHIN_SIZE
954		bool "within_size"
955	help
956	  Enable hugepage allocation for tmpfs mount if the allocation
957	  will be fully within the i_size. This configuration also takes
958	  into account any madvise(MADV_HUGEPAGE) hints that may be
959	  provided by the applications.
960
961	config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ADVISE
962		bool "advise"
963	help
964	  Enable hugepage allocation for the tmpfs mount exclusively when
965	  applications supply the madvise(MADV_HUGEPAGE) hint.
966	  This ensures that hugepages are used only in response to explicit
967	  requests from applications.
968endchoice
969
970config THP_SWAP
971	def_bool y
972	depends on ARCH_WANTS_THP_SWAP && SWAP && 64BIT
973	help
974	  Swap transparent huge pages in one piece, without splitting.
975	  XXX: For now, swap cluster backing transparent huge page
976	  will be split after swapout.
977
978	  For selection by architectures with reasonable THP sizes.
979
980config NO_PAGE_MAPCOUNT
981	bool "No per-page mapcount (EXPERIMENTAL)"
982	help
983	  Do not maintain per-page mapcounts for pages part of larger
984	  allocations, such as transparent huge pages.
985
986	  When this config option is enabled, some interfaces that relied on
987	  this information will rely on less-precise per-allocation information
988	  instead: for example, using the average per-page mapcount in such
989	  a large allocation instead of the per-page mapcount.
990
991	  EXPERIMENTAL because the impact of some changes is still unclear.
992
993endif # TRANSPARENT_HUGEPAGE
994
995# simple helper to make the code a bit easier to read
996config PAGE_MAPCOUNT
997	def_bool !NO_PAGE_MAPCOUNT
998
999#
1000# The architecture supports pgtable leaves that is larger than PAGE_SIZE
1001#
1002config PGTABLE_HAS_HUGE_LEAVES
1003	def_bool TRANSPARENT_HUGEPAGE || HUGETLB_PAGE
1004
1005#
1006# We can end up creating gigantic folio.
1007#
1008config HAVE_GIGANTIC_FOLIOS
1009	def_bool (HUGETLB_PAGE && ARCH_HAS_GIGANTIC_PAGE) || \
1010		 (ZONE_DEVICE && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
1011
1012config ASYNC_KERNEL_PGTABLE_FREE
1013	def_bool n
1014
1015# TODO: Allow to be enabled without THP
1016config ARCH_SUPPORTS_HUGE_PFNMAP
1017	def_bool n
1018	depends on TRANSPARENT_HUGEPAGE
1019
1020config ARCH_SUPPORTS_PMD_PFNMAP
1021	def_bool y
1022	depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE
1023
1024config ARCH_SUPPORTS_PUD_PFNMAP
1025	def_bool y
1026	depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
1027
1028#
1029# Architectures that always use weak definitions for percpu
1030# variables in modules should set this.
1031#
1032config ARCH_MODULE_NEEDS_WEAK_PER_CPU
1033       bool
1034
1035#
1036# UP and nommu archs use km based percpu allocator
1037#
1038config NEED_PER_CPU_KM
1039	depends on !SMP || !MMU
1040	bool
1041	default y
1042
1043config NEED_PER_CPU_EMBED_FIRST_CHUNK
1044	bool
1045
1046config NEED_PER_CPU_PAGE_FIRST_CHUNK
1047	bool
1048
1049config USE_PERCPU_NUMA_NODE_ID
1050	bool
1051
1052config HAVE_SETUP_PER_CPU_AREA
1053	bool
1054
1055config CMA
1056	bool "Contiguous Memory Allocator"
1057	depends on MMU
1058	select MIGRATION
1059	select MEMORY_ISOLATION
1060	help
1061	  This enables the Contiguous Memory Allocator which allows other
1062	  subsystems to allocate big physically-contiguous blocks of memory.
1063	  CMA reserves a region of memory and allows only movable pages to
1064	  be allocated from it. This way, the kernel can use the memory for
1065	  pagecache and when a subsystem requests for contiguous area, the
1066	  allocated pages are migrated away to serve the contiguous request.
1067
1068	  If unsure, say "n".
1069
1070config CMA_DEBUGFS
1071	bool "CMA debugfs interface"
1072	depends on CMA && DEBUG_FS
1073	help
1074	  Turns on the DebugFS interface for CMA.
1075
1076config CMA_SYSFS
1077	bool "CMA information through sysfs interface"
1078	depends on CMA && SYSFS
1079	help
1080	  This option exposes some sysfs attributes to get information
1081	  from CMA.
1082
1083config CMA_AREAS
1084	int "Maximum count of the CMA areas"
1085	depends on CMA
1086	default 20 if NUMA
1087	default 8
1088	help
1089	  CMA allows to create CMA areas for particular purpose, mainly,
1090	  used as device private area. This parameter sets the maximum
1091	  number of CMA area in the system.
1092
1093	  If unsure, leave the default value "8" in UMA and "20" in NUMA.
1094
1095#
1096# Select this config option from the architecture Kconfig, if available, to set
1097# the max page order for physically contiguous allocations.
1098#
1099config ARCH_FORCE_MAX_ORDER
1100	int
1101
1102#
1103# When ARCH_FORCE_MAX_ORDER is not defined,
1104# the default page block order is MAX_PAGE_ORDER (10) as per
1105# include/linux/mmzone.h.
1106#
1107config PAGE_BLOCK_MAX_ORDER
1108	int "Page Block Order Upper Limit"
1109	range 1 10 if ARCH_FORCE_MAX_ORDER = 0
1110	default 10 if ARCH_FORCE_MAX_ORDER = 0
1111	range 1 ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0
1112	default ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0
1113	help
1114	  The page block order refers to the power of two number of pages that
1115	  are physically contiguous and can have a migrate type associated to
1116	  them. The maximum size of the page block order is at least limited by
1117	  ARCH_FORCE_MAX_ORDER/MAX_PAGE_ORDER.
1118
1119	  This config adds a new upper limit of default page block
1120	  order when the page block order is required to be smaller than
1121	  ARCH_FORCE_MAX_ORDER/MAX_PAGE_ORDER or other limits
1122	  (see include/linux/pageblock-flags.h for details).
1123
1124	  Reducing pageblock order can negatively impact THP generation
1125	  success rate. If your workloads use THP heavily, please use this
1126	  option with caution.
1127
1128	  Don't change if unsure.
1129
1130config MEM_SOFT_DIRTY
1131	bool "Track memory changes"
1132	depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
1133	select PROC_PAGE_MONITOR
1134	help
1135	  This option enables memory changes tracking by introducing a
1136	  soft-dirty bit on pte-s. This bit it set when someone writes
1137	  into a page just as regular dirty bit, but unlike the latter
1138	  it can be cleared by hands.
1139
1140	  See Documentation/admin-guide/mm/soft-dirty.rst for more details.
1141
1142config GENERIC_EARLY_IOREMAP
1143	bool
1144
1145config STACK_MAX_DEFAULT_SIZE_MB
1146	int "Default maximum user stack size for 32-bit processes (MB)"
1147	default 100
1148	range 8 2048
1149	depends on STACK_GROWSUP && (!64BIT || COMPAT)
1150	help
1151	  This is the maximum stack size in Megabytes in the VM layout of 32-bit
1152	  user processes when the stack grows upwards (currently only on parisc
1153	  arch) when the RLIMIT_STACK hard limit is unlimited.
1154
1155	  A sane initial value is 100 MB.
1156
1157config DEFERRED_STRUCT_PAGE_INIT
1158	bool "Defer initialisation of struct pages to kthreads"
1159	depends on SPARSEMEM
1160	depends on !NEED_PER_CPU_KM
1161	depends on 64BIT
1162	depends on !KMSAN
1163	select PADATA
1164	help
1165	  Ordinarily all struct pages are initialised during early boot in a
1166	  single thread. On very large machines this can take a considerable
1167	  amount of time. If this option is set, large machines will bring up
1168	  a subset of memmap at boot and then initialise the rest in parallel.
1169	  This has a potential performance impact on tasks running early in the
1170	  lifetime of the system until these kthreads finish the
1171	  initialisation.
1172
1173config PAGE_IDLE_FLAG
1174	bool
1175	select PAGE_EXTENSION if !64BIT
1176	help
1177	  This adds PG_idle and PG_young flags to 'struct page'.  PTE Accessed
1178	  bit writers can set the state of the bit in the flags so that PTE
1179	  Accessed bit readers may avoid disturbance.
1180
1181config IDLE_PAGE_TRACKING
1182	bool "Enable idle page tracking"
1183	depends on SYSFS && MMU
1184	select PAGE_IDLE_FLAG
1185	help
1186	  This feature allows to estimate the amount of user pages that have
1187	  not been touched during a given period of time. This information can
1188	  be useful to tune memory cgroup limits and/or for job placement
1189	  within a compute cluster.
1190
1191	  See Documentation/admin-guide/mm/idle_page_tracking.rst for
1192	  more details.
1193
1194# Architectures which implement cpu_dcache_is_aliasing() to query
1195# whether the data caches are aliased (VIVT or VIPT with dcache
1196# aliasing) need to select this.
1197config ARCH_HAS_CPU_CACHE_ALIASING
1198	bool
1199
1200config ARCH_HAS_CACHE_LINE_SIZE
1201	bool
1202
1203config ARCH_HAS_CURRENT_STACK_POINTER
1204	bool
1205	help
1206	  In support of HARDENED_USERCOPY performing stack variable lifetime
1207	  checking, an architecture-agnostic way to find the stack pointer
1208	  is needed. Once an architecture defines an unsigned long global
1209	  register alias named "current_stack_pointer", this config can be
1210	  selected.
1211
1212config ARCH_HAS_ZONE_DMA_SET
1213	bool
1214
1215config ZONE_DMA
1216	bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
1217	default y if ARM64 || X86
1218
1219config ZONE_DMA32
1220	bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
1221	depends on !X86_32
1222	default y if ARM64
1223
1224config ZONE_DEVICE
1225	bool "Device memory (pmem, HMM, etc...) hotplug support"
1226	depends on MEMORY_HOTREMOVE
1227	select XARRAY_MULTI
1228
1229	help
1230	  Device memory hotplug support allows for establishing pmem,
1231	  or other device driver discovered memory regions, in the
1232	  memmap. This allows pfn_to_page() lookups of otherwise
1233	  "device-physical" addresses which is needed for DAX, PCI_P2PDMA, and
1234	  DEVICE_PRIVATE features among others.
1235
1236	  Enabling this option will reduce the entropy of x86 KASLR memory
1237	  regions. For example - on a 46 bit system, the entropy goes down
1238	  from 16 bits to 15 bits. The actual reduction in entropy depends
1239	  on the physical address bits, on processor features, kernel config
1240	  (5 level page table) and physical memory present on the system.
1241
1242#
1243# Helpers to mirror range of the CPU page tables of a process into device page
1244# tables.
1245#
1246config HMM_MIRROR
1247	bool
1248	depends on MMU
1249	select MMU_NOTIFIER
1250
1251config GET_FREE_REGION
1252	bool
1253
1254config DEVICE_PRIVATE
1255	bool "Unaddressable device memory (GPU memory, ...)"
1256	depends on ZONE_DEVICE
1257	select GET_FREE_REGION
1258
1259	help
1260	  Allows creation of struct pages to represent unaddressable device
1261	  memory; i.e., memory that is only accessible from the device (or
1262	  group of devices). You likely also want to select HMM_MIRROR.
1263
1264config VMAP_PFN
1265	bool
1266
1267config ARCH_USES_HIGH_VMA_FLAGS
1268	bool
1269config ARCH_HAS_PKEYS
1270	bool
1271
1272config ARCH_USES_PG_ARCH_2
1273	bool
1274config ARCH_USES_PG_ARCH_3
1275	bool
1276
1277config VM_EVENT_COUNTERS
1278	default y
1279	bool "Enable VM event counters for /proc/vmstat" if EXPERT
1280	help
1281	  VM event counters are needed for event counts to be shown.
1282	  This option allows the disabling of the VM event counters
1283	  on EXPERT systems.  /proc/vmstat will only show page counts
1284	  if VM event counters are disabled.
1285
1286config PERCPU_STATS
1287	bool "Collect percpu memory statistics"
1288	help
1289	  This feature collects and exposes statistics via debugfs. The
1290	  information includes global and per chunk statistics, which can
1291	  be used to help understand percpu memory usage.
1292
1293config GUP_TEST
1294	bool "Enable infrastructure for get_user_pages()-related unit tests"
1295	depends on DEBUG_FS
1296	help
1297	  Provides /sys/kernel/debug/gup_test, which in turn provides a way
1298	  to make ioctl calls that can launch kernel-based unit tests for
1299	  the get_user_pages*() and pin_user_pages*() family of API calls.
1300
1301	  These tests include benchmark testing of the _fast variants of
1302	  get_user_pages*() and pin_user_pages*(), as well as smoke tests of
1303	  the non-_fast variants.
1304
1305	  There is also a sub-test that allows running dump_page() on any
1306	  of up to eight pages (selected by command line args) within the
1307	  range of user-space addresses. These pages are either pinned via
1308	  pin_user_pages*(), or pinned via get_user_pages*(), as specified
1309	  by other command line arguments.
1310
1311	  See tools/testing/selftests/mm/gup_test.c
1312
1313comment "GUP_TEST needs to have DEBUG_FS enabled"
1314	depends on !GUP_TEST && !DEBUG_FS
1315
1316config GUP_GET_PXX_LOW_HIGH
1317	bool
1318
1319config DMAPOOL_TEST
1320	tristate "Enable a module to run time tests on dma_pool"
1321	depends on HAS_DMA
1322	help
1323	  Provides a test module that will allocate and free many blocks of
1324	  various sizes and report how long it takes. This is intended to
1325	  provide a consistent way to measure how changes to the
1326	  dma_pool_alloc/free routines affect performance.
1327
1328config ARCH_HAS_PTE_SPECIAL
1329	bool
1330
1331config MAPPING_DIRTY_HELPERS
1332	bool
1333
1334config KMAP_LOCAL
1335	bool
1336
1337config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
1338	bool
1339
1340config MEMFD_CREATE
1341	bool "Enable memfd_create() system call" if EXPERT
1342
1343config SECRETMEM
1344	default y
1345	bool "Enable memfd_secret() system call" if EXPERT
1346	depends on ARCH_HAS_SET_DIRECT_MAP
1347	help
1348	  Enable the memfd_secret() system call with the ability to create
1349	  memory areas visible only in the context of the owning process and
1350	  not mapped to other processes and other kernel page tables.
1351
1352config ANON_VMA_NAME
1353	bool "Anonymous VMA name support"
1354	depends on PROC_FS && ADVISE_SYSCALLS && MMU
1355
1356	help
1357	  Allow naming anonymous virtual memory areas.
1358
1359	  This feature allows assigning names to virtual memory areas. Assigned
1360	  names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
1361	  and help identifying individual anonymous memory areas.
1362	  Assigning a name to anonymous virtual memory area might prevent that
1363	  area from being merged with adjacent virtual memory areas due to the
1364	  difference in their name.
1365
1366config HAVE_ARCH_USERFAULTFD_WP
1367	bool
1368	help
1369	  Arch has userfaultfd write protection support
1370
1371config HAVE_ARCH_USERFAULTFD_MINOR
1372	bool
1373	help
1374	  Arch has userfaultfd minor fault support
1375
1376config USERFAULTFD_RWP
1377	def_bool y
1378	depends on 64BIT && ARCH_HAS_PTE_PROTNONE && HAVE_ARCH_USERFAULTFD_WP
1379	help
1380	  Userfaultfd read-write protection (UFFDIO_RWPROTECT) delivers a
1381	  userfaultfd notification on every access -- read or write -- to a
1382	  protected range, letting userspace observe the working set of a
1383	  process.
1384
1385menuconfig USERFAULTFD
1386	bool "Enable userfaultfd() system call"
1387	depends on MMU
1388	help
1389	  Enable the userfaultfd() system call that allows to intercept and
1390	  handle page faults in userland.
1391
1392config PTE_MARKER_UFFD_WP
1393	bool "Userfaultfd write protection support for shmem/hugetlbfs"
1394	default y
1395	depends on USERFAULTFD && HAVE_ARCH_USERFAULTFD_WP
1396
1397	help
1398	  Allows to create marker PTEs for userfaultfd write protection
1399	  purposes.  It is required to enable userfaultfd write protection on
1400	  file-backed memory types like shmem and hugetlbfs.
1401
1402# multi-gen LRU {
1403config LRU_GEN
1404	bool "Multi-Gen LRU"
1405	depends on MMU
1406	# make sure folio->flags has enough spare bits
1407	depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
1408	help
1409	  A high performance LRU implementation to overcommit memory. See
1410	  Documentation/admin-guide/mm/multigen_lru.rst for details.
1411
1412config LRU_GEN_ENABLED
1413	bool "Enable by default"
1414	depends on LRU_GEN
1415	help
1416	  This option enables the multi-gen LRU by default.
1417
1418config LRU_GEN_STATS
1419	bool "Full stats for debugging"
1420	depends on LRU_GEN
1421	help
1422	  Do not enable this option unless you plan to look at historical stats
1423	  from evicted generations for debugging purpose.
1424
1425	  This option has a per-memcg and per-node memory overhead.
1426
1427config LRU_GEN_WALKS_MMU
1428	def_bool y
1429	depends on LRU_GEN && ARCH_HAS_HW_PTE_YOUNG
1430# }
1431
1432config ARCH_SUPPORTS_PER_VMA_LOCK
1433       def_bool n
1434
1435config PER_VMA_LOCK
1436	def_bool y
1437	depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP
1438	help
1439	  Allow per-vma locking during page fault handling.
1440
1441	  This feature allows locking each virtual memory area separately when
1442	  handling page faults instead of taking mmap_lock.
1443
1444config LOCK_MM_AND_FIND_VMA
1445	bool
1446	depends on !STACK_GROWSUP
1447
1448config IOMMU_MM_DATA
1449	bool
1450
1451config EXECMEM
1452	bool
1453
1454config NUMA_MEMBLKS
1455	bool
1456
1457config NUMA_EMU
1458	bool "NUMA emulation"
1459	depends on NUMA_MEMBLKS
1460	depends on X86 || GENERIC_ARCH_NUMA
1461	help
1462	  Enable NUMA emulation. A flat machine will be split
1463	  into virtual nodes when booted with "numa=fake=N", where N is the
1464	  number of nodes. This is only useful for debugging.
1465
1466config GENERIC_ARCH_NUMA
1467	bool
1468	select NUMA_MEMBLKS
1469	help
1470	  Enable support for generic NUMA implementation. Currently, RISC-V
1471	  and ARM64 use it.
1472
1473config ARCH_HAS_USER_SHADOW_STACK
1474	bool
1475	help
1476	  The architecture has hardware support for userspace shadow call
1477	  stacks (eg, x86 CET, arm64 GCS or RISC-V Zicfiss).
1478
1479config HAVE_ARCH_TLB_REMOVE_TABLE
1480	def_bool n
1481
1482config PT_RECLAIM
1483	def_bool y
1484	depends on MMU_GATHER_RCU_TABLE_FREE && !HAVE_ARCH_TLB_REMOVE_TABLE
1485	help
1486	  Try to reclaim empty user page table pages in paths other than munmap
1487	  and exit_mmap path.
1488
1489	  Note: now only empty user PTE page table pages will be reclaimed.
1490
1491config FIND_NORMAL_PAGE
1492	def_bool n
1493
1494config ARCH_HAS_LAZY_MMU_MODE
1495	bool
1496	help
1497	  The architecture uses the lazy MMU mode. This allows changes to
1498	  MMU-related architectural state to be deferred until the mode is
1499	  exited. See <linux/pgtable.h> for details.
1500
1501config LAZY_MMU_MODE_KUNIT_TEST
1502	tristate "KUnit tests for the lazy MMU mode" if !KUNIT_ALL_TESTS
1503	depends on ARCH_HAS_LAZY_MMU_MODE
1504	depends on KUNIT
1505	default KUNIT_ALL_TESTS
1506	help
1507	  Enable this option to check that the lazy MMU mode interface behaves
1508	  as expected. Only tests for the generic interface are included (not
1509	  architecture-specific behaviours).
1510
1511	  If unsure, say N.
1512
1513source "mm/damon/Kconfig"
1514
1515endmenu
1516