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