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