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