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