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 468# eventually, we can have this option just 'select SPARSEMEM' 469menuconfig MEMORY_HOTPLUG 470 bool "Memory hotplug" 471 select MEMORY_ISOLATION 472 depends on SPARSEMEM_VMEMMAP 473 depends on ARCH_ENABLE_MEMORY_HOTPLUG 474 depends on 64BIT 475 select NUMA_KEEP_MEMINFO if NUMA 476 477if MEMORY_HOTPLUG 478 479choice 480 prompt "Memory Hotplug Default Online Type" 481 default MHP_DEFAULT_ONLINE_TYPE_OFFLINE 482 help 483 Default memory type for hotplugged memory. 484 485 This option sets the default policy setting for memory hotplug 486 onlining policy (/sys/devices/system/memory/auto_online_blocks) which 487 determines what happens to newly added memory regions. Policy setting 488 can always be changed at runtime. 489 490 The default is 'offline'. 491 492 Select offline to defer onlining to drivers and user policy. 493 Select auto to let the kernel choose what zones to utilize. 494 Select online_kernel to generally allow kernel usage of this memory. 495 Select online_movable to generally disallow kernel usage of this memory. 496 497 Example kernel usage would be page structs and page tables. 498 499 See Documentation/admin-guide/mm/memory-hotplug.rst for more information. 500 501config MHP_DEFAULT_ONLINE_TYPE_OFFLINE 502 bool "offline" 503 help 504 Hotplugged memory will not be onlined by default. 505 Choose this for systems with drivers and user policy that 506 handle onlining of hotplug memory policy. 507 508config MHP_DEFAULT_ONLINE_TYPE_ONLINE_AUTO 509 bool "auto" 510 help 511 Select this if you want the kernel to automatically online 512 hotplugged memory into the zone it thinks is reasonable. 513 This memory may be utilized for kernel data. 514 515config MHP_DEFAULT_ONLINE_TYPE_ONLINE_KERNEL 516 bool "kernel" 517 help 518 Select this if you want the kernel to automatically online 519 hotplugged memory into a zone capable of being used for kernel 520 data. This typically means ZONE_NORMAL. 521 522config MHP_DEFAULT_ONLINE_TYPE_ONLINE_MOVABLE 523 bool "movable" 524 help 525 Select this if you want the kernel to automatically online 526 hotplug memory into ZONE_MOVABLE. This memory will generally 527 not be utilized for kernel data. 528 529 This should only be used when the admin knows sufficient 530 ZONE_NORMAL memory is available to describe hotplug memory, 531 otherwise hotplug memory may fail to online. For example, 532 sufficient kernel-capable memory (ZONE_NORMAL) must be 533 available to allocate page structs to describe ZONE_MOVABLE. 534 535endchoice 536 537config MEMORY_HOTREMOVE 538 bool "Allow for memory hot remove" 539 select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64) 540 depends on MEMORY_HOTPLUG 541 select MIGRATION 542 543config MHP_MEMMAP_ON_MEMORY 544 def_bool y 545 depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP 546 depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE 547 548endif # MEMORY_HOTPLUG 549 550config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE 551 bool 552 553# Heavily threaded applications may benefit from splitting the mm-wide 554# page_table_lock, so that faults on different parts of the user address 555# space can be handled with less contention: split it at this NR_CPUS. 556# Default to 4 for wider testing, though 8 might be more appropriate. 557# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock. 558# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes. 559# SPARC32 allocates multiple pte tables within a single page, and therefore 560# a per-page lock leads to problems when multiple tables need to be locked 561# at the same time (e.g. copy_page_range()). 562# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page. 563# 564config SPLIT_PTE_PTLOCKS 565 def_bool y 566 depends on MMU 567 depends on SMP 568 depends on NR_CPUS >= 4 569 depends on !ARM || CPU_CACHE_VIPT 570 depends on !PARISC || PA20 571 depends on !SPARC32 572 573config ARCH_ENABLE_SPLIT_PMD_PTLOCK 574 bool 575 576config SPLIT_PMD_PTLOCKS 577 def_bool y 578 depends on SPLIT_PTE_PTLOCKS && ARCH_ENABLE_SPLIT_PMD_PTLOCK 579 580# 581# support for memory balloon 582config BALLOON 583 bool 584 585# 586# support for memory balloon page migration 587config BALLOON_MIGRATION 588 bool "Allow for balloon memory migration" 589 default y 590 depends on MIGRATION && BALLOON 591 help 592 Allow for migration of pages inflated in a memory balloon such that 593 they can be allocated from memory areas only available for movable 594 allocations (e.g., ZONE_MOVABLE, CMA) and such that they can be 595 migrated for memory defragmentation purposes by memory compaction. 596 597# 598# support for memory compaction 599config COMPACTION 600 bool "Allow for memory compaction" 601 default y 602 select MIGRATION 603 depends on MMU 604 help 605 Compaction is the only memory management component to form 606 high order (larger physically contiguous) memory blocks 607 reliably. The page allocator relies on compaction heavily and 608 the lack of the feature can lead to unexpected OOM killer 609 invocations for high order memory requests. You shouldn't 610 disable this option unless there really is a strong reason for 611 it and then we would be really interested to hear about that at 612 linux-mm@kvack.org. 613 614config COMPACT_UNEVICTABLE_DEFAULT 615 int 616 depends on COMPACTION 617 default 0 if PREEMPT_RT 618 default 1 619 620# 621# support for free page reporting 622config PAGE_REPORTING 623 bool "Free page reporting" 624 help 625 Free page reporting allows for the incremental acquisition of 626 free pages from the buddy allocator for the purpose of reporting 627 those pages to another entity, such as a hypervisor, so that the 628 memory can be freed within the host for other uses. 629 630# 631# support for page migration 632# 633config MIGRATION 634 bool "Page migration" 635 default y 636 depends on (NUMA || MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU 637 help 638 Allows the migration of the physical location of pages of processes 639 while the virtual addresses are not changed. This is useful in 640 two situations. The first is on NUMA systems to put pages nearer 641 to the processors accessing. The second is when allocating huge 642 pages as migration can relocate pages to satisfy a huge page 643 allocation instead of reclaiming. 644 645config DEVICE_MIGRATION 646 def_bool MIGRATION && ZONE_DEVICE 647 648config ARCH_ENABLE_HUGEPAGE_MIGRATION 649 bool 650 651config ARCH_ENABLE_THP_MIGRATION 652 bool 653 654config HUGETLB_PAGE_SIZE_VARIABLE 655 def_bool n 656 help 657 Allows the pageblock_order value to be dynamic instead of just standard 658 HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available 659 on a platform. 660 661 Note that the pageblock_order cannot exceed MAX_PAGE_ORDER and will be 662 clamped down to MAX_PAGE_ORDER. 663 664config CONTIG_ALLOC 665 def_bool (MEMORY_ISOLATION && COMPACTION) || CMA 666 667config PCP_BATCH_SCALE_MAX 668 int "Maximum scale factor of PCP (Per-CPU pageset) batch allocate/free" 669 default 5 670 range 0 6 671 help 672 In page allocator, PCP (Per-CPU pageset) is refilled and drained in 673 batches. The batch number is scaled automatically to improve page 674 allocation/free throughput. But too large scale factor may hurt 675 latency. This option sets the upper limit of scale factor to limit 676 the maximum latency. 677 678config PHYS_ADDR_T_64BIT 679 def_bool 64BIT 680 681config MMU_NOTIFIER 682 bool 683 select INTERVAL_TREE 684 685config KSM 686 bool "Enable KSM for page merging" 687 depends on MMU 688 select XXHASH 689 help 690 Enable Kernel Samepage Merging: KSM periodically scans those areas 691 of an application's address space that an app has advised may be 692 mergeable. When it finds pages of identical content, it replaces 693 the many instances by a single page with that content, so 694 saving memory until one or another app needs to modify the content. 695 Recommended for use with KVM, or with other duplicative applications. 696 See Documentation/mm/ksm.rst for more information: KSM is inactive 697 until a program has madvised that an area is MADV_MERGEABLE, and 698 root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set). 699 700config DEFAULT_MMAP_MIN_ADDR 701 int "Low address space to protect from user allocation" 702 depends on MMU 703 default 4096 704 help 705 This is the portion of low virtual memory which should be protected 706 from userspace allocation. Keeping a user from writing to low pages 707 can help reduce the impact of kernel NULL pointer bugs. 708 709 For most arm64, ppc64 and x86 users with lots of address space 710 a value of 65536 is reasonable and should cause no problems. 711 On arm and other archs it should not be higher than 32768. 712 Programs which use vm86 functionality or have some need to map 713 this low address space will need CAP_SYS_RAWIO or disable this 714 protection by setting the value to 0. 715 716 This value can be changed after boot using the 717 /proc/sys/vm/mmap_min_addr tunable. 718 719config ARCH_SUPPORTS_MEMORY_FAILURE 720 bool 721 722config MEMORY_FAILURE 723 depends on MMU 724 depends on ARCH_SUPPORTS_MEMORY_FAILURE 725 bool "Enable recovery from hardware memory errors" 726 select INTERVAL_TREE 727 help 728 Enables code to recover from some memory failures on systems 729 with MCA recovery. This allows a system to continue running 730 even when some of its memory has uncorrected errors. This requires 731 special hardware support and typically ECC memory. 732 733config HWPOISON_INJECT 734 tristate "HWPoison pages injector" 735 depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS 736 select PROC_PAGE_MONITOR 737 738config NOMMU_INITIAL_TRIM_EXCESS 739 int "Turn on mmap() excess space trimming before booting" 740 depends on !MMU 741 default 1 742 help 743 The NOMMU mmap() frequently needs to allocate large contiguous chunks 744 of memory on which to store mappings, but it can only ask the system 745 allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently 746 more than it requires. To deal with this, mmap() is able to trim off 747 the excess and return it to the allocator. 748 749 If trimming is enabled, the excess is trimmed off and returned to the 750 system allocator, which can cause extra fragmentation, particularly 751 if there are a lot of transient processes. 752 753 If trimming is disabled, the excess is kept, but not used, which for 754 long-term mappings means that the space is wasted. 755 756 Trimming can be dynamically controlled through a sysctl option 757 (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of 758 excess pages there must be before trimming should occur, or zero if 759 no trimming is to occur. 760 761 This option specifies the initial value of this option. The default 762 of 1 says that all excess pages should be trimmed. 763 764 See Documentation/admin-guide/mm/nommu-mmap.rst for more information. 765 766config ARCH_WANT_GENERAL_HUGETLB 767 bool 768 769config ARCH_WANTS_THP_SWAP 770 def_bool n 771 772config PERSISTENT_HUGE_ZERO_FOLIO 773 bool "Allocate a PMD sized folio for zeroing" 774 depends on TRANSPARENT_HUGEPAGE 775 help 776 Enable this option to reduce the runtime refcounting overhead 777 of the huge zero folio and expand the places in the kernel 778 that can use huge zero folios. For instance, block I/O benefits 779 from access to large folios for zeroing memory. 780 781 With this option enabled, the huge zero folio is allocated 782 once and never freed. One full huge page's worth of memory shall 783 be used. 784 785 Say Y if your system has lots of memory. Say N if you are 786 memory constrained. 787 788config MM_ID 789 def_bool n 790 791menuconfig TRANSPARENT_HUGEPAGE 792 bool "Transparent Hugepage Support" 793 depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT 794 select COMPACTION 795 select XARRAY_MULTI 796 select MM_ID 797 help 798 Transparent Hugepages allows the kernel to use huge pages and 799 huge tlb transparently to the applications whenever possible. 800 This feature can improve computing performance to certain 801 applications by speeding up page faults during memory 802 allocation, by reducing the number of tlb misses and by speeding 803 up the pagetable walking. 804 805 If memory constrained on embedded, you may want to say N. 806 807if TRANSPARENT_HUGEPAGE 808 809choice 810 prompt "Transparent Hugepage Support sysfs defaults" 811 depends on TRANSPARENT_HUGEPAGE 812 default TRANSPARENT_HUGEPAGE_ALWAYS 813 help 814 Selects the sysfs defaults for Transparent Hugepage Support. 815 816 config TRANSPARENT_HUGEPAGE_ALWAYS 817 bool "always" 818 help 819 Enabling Transparent Hugepage always, can increase the 820 memory footprint of applications without a guaranteed 821 benefit but it will work automatically for all applications. 822 823 config TRANSPARENT_HUGEPAGE_MADVISE 824 bool "madvise" 825 help 826 Enabling Transparent Hugepage madvise, will only provide a 827 performance improvement benefit to the applications using 828 madvise(MADV_HUGEPAGE) but it won't risk to increase the 829 memory footprint of applications without a guaranteed 830 benefit. 831 832 config TRANSPARENT_HUGEPAGE_NEVER 833 bool "never" 834 help 835 Disable Transparent Hugepage by default. It can still be 836 enabled at runtime via sysfs. 837endchoice 838 839choice 840 prompt "Shmem hugepage allocation defaults" 841 depends on TRANSPARENT_HUGEPAGE 842 default TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER 843 help 844 Selects the hugepage allocation policy defaults for 845 the internal shmem mount. 846 847 The selection made here can be overridden by using the kernel 848 command line 'transparent_hugepage_shmem=' option. 849 850 config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER 851 bool "never" 852 help 853 Disable hugepage allocation for shmem mount by default. It can 854 still be enabled with the kernel command line 855 'transparent_hugepage_shmem=' option or at runtime via sysfs 856 knob. Note that madvise(MADV_COLLAPSE) can still cause 857 transparent huge pages to be obtained even if this mode is 858 specified. 859 860 config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ALWAYS 861 bool "always" 862 help 863 Always attempt to allocate hugepage for shmem mount, can 864 increase the memory footprint of applications without a 865 guaranteed benefit but it will work automatically for all 866 applications. 867 868 config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_WITHIN_SIZE 869 bool "within_size" 870 help 871 Enable hugepage allocation for shmem mount if the allocation 872 will be fully within the i_size. This configuration also takes 873 into account any madvise(MADV_HUGEPAGE) hints that may be 874 provided by the applications. 875 876 config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ADVISE 877 bool "advise" 878 help 879 Enable hugepage allocation for the shmem mount exclusively when 880 applications supply the madvise(MADV_HUGEPAGE) hint. 881 This ensures that hugepages are used only in response to explicit 882 requests from applications. 883endchoice 884 885choice 886 prompt "Tmpfs hugepage allocation defaults" 887 depends on TRANSPARENT_HUGEPAGE 888 default TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER 889 help 890 Selects the hugepage allocation policy defaults for 891 the tmpfs mount. 892 893 The selection made here can be overridden by using the kernel 894 command line 'transparent_hugepage_tmpfs=' option. 895 896 config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER 897 bool "never" 898 help 899 Disable hugepage allocation for tmpfs mount by default. It can 900 still be enabled with the kernel command line 901 'transparent_hugepage_tmpfs=' option. Note that 902 madvise(MADV_COLLAPSE) can still cause transparent huge pages 903 to be obtained even if this mode is specified. 904 905 config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ALWAYS 906 bool "always" 907 help 908 Always attempt to allocate hugepage for tmpfs mount, can 909 increase the memory footprint of applications without a 910 guaranteed benefit but it will work automatically for all 911 applications. 912 913 config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_WITHIN_SIZE 914 bool "within_size" 915 help 916 Enable hugepage allocation for tmpfs mount if the allocation 917 will be fully within the i_size. This configuration also takes 918 into account any madvise(MADV_HUGEPAGE) hints that may be 919 provided by the applications. 920 921 config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ADVISE 922 bool "advise" 923 help 924 Enable hugepage allocation for the tmpfs mount exclusively when 925 applications supply the madvise(MADV_HUGEPAGE) hint. 926 This ensures that hugepages are used only in response to explicit 927 requests from applications. 928endchoice 929 930config THP_SWAP 931 def_bool y 932 depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT 933 help 934 Swap transparent huge pages in one piece, without splitting. 935 XXX: For now, swap cluster backing transparent huge page 936 will be split after swapout. 937 938 For selection by architectures with reasonable THP sizes. 939 940config READ_ONLY_THP_FOR_FS 941 bool "Read-only THP for filesystems (EXPERIMENTAL)" 942 depends on TRANSPARENT_HUGEPAGE 943 944 help 945 Allow khugepaged to put read-only file-backed pages in THP. 946 947 This is marked experimental because it is a new feature. Write 948 support of file THPs will be developed in the next few release 949 cycles. 950 951config NO_PAGE_MAPCOUNT 952 bool "No per-page mapcount (EXPERIMENTAL)" 953 help 954 Do not maintain per-page mapcounts for pages part of larger 955 allocations, such as transparent huge pages. 956 957 When this config option is enabled, some interfaces that relied on 958 this information will rely on less-precise per-allocation information 959 instead: for example, using the average per-page mapcount in such 960 a large allocation instead of the per-page mapcount. 961 962 EXPERIMENTAL because the impact of some changes is still unclear. 963 964endif # TRANSPARENT_HUGEPAGE 965 966# simple helper to make the code a bit easier to read 967config PAGE_MAPCOUNT 968 def_bool !NO_PAGE_MAPCOUNT 969 970# 971# The architecture supports pgtable leaves that is larger than PAGE_SIZE 972# 973config PGTABLE_HAS_HUGE_LEAVES 974 def_bool TRANSPARENT_HUGEPAGE || HUGETLB_PAGE 975 976# 977# We can end up creating gigantic folio. 978# 979config HAVE_GIGANTIC_FOLIOS 980 def_bool (HUGETLB_PAGE && ARCH_HAS_GIGANTIC_PAGE) || \ 981 (ZONE_DEVICE && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD) 982 983config ASYNC_KERNEL_PGTABLE_FREE 984 def_bool n 985 986# TODO: Allow to be enabled without THP 987config ARCH_SUPPORTS_HUGE_PFNMAP 988 def_bool n 989 depends on TRANSPARENT_HUGEPAGE 990 991config ARCH_SUPPORTS_PMD_PFNMAP 992 def_bool y 993 depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE 994 995config ARCH_SUPPORTS_PUD_PFNMAP 996 def_bool y 997 depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD 998 999# 1000# Architectures that always use weak definitions for percpu 1001# variables in modules should set this. 1002# 1003config ARCH_MODULE_NEEDS_WEAK_PER_CPU 1004 bool 1005 1006# 1007# UP and nommu archs use km based percpu allocator 1008# 1009config NEED_PER_CPU_KM 1010 depends on !SMP || !MMU 1011 bool 1012 default y 1013 1014config NEED_PER_CPU_EMBED_FIRST_CHUNK 1015 bool 1016 1017config NEED_PER_CPU_PAGE_FIRST_CHUNK 1018 bool 1019 1020config USE_PERCPU_NUMA_NODE_ID 1021 bool 1022 1023config HAVE_SETUP_PER_CPU_AREA 1024 bool 1025 1026config CMA 1027 bool "Contiguous Memory Allocator" 1028 depends on MMU 1029 select MIGRATION 1030 select MEMORY_ISOLATION 1031 help 1032 This enables the Contiguous Memory Allocator which allows other 1033 subsystems to allocate big physically-contiguous blocks of memory. 1034 CMA reserves a region of memory and allows only movable pages to 1035 be allocated from it. This way, the kernel can use the memory for 1036 pagecache and when a subsystem requests for contiguous area, the 1037 allocated pages are migrated away to serve the contiguous request. 1038 1039 If unsure, say "n". 1040 1041config CMA_DEBUGFS 1042 bool "CMA debugfs interface" 1043 depends on CMA && DEBUG_FS 1044 help 1045 Turns on the DebugFS interface for CMA. 1046 1047config CMA_SYSFS 1048 bool "CMA information through sysfs interface" 1049 depends on CMA && SYSFS 1050 help 1051 This option exposes some sysfs attributes to get information 1052 from CMA. 1053 1054config CMA_AREAS 1055 int "Maximum count of the CMA areas" 1056 depends on CMA 1057 default 20 if NUMA 1058 default 8 1059 help 1060 CMA allows to create CMA areas for particular purpose, mainly, 1061 used as device private area. This parameter sets the maximum 1062 number of CMA area in the system. 1063 1064 If unsure, leave the default value "8" in UMA and "20" in NUMA. 1065 1066# 1067# Select this config option from the architecture Kconfig, if available, to set 1068# the max page order for physically contiguous allocations. 1069# 1070config ARCH_FORCE_MAX_ORDER 1071 int 1072 1073# 1074# When ARCH_FORCE_MAX_ORDER is not defined, 1075# the default page block order is MAX_PAGE_ORDER (10) as per 1076# include/linux/mmzone.h. 1077# 1078config PAGE_BLOCK_MAX_ORDER 1079 int "Page Block Order Upper Limit" 1080 range 1 10 if ARCH_FORCE_MAX_ORDER = 0 1081 default 10 if ARCH_FORCE_MAX_ORDER = 0 1082 range 1 ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0 1083 default ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0 1084 help 1085 The page block order refers to the power of two number of pages that 1086 are physically contiguous and can have a migrate type associated to 1087 them. The maximum size of the page block order is at least limited by 1088 ARCH_FORCE_MAX_ORDER/MAX_PAGE_ORDER. 1089 1090 This config adds a new upper limit of default page block 1091 order when the page block order is required to be smaller than 1092 ARCH_FORCE_MAX_ORDER/MAX_PAGE_ORDER or other limits 1093 (see include/linux/pageblock-flags.h for details). 1094 1095 Reducing pageblock order can negatively impact THP generation 1096 success rate. If your workloads use THP heavily, please use this 1097 option with caution. 1098 1099 Don't change if unsure. 1100 1101config MEM_SOFT_DIRTY 1102 bool "Track memory changes" 1103 depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS 1104 select PROC_PAGE_MONITOR 1105 help 1106 This option enables memory changes tracking by introducing a 1107 soft-dirty bit on pte-s. This bit it set when someone writes 1108 into a page just as regular dirty bit, but unlike the latter 1109 it can be cleared by hands. 1110 1111 See Documentation/admin-guide/mm/soft-dirty.rst for more details. 1112 1113config GENERIC_EARLY_IOREMAP 1114 bool 1115 1116config STACK_MAX_DEFAULT_SIZE_MB 1117 int "Default maximum user stack size for 32-bit processes (MB)" 1118 default 100 1119 range 8 2048 1120 depends on STACK_GROWSUP && (!64BIT || COMPAT) 1121 help 1122 This is the maximum stack size in Megabytes in the VM layout of 32-bit 1123 user processes when the stack grows upwards (currently only on parisc 1124 arch) when the RLIMIT_STACK hard limit is unlimited. 1125 1126 A sane initial value is 100 MB. 1127 1128config DEFERRED_STRUCT_PAGE_INIT 1129 bool "Defer initialisation of struct pages to kthreads" 1130 depends on SPARSEMEM 1131 depends on !NEED_PER_CPU_KM 1132 depends on 64BIT 1133 depends on !KMSAN 1134 select PADATA 1135 help 1136 Ordinarily all struct pages are initialised during early boot in a 1137 single thread. On very large machines this can take a considerable 1138 amount of time. If this option is set, large machines will bring up 1139 a subset of memmap at boot and then initialise the rest in parallel. 1140 This has a potential performance impact on tasks running early in the 1141 lifetime of the system until these kthreads finish the 1142 initialisation. 1143 1144config PAGE_IDLE_FLAG 1145 bool 1146 select PAGE_EXTENSION if !64BIT 1147 help 1148 This adds PG_idle and PG_young flags to 'struct page'. PTE Accessed 1149 bit writers can set the state of the bit in the flags so that PTE 1150 Accessed bit readers may avoid disturbance. 1151 1152config IDLE_PAGE_TRACKING 1153 bool "Enable idle page tracking" 1154 depends on SYSFS && MMU 1155 select PAGE_IDLE_FLAG 1156 help 1157 This feature allows to estimate the amount of user pages that have 1158 not been touched during a given period of time. This information can 1159 be useful to tune memory cgroup limits and/or for job placement 1160 within a compute cluster. 1161 1162 See Documentation/admin-guide/mm/idle_page_tracking.rst for 1163 more details. 1164 1165# Architectures which implement cpu_dcache_is_aliasing() to query 1166# whether the data caches are aliased (VIVT or VIPT with dcache 1167# aliasing) need to select this. 1168config ARCH_HAS_CPU_CACHE_ALIASING 1169 bool 1170 1171config ARCH_HAS_CACHE_LINE_SIZE 1172 bool 1173 1174config ARCH_HAS_CURRENT_STACK_POINTER 1175 bool 1176 help 1177 In support of HARDENED_USERCOPY performing stack variable lifetime 1178 checking, an architecture-agnostic way to find the stack pointer 1179 is needed. Once an architecture defines an unsigned long global 1180 register alias named "current_stack_pointer", this config can be 1181 selected. 1182 1183config ARCH_HAS_ZONE_DMA_SET 1184 bool 1185 1186config ZONE_DMA 1187 bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET 1188 default y if ARM64 || X86 1189 1190config ZONE_DMA32 1191 bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET 1192 depends on !X86_32 1193 default y if ARM64 1194 1195config ZONE_DEVICE 1196 bool "Device memory (pmem, HMM, etc...) hotplug support" 1197 depends on MEMORY_HOTPLUG 1198 depends on MEMORY_HOTREMOVE 1199 depends on SPARSEMEM_VMEMMAP 1200 select XARRAY_MULTI 1201 1202 help 1203 Device memory hotplug support allows for establishing pmem, 1204 or other device driver discovered memory regions, in the 1205 memmap. This allows pfn_to_page() lookups of otherwise 1206 "device-physical" addresses which is needed for DAX, PCI_P2PDMA, and 1207 DEVICE_PRIVATE features among others. 1208 1209 Enabling this option will reduce the entropy of x86 KASLR memory 1210 regions. For example - on a 46 bit system, the entropy goes down 1211 from 16 bits to 15 bits. The actual reduction in entropy depends 1212 on the physical address bits, on processor features, kernel config 1213 (5 level page table) and physical memory present on the system. 1214 1215# 1216# Helpers to mirror range of the CPU page tables of a process into device page 1217# tables. 1218# 1219config HMM_MIRROR 1220 bool 1221 depends on MMU 1222 1223config GET_FREE_REGION 1224 bool 1225 1226config DEVICE_PRIVATE 1227 bool "Unaddressable device memory (GPU memory, ...)" 1228 depends on ZONE_DEVICE 1229 select GET_FREE_REGION 1230 1231 help 1232 Allows creation of struct pages to represent unaddressable device 1233 memory; i.e., memory that is only accessible from the device (or 1234 group of devices). You likely also want to select HMM_MIRROR. 1235 1236config VMAP_PFN 1237 bool 1238 1239config ARCH_USES_HIGH_VMA_FLAGS 1240 bool 1241config ARCH_HAS_PKEYS 1242 bool 1243 1244config ARCH_USES_PG_ARCH_2 1245 bool 1246config ARCH_USES_PG_ARCH_3 1247 bool 1248 1249config VM_EVENT_COUNTERS 1250 default y 1251 bool "Enable VM event counters for /proc/vmstat" if EXPERT 1252 help 1253 VM event counters are needed for event counts to be shown. 1254 This option allows the disabling of the VM event counters 1255 on EXPERT systems. /proc/vmstat will only show page counts 1256 if VM event counters are disabled. 1257 1258config PERCPU_STATS 1259 bool "Collect percpu memory statistics" 1260 help 1261 This feature collects and exposes statistics via debugfs. The 1262 information includes global and per chunk statistics, which can 1263 be used to help understand percpu memory usage. 1264 1265config GUP_TEST 1266 bool "Enable infrastructure for get_user_pages()-related unit tests" 1267 depends on DEBUG_FS 1268 help 1269 Provides /sys/kernel/debug/gup_test, which in turn provides a way 1270 to make ioctl calls that can launch kernel-based unit tests for 1271 the get_user_pages*() and pin_user_pages*() family of API calls. 1272 1273 These tests include benchmark testing of the _fast variants of 1274 get_user_pages*() and pin_user_pages*(), as well as smoke tests of 1275 the non-_fast variants. 1276 1277 There is also a sub-test that allows running dump_page() on any 1278 of up to eight pages (selected by command line args) within the 1279 range of user-space addresses. These pages are either pinned via 1280 pin_user_pages*(), or pinned via get_user_pages*(), as specified 1281 by other command line arguments. 1282 1283 See tools/testing/selftests/mm/gup_test.c 1284 1285comment "GUP_TEST needs to have DEBUG_FS enabled" 1286 depends on !GUP_TEST && !DEBUG_FS 1287 1288config GUP_GET_PXX_LOW_HIGH 1289 bool 1290 1291config DMAPOOL_TEST 1292 tristate "Enable a module to run time tests on dma_pool" 1293 depends on HAS_DMA 1294 help 1295 Provides a test module that will allocate and free many blocks of 1296 various sizes and report how long it takes. This is intended to 1297 provide a consistent way to measure how changes to the 1298 dma_pool_alloc/free routines affect performance. 1299 1300config ARCH_HAS_PTE_SPECIAL 1301 bool 1302 1303config MAPPING_DIRTY_HELPERS 1304 bool 1305 1306config KMAP_LOCAL 1307 bool 1308 1309config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY 1310 bool 1311 1312config MEMFD_CREATE 1313 bool "Enable memfd_create() system call" if EXPERT 1314 1315config SECRETMEM 1316 default y 1317 bool "Enable memfd_secret() system call" if EXPERT 1318 depends on ARCH_HAS_SET_DIRECT_MAP 1319 help 1320 Enable the memfd_secret() system call with the ability to create 1321 memory areas visible only in the context of the owning process and 1322 not mapped to other processes and other kernel page tables. 1323 1324config ANON_VMA_NAME 1325 bool "Anonymous VMA name support" 1326 depends on PROC_FS && ADVISE_SYSCALLS && MMU 1327 1328 help 1329 Allow naming anonymous virtual memory areas. 1330 1331 This feature allows assigning names to virtual memory areas. Assigned 1332 names can be later retrieved from /proc/pid/maps and /proc/pid/smaps 1333 and help identifying individual anonymous memory areas. 1334 Assigning a name to anonymous virtual memory area might prevent that 1335 area from being merged with adjacent virtual memory areas due to the 1336 difference in their name. 1337 1338config HAVE_ARCH_USERFAULTFD_WP 1339 bool 1340 help 1341 Arch has userfaultfd write protection support 1342 1343config HAVE_ARCH_USERFAULTFD_MINOR 1344 bool 1345 help 1346 Arch has userfaultfd minor fault support 1347 1348menuconfig USERFAULTFD 1349 bool "Enable userfaultfd() system call" 1350 depends on MMU 1351 help 1352 Enable the userfaultfd() system call that allows to intercept and 1353 handle page faults in userland. 1354 1355if USERFAULTFD 1356config PTE_MARKER_UFFD_WP 1357 bool "Userfaultfd write protection support for shmem/hugetlbfs" 1358 default y 1359 depends on HAVE_ARCH_USERFAULTFD_WP 1360 1361 help 1362 Allows to create marker PTEs for userfaultfd write protection 1363 purposes. It is required to enable userfaultfd write protection on 1364 file-backed memory types like shmem and hugetlbfs. 1365endif # USERFAULTFD 1366 1367# multi-gen LRU { 1368config LRU_GEN 1369 bool "Multi-Gen LRU" 1370 depends on MMU 1371 # make sure folio->flags has enough spare bits 1372 depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP 1373 help 1374 A high performance LRU implementation to overcommit memory. See 1375 Documentation/admin-guide/mm/multigen_lru.rst for details. 1376 1377config LRU_GEN_ENABLED 1378 bool "Enable by default" 1379 depends on LRU_GEN 1380 help 1381 This option enables the multi-gen LRU by default. 1382 1383config LRU_GEN_STATS 1384 bool "Full stats for debugging" 1385 depends on LRU_GEN 1386 help 1387 Do not enable this option unless you plan to look at historical stats 1388 from evicted generations for debugging purpose. 1389 1390 This option has a per-memcg and per-node memory overhead. 1391 1392config LRU_GEN_WALKS_MMU 1393 def_bool y 1394 depends on LRU_GEN && ARCH_HAS_HW_PTE_YOUNG 1395# } 1396 1397config ARCH_SUPPORTS_PER_VMA_LOCK 1398 def_bool n 1399 1400config PER_VMA_LOCK 1401 def_bool y 1402 depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP 1403 help 1404 Allow per-vma locking during page fault handling. 1405 1406 This feature allows locking each virtual memory area separately when 1407 handling page faults instead of taking mmap_lock. 1408 1409config LOCK_MM_AND_FIND_VMA 1410 bool 1411 depends on !STACK_GROWSUP 1412 1413config IOMMU_MM_DATA 1414 bool 1415 1416config EXECMEM 1417 bool 1418 1419config NUMA_MEMBLKS 1420 bool 1421 1422config NUMA_EMU 1423 bool "NUMA emulation" 1424 depends on NUMA_MEMBLKS 1425 depends on X86 || GENERIC_ARCH_NUMA 1426 help 1427 Enable NUMA emulation. A flat machine will be split 1428 into virtual nodes when booted with "numa=fake=N", where N is the 1429 number of nodes. This is only useful for debugging. 1430 1431config ARCH_HAS_USER_SHADOW_STACK 1432 bool 1433 help 1434 The architecture has hardware support for userspace shadow call 1435 stacks (eg, x86 CET, arm64 GCS or RISC-V Zicfiss). 1436 1437config HAVE_ARCH_TLB_REMOVE_TABLE 1438 def_bool n 1439 1440config PT_RECLAIM 1441 def_bool y 1442 depends on MMU_GATHER_RCU_TABLE_FREE && !HAVE_ARCH_TLB_REMOVE_TABLE 1443 help 1444 Try to reclaim empty user page table pages in paths other than munmap 1445 and exit_mmap path. 1446 1447 Note: now only empty user PTE page table pages will be reclaimed. 1448 1449config FIND_NORMAL_PAGE 1450 def_bool n 1451 1452config ARCH_HAS_LAZY_MMU_MODE 1453 bool 1454 help 1455 The architecture uses the lazy MMU mode. This allows changes to 1456 MMU-related architectural state to be deferred until the mode is 1457 exited. See <linux/pgtable.h> for details. 1458 1459config LAZY_MMU_MODE_KUNIT_TEST 1460 tristate "KUnit tests for the lazy MMU mode" if !KUNIT_ALL_TESTS 1461 depends on ARCH_HAS_LAZY_MMU_MODE 1462 depends on KUNIT 1463 default KUNIT_ALL_TESTS 1464 help 1465 Enable this option to check that the lazy MMU mode interface behaves 1466 as expected. Only tests for the generic interface are included (not 1467 architecture-specific behaviours). 1468 1469 If unsure, say N. 1470 1471source "mm/damon/Kconfig" 1472 1473endmenu 1474