| .. | .. |
|---|
| 1 | +# SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | |
|---|
| 2 | 3 | menu "Memory Management options" |
|---|
| 3 | 4 | |
|---|
| .. | .. |
|---|
| 11 | 12 | default DISCONTIGMEM_MANUAL if ARCH_DISCONTIGMEM_DEFAULT |
|---|
| 12 | 13 | default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT |
|---|
| 13 | 14 | default FLATMEM_MANUAL |
|---|
| 15 | + help |
|---|
| 16 | + This option allows you to change some of the ways that |
|---|
| 17 | + Linux manages its memory internally. Most users will |
|---|
| 18 | + only have one option here selected by the architecture |
|---|
| 19 | + configuration. This is normal. |
|---|
| 14 | 20 | |
|---|
| 15 | 21 | config FLATMEM_MANUAL |
|---|
| 16 | 22 | bool "Flat Memory" |
|---|
| 17 | 23 | depends on !(ARCH_DISCONTIGMEM_ENABLE || ARCH_SPARSEMEM_ENABLE) || ARCH_FLATMEM_ENABLE |
|---|
| 18 | 24 | help |
|---|
| 19 | | - This option allows you to change some of the ways that |
|---|
| 20 | | - Linux manages its memory internally. Most users will |
|---|
| 21 | | - only have one option here: FLATMEM. This is normal |
|---|
| 22 | | - and a correct option. |
|---|
| 25 | + This option is best suited for non-NUMA systems with |
|---|
| 26 | + flat address space. The FLATMEM is the most efficient |
|---|
| 27 | + system in terms of performance and resource consumption |
|---|
| 28 | + and it is the best option for smaller systems. |
|---|
| 23 | 29 | |
|---|
| 24 | | - Some users of more advanced features like NUMA and |
|---|
| 25 | | - memory hotplug may have different options here. |
|---|
| 26 | | - DISCONTIGMEM is a more mature, better tested system, |
|---|
| 27 | | - but is incompatible with memory hotplug and may suffer |
|---|
| 28 | | - decreased performance over SPARSEMEM. If unsure between |
|---|
| 29 | | - "Sparse Memory" and "Discontiguous Memory", choose |
|---|
| 30 | | - "Discontiguous Memory". |
|---|
| 30 | + For systems that have holes in their physical address |
|---|
| 31 | + spaces and for features like NUMA and memory hotplug, |
|---|
| 32 | + choose "Sparse Memory". |
|---|
| 31 | 33 | |
|---|
| 32 | 34 | If unsure, choose this option (Flat Memory) over any other. |
|---|
| 33 | 35 | |
|---|
| .. | .. |
|---|
| 38 | 40 | This option provides enhanced support for discontiguous |
|---|
| 39 | 41 | memory systems, over FLATMEM. These systems have holes |
|---|
| 40 | 42 | in their physical address spaces, and this option provides |
|---|
| 41 | | - more efficient handling of these holes. However, the vast |
|---|
| 42 | | - majority of hardware has quite flat address spaces, and |
|---|
| 43 | | - can have degraded performance from the extra overhead that |
|---|
| 44 | | - this option imposes. |
|---|
| 43 | + more efficient handling of these holes. |
|---|
| 45 | 44 | |
|---|
| 46 | | - Many NUMA configurations will have this as the only option. |
|---|
| 45 | + Although "Discontiguous Memory" is still used by several |
|---|
| 46 | + architectures, it is considered deprecated in favor of |
|---|
| 47 | + "Sparse Memory". |
|---|
| 47 | 48 | |
|---|
| 48 | | - If unsure, choose "Flat Memory" over this option. |
|---|
| 49 | + If unsure, choose "Sparse Memory" over this option. |
|---|
| 49 | 50 | |
|---|
| 50 | 51 | config SPARSEMEM_MANUAL |
|---|
| 51 | 52 | bool "Sparse Memory" |
|---|
| 52 | 53 | depends on ARCH_SPARSEMEM_ENABLE |
|---|
| 53 | 54 | help |
|---|
| 54 | 55 | This will be the only option for some systems, including |
|---|
| 55 | | - memory hotplug systems. This is normal. |
|---|
| 56 | + memory hot-plug systems. This is normal. |
|---|
| 56 | 57 | |
|---|
| 57 | | - For many other systems, this will be an alternative to |
|---|
| 58 | | - "Discontiguous Memory". This option provides some potential |
|---|
| 59 | | - performance benefits, along with decreased code complexity, |
|---|
| 60 | | - but it is newer, and more experimental. |
|---|
| 58 | + This option provides efficient support for systems with |
|---|
| 59 | + holes is their physical address space and allows memory |
|---|
| 60 | + hot-plug and hot-remove. |
|---|
| 61 | 61 | |
|---|
| 62 | | - If unsure, choose "Discontiguous Memory" or "Flat Memory" |
|---|
| 63 | | - over this option. |
|---|
| 62 | + If unsure, choose "Flat Memory" over this option. |
|---|
| 64 | 63 | |
|---|
| 65 | 64 | endchoice |
|---|
| 66 | 65 | |
|---|
| .. | .. |
|---|
| 89 | 88 | def_bool y |
|---|
| 90 | 89 | depends on DISCONTIGMEM || NUMA |
|---|
| 91 | 90 | |
|---|
| 92 | | -config HAVE_MEMORY_PRESENT |
|---|
| 93 | | - def_bool y |
|---|
| 94 | | - depends on ARCH_HAVE_MEMORY_PRESENT || SPARSEMEM |
|---|
| 95 | | - |
|---|
| 96 | 91 | # |
|---|
| 97 | 92 | # SPARSEMEM_EXTREME (which is the default) does some bootmem |
|---|
| 98 | | -# allocations when memory_present() is called. If this cannot |
|---|
| 93 | +# allocations when sparse_init() is called. If this cannot |
|---|
| 99 | 94 | # be done on your architecture, select this option. However, |
|---|
| 100 | 95 | # statically allocating the mem_section[] array can potentially |
|---|
| 101 | 96 | # consume vast quantities of .bss, so be careful. |
|---|
| .. | .. |
|---|
| 123 | 118 | depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE |
|---|
| 124 | 119 | default y |
|---|
| 125 | 120 | help |
|---|
| 126 | | - SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise |
|---|
| 127 | | - pfn_to_page and page_to_pfn operations. This is the most |
|---|
| 128 | | - efficient option when sufficient kernel resources are available. |
|---|
| 129 | | - |
|---|
| 130 | | -config HAVE_MEMBLOCK |
|---|
| 131 | | - bool |
|---|
| 132 | | - |
|---|
| 133 | | -config HAVE_MEMBLOCK_NODE_MAP |
|---|
| 134 | | - bool |
|---|
| 121 | + SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise |
|---|
| 122 | + pfn_to_page and page_to_pfn operations. This is the most |
|---|
| 123 | + efficient option when sufficient kernel resources are available. |
|---|
| 135 | 124 | |
|---|
| 136 | 125 | config HAVE_MEMBLOCK_PHYS_MAP |
|---|
| 137 | 126 | bool |
|---|
| 138 | 127 | |
|---|
| 139 | | -config HAVE_GENERIC_GUP |
|---|
| 128 | +config HAVE_FAST_GUP |
|---|
| 129 | + depends on MMU |
|---|
| 140 | 130 | bool |
|---|
| 141 | 131 | |
|---|
| 142 | | -config ARCH_DISCARD_MEMBLOCK |
|---|
| 132 | +# Don't discard allocated memory used to track "memory" and "reserved" memblocks |
|---|
| 133 | +# after early boot, so it can still be used to test for validity of memory. |
|---|
| 134 | +# Also, memblocks are updated with memory hot(un)plug. |
|---|
| 135 | +config ARCH_KEEP_MEMBLOCK |
|---|
| 143 | 136 | bool |
|---|
| 144 | 137 | |
|---|
| 145 | | -config NO_BOOTMEM |
|---|
| 138 | +# Keep arch NUMA mapping infrastructure post-init. |
|---|
| 139 | +config NUMA_KEEP_MEMINFO |
|---|
| 146 | 140 | bool |
|---|
| 147 | 141 | |
|---|
| 148 | 142 | config MEMORY_ISOLATION |
|---|
| .. | .. |
|---|
| 158 | 152 | # eventually, we can have this option just 'select SPARSEMEM' |
|---|
| 159 | 153 | config MEMORY_HOTPLUG |
|---|
| 160 | 154 | bool "Allow for memory hot-add" |
|---|
| 155 | + select MEMORY_ISOLATION |
|---|
| 161 | 156 | depends on SPARSEMEM || X86_64_ACPI_NUMA |
|---|
| 162 | 157 | depends on ARCH_ENABLE_MEMORY_HOTPLUG |
|---|
| 158 | + depends on 64BIT || BROKEN |
|---|
| 159 | + select NUMA_KEEP_MEMINFO if NUMA |
|---|
| 163 | 160 | |
|---|
| 164 | 161 | config MEMORY_HOTPLUG_SPARSE |
|---|
| 165 | 162 | def_bool y |
|---|
| 166 | 163 | depends on SPARSEMEM && MEMORY_HOTPLUG |
|---|
| 167 | 164 | |
|---|
| 168 | 165 | config MEMORY_HOTPLUG_DEFAULT_ONLINE |
|---|
| 169 | | - bool "Online the newly added memory blocks by default" |
|---|
| 170 | | - default n |
|---|
| 171 | | - depends on MEMORY_HOTPLUG |
|---|
| 172 | | - help |
|---|
| 166 | + bool "Online the newly added memory blocks by default" |
|---|
| 167 | + depends on MEMORY_HOTPLUG |
|---|
| 168 | + help |
|---|
| 173 | 169 | This option sets the default policy setting for memory hotplug |
|---|
| 174 | 170 | onlining policy (/sys/devices/system/memory/auto_online_blocks) which |
|---|
| 175 | 171 | determines what happens to newly added memory regions. Policy setting |
|---|
| 176 | 172 | can always be changed at runtime. |
|---|
| 177 | | - See Documentation/memory-hotplug.txt for more information. |
|---|
| 173 | + See Documentation/admin-guide/mm/memory-hotplug.rst for more information. |
|---|
| 178 | 174 | |
|---|
| 179 | 175 | Say Y here if you want all hot-plugged memory blocks to appear in |
|---|
| 180 | 176 | 'online' state by default. |
|---|
| .. | .. |
|---|
| 183 | 179 | |
|---|
| 184 | 180 | config MEMORY_HOTREMOVE |
|---|
| 185 | 181 | bool "Allow for memory hot remove" |
|---|
| 186 | | - select MEMORY_ISOLATION |
|---|
| 187 | 182 | select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64) |
|---|
| 188 | 183 | depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE |
|---|
| 189 | 184 | depends on MIGRATION |
|---|
| .. | .. |
|---|
| 194 | 189 | # Default to 4 for wider testing, though 8 might be more appropriate. |
|---|
| 195 | 190 | # ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock. |
|---|
| 196 | 191 | # PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes. |
|---|
| 192 | +# SPARC32 allocates multiple pte tables within a single page, and therefore |
|---|
| 193 | +# a per-page lock leads to problems when multiple tables need to be locked |
|---|
| 194 | +# at the same time (e.g. copy_page_range()). |
|---|
| 197 | 195 | # DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page. |
|---|
| 198 | 196 | # |
|---|
| 199 | 197 | config SPLIT_PTLOCK_CPUS |
|---|
| .. | .. |
|---|
| 201 | 199 | default "999999" if !MMU |
|---|
| 202 | 200 | default "999999" if ARM && !CPU_CACHE_VIPT |
|---|
| 203 | 201 | default "999999" if PARISC && !PA20 |
|---|
| 202 | + default "999999" if SPARC32 |
|---|
| 204 | 203 | default "4" |
|---|
| 205 | 204 | |
|---|
| 206 | 205 | config ARCH_ENABLE_SPLIT_PMD_PTLOCK |
|---|
| .. | .. |
|---|
| 234 | 233 | select MIGRATION |
|---|
| 235 | 234 | depends on MMU |
|---|
| 236 | 235 | help |
|---|
| 237 | | - Compaction is the only memory management component to form |
|---|
| 238 | | - high order (larger physically contiguous) memory blocks |
|---|
| 239 | | - reliably. The page allocator relies on compaction heavily and |
|---|
| 240 | | - the lack of the feature can lead to unexpected OOM killer |
|---|
| 241 | | - invocations for high order memory requests. You shouldn't |
|---|
| 242 | | - disable this option unless there really is a strong reason for |
|---|
| 243 | | - it and then we would be really interested to hear about that at |
|---|
| 244 | | - linux-mm@kvack.org. |
|---|
| 236 | + Compaction is the only memory management component to form |
|---|
| 237 | + high order (larger physically contiguous) memory blocks |
|---|
| 238 | + reliably. The page allocator relies on compaction heavily and |
|---|
| 239 | + the lack of the feature can lead to unexpected OOM killer |
|---|
| 240 | + invocations for high order memory requests. You shouldn't |
|---|
| 241 | + disable this option unless there really is a strong reason for |
|---|
| 242 | + it and then we would be really interested to hear about that at |
|---|
| 243 | + linux-mm@kvack.org. |
|---|
| 244 | + |
|---|
| 245 | +# |
|---|
| 246 | +# support for free page reporting |
|---|
| 247 | +config PAGE_REPORTING |
|---|
| 248 | + bool "Free page reporting" |
|---|
| 249 | + def_bool n |
|---|
| 250 | + help |
|---|
| 251 | + Free page reporting allows for the incremental acquisition of |
|---|
| 252 | + free pages from the buddy allocator for the purpose of reporting |
|---|
| 253 | + those pages to another entity, such as a hypervisor, so that the |
|---|
| 254 | + memory can be freed within the host for other uses. |
|---|
| 245 | 255 | |
|---|
| 246 | 256 | # |
|---|
| 247 | 257 | # support for page migration |
|---|
| .. | .. |
|---|
| 264 | 274 | config ARCH_ENABLE_THP_MIGRATION |
|---|
| 265 | 275 | bool |
|---|
| 266 | 276 | |
|---|
| 277 | +config CONTIG_ALLOC |
|---|
| 278 | + def_bool (MEMORY_ISOLATION && COMPACTION) || CMA |
|---|
| 279 | + |
|---|
| 267 | 280 | config PHYS_ADDR_T_64BIT |
|---|
| 268 | 281 | def_bool 64BIT |
|---|
| 269 | 282 | |
|---|
| .. | .. |
|---|
| 277 | 290 | by default when ZONE_DMA or HIGHMEM is selected, but you |
|---|
| 278 | 291 | may say n to override this. |
|---|
| 279 | 292 | |
|---|
| 280 | | -config NR_QUICK |
|---|
| 281 | | - int |
|---|
| 282 | | - depends on QUICKLIST |
|---|
| 283 | | - default "1" |
|---|
| 284 | | - |
|---|
| 285 | 293 | config VIRT_TO_BUS |
|---|
| 286 | 294 | bool |
|---|
| 287 | 295 | help |
|---|
| .. | .. |
|---|
| 293 | 301 | config MMU_NOTIFIER |
|---|
| 294 | 302 | bool |
|---|
| 295 | 303 | select SRCU |
|---|
| 304 | + select INTERVAL_TREE |
|---|
| 296 | 305 | |
|---|
| 297 | 306 | config KSM |
|---|
| 298 | 307 | bool "Enable KSM for page merging" |
|---|
| 299 | 308 | depends on MMU |
|---|
| 309 | + select XXHASH |
|---|
| 300 | 310 | help |
|---|
| 301 | 311 | Enable Kernel Samepage Merging: KSM periodically scans those areas |
|---|
| 302 | 312 | of an application's address space that an app has advised may be |
|---|
| .. | .. |
|---|
| 309 | 319 | root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set). |
|---|
| 310 | 320 | |
|---|
| 311 | 321 | config DEFAULT_MMAP_MIN_ADDR |
|---|
| 312 | | - int "Low address space to protect from user allocation" |
|---|
| 322 | + int "Low address space to protect from user allocation" |
|---|
| 313 | 323 | depends on MMU |
|---|
| 314 | | - default 4096 |
|---|
| 315 | | - help |
|---|
| 324 | + default 4096 |
|---|
| 325 | + help |
|---|
| 316 | 326 | This is the portion of low virtual memory which should be protected |
|---|
| 317 | 327 | from userspace allocation. Keeping a user from writing to low pages |
|---|
| 318 | 328 | can help reduce the impact of kernel NULL pointer bugs. |
|---|
| .. | .. |
|---|
| 373 | 383 | This option specifies the initial value of this option. The default |
|---|
| 374 | 384 | of 1 says that all excess pages should be trimmed. |
|---|
| 375 | 385 | |
|---|
| 376 | | - See Documentation/nommu-mmap.txt for more information. |
|---|
| 386 | + See Documentation/admin-guide/mm/nommu-mmap.rst for more information. |
|---|
| 377 | 387 | |
|---|
| 378 | 388 | config TRANSPARENT_HUGEPAGE |
|---|
| 379 | 389 | bool "Transparent Hugepage Support" |
|---|
| 380 | | - depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT_FULL |
|---|
| 390 | + depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE |
|---|
| 381 | 391 | select COMPACTION |
|---|
| 382 | | - select RADIX_TREE_MULTIORDER |
|---|
| 392 | + select XARRAY_MULTI |
|---|
| 383 | 393 | help |
|---|
| 384 | 394 | Transparent Hugepages allows the kernel to use huge pages and |
|---|
| 385 | 395 | huge tlb transparently to the applications whenever possible. |
|---|
| .. | .. |
|---|
| 415 | 425 | endchoice |
|---|
| 416 | 426 | |
|---|
| 417 | 427 | config ARCH_WANTS_THP_SWAP |
|---|
| 418 | | - def_bool n |
|---|
| 428 | + def_bool n |
|---|
| 419 | 429 | |
|---|
| 420 | 430 | config THP_SWAP |
|---|
| 421 | 431 | def_bool y |
|---|
| .. | .. |
|---|
| 427 | 437 | |
|---|
| 428 | 438 | For selection by architectures with reasonable THP sizes. |
|---|
| 429 | 439 | |
|---|
| 430 | | -config TRANSPARENT_HUGE_PAGECACHE |
|---|
| 431 | | - def_bool y |
|---|
| 432 | | - depends on TRANSPARENT_HUGEPAGE |
|---|
| 433 | | - |
|---|
| 434 | 440 | # |
|---|
| 435 | 441 | # UP and nommu archs use km based percpu allocator |
|---|
| 436 | 442 | # |
|---|
| .. | .. |
|---|
| 441 | 447 | |
|---|
| 442 | 448 | config CLEANCACHE |
|---|
| 443 | 449 | bool "Enable cleancache driver to cache clean pages if tmem is present" |
|---|
| 444 | | - default n |
|---|
| 445 | 450 | help |
|---|
| 446 | 451 | Cleancache can be thought of as a page-granularity victim cache |
|---|
| 447 | 452 | for clean pages that the kernel's pageframe replacement algorithm |
|---|
| .. | .. |
|---|
| 465 | 470 | config FRONTSWAP |
|---|
| 466 | 471 | bool "Enable frontswap to cache swap pages if tmem is present" |
|---|
| 467 | 472 | depends on SWAP |
|---|
| 468 | | - default n |
|---|
| 469 | 473 | help |
|---|
| 470 | 474 | Frontswap is so named because it can be thought of as the opposite |
|---|
| 471 | 475 | of a "backing" store for a swap device. The data is stored into |
|---|
| .. | .. |
|---|
| 481 | 485 | |
|---|
| 482 | 486 | config CMA |
|---|
| 483 | 487 | bool "Contiguous Memory Allocator" |
|---|
| 484 | | - depends on HAVE_MEMBLOCK && MMU |
|---|
| 488 | + depends on MMU |
|---|
| 485 | 489 | select MIGRATION |
|---|
| 486 | 490 | select MEMORY_ISOLATION |
|---|
| 487 | 491 | help |
|---|
| .. | .. |
|---|
| 491 | 495 | be allocated from it. This way, the kernel can use the memory for |
|---|
| 492 | 496 | pagecache and when a subsystem requests for contiguous area, the |
|---|
| 493 | 497 | allocated pages are migrated away to serve the contiguous request. |
|---|
| 498 | + |
|---|
| 499 | + If unsure, say "n". |
|---|
| 500 | + |
|---|
| 501 | +config CMA_INACTIVE |
|---|
| 502 | + bool "CMA not active to system" |
|---|
| 503 | + depends on CMA |
|---|
| 504 | + help |
|---|
| 505 | + This forbids the CMA to active its pages to system memory, to keep |
|---|
| 506 | + page from CMA never be borrowed by system. |
|---|
| 494 | 507 | |
|---|
| 495 | 508 | If unsure, say "n". |
|---|
| 496 | 509 | |
|---|
| .. | .. |
|---|
| 509 | 522 | help |
|---|
| 510 | 523 | Turns on the DebugFS interface for CMA. |
|---|
| 511 | 524 | |
|---|
| 525 | +config CMA_DEBUGFS_BITMAP_HEX |
|---|
| 526 | + bool "CMA debugfs add bitmap_hex node" |
|---|
| 527 | + depends on CMA_DEBUGFS |
|---|
| 528 | + help |
|---|
| 529 | + Turns on the bitmap_hex node under DEBUGFS, shows the bitmap in hex |
|---|
| 530 | + format. |
|---|
| 531 | + |
|---|
| 532 | +config CMA_SYSFS |
|---|
| 533 | + bool "CMA information through sysfs interface" |
|---|
| 534 | + depends on CMA && SYSFS |
|---|
| 535 | + help |
|---|
| 536 | + This option exposes some sysfs attributes to get information |
|---|
| 537 | + from CMA. |
|---|
| 538 | + |
|---|
| 512 | 539 | config CMA_AREAS |
|---|
| 513 | 540 | int "Maximum count of the CMA areas" |
|---|
| 514 | 541 | depends on CMA |
|---|
| 542 | + default 19 if NUMA |
|---|
| 515 | 543 | default 7 |
|---|
| 516 | 544 | help |
|---|
| 517 | 545 | CMA allows to create CMA areas for particular purpose, mainly, |
|---|
| 518 | 546 | used as device private area. This parameter sets the maximum |
|---|
| 519 | 547 | number of CMA area in the system. |
|---|
| 520 | 548 | |
|---|
| 521 | | - If unsure, leave the default value "7". |
|---|
| 549 | + If unsure, leave the default value "7" in UMA and "19" in NUMA. |
|---|
| 522 | 550 | |
|---|
| 523 | 551 | config MEM_SOFT_DIRTY |
|---|
| 524 | 552 | bool "Track memory changes" |
|---|
| .. | .. |
|---|
| 535 | 563 | config ZSWAP |
|---|
| 536 | 564 | bool "Compressed cache for swap pages (EXPERIMENTAL)" |
|---|
| 537 | 565 | depends on FRONTSWAP && CRYPTO=y |
|---|
| 538 | | - select CRYPTO_LZO |
|---|
| 539 | 566 | select ZPOOL |
|---|
| 540 | | - default n |
|---|
| 541 | 567 | help |
|---|
| 542 | 568 | A lightweight compressed cache for swap pages. It takes |
|---|
| 543 | 569 | pages that are in the process of being swapped out and attempts to |
|---|
| .. | .. |
|---|
| 552 | 578 | they have not be fully explored on the large set of potential |
|---|
| 553 | 579 | configurations and workloads that exist. |
|---|
| 554 | 580 | |
|---|
| 581 | +choice |
|---|
| 582 | + prompt "Compressed cache for swap pages default compressor" |
|---|
| 583 | + depends on ZSWAP |
|---|
| 584 | + default ZSWAP_COMPRESSOR_DEFAULT_LZO |
|---|
| 585 | + help |
|---|
| 586 | + Selects the default compression algorithm for the compressed cache |
|---|
| 587 | + for swap pages. |
|---|
| 588 | + |
|---|
| 589 | + For an overview what kind of performance can be expected from |
|---|
| 590 | + a particular compression algorithm please refer to the benchmarks |
|---|
| 591 | + available at the following LWN page: |
|---|
| 592 | + https://lwn.net/Articles/751795/ |
|---|
| 593 | + |
|---|
| 594 | + If in doubt, select 'LZO'. |
|---|
| 595 | + |
|---|
| 596 | + The selection made here can be overridden by using the kernel |
|---|
| 597 | + command line 'zswap.compressor=' option. |
|---|
| 598 | + |
|---|
| 599 | +config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE |
|---|
| 600 | + bool "Deflate" |
|---|
| 601 | + select CRYPTO_DEFLATE |
|---|
| 602 | + help |
|---|
| 603 | + Use the Deflate algorithm as the default compression algorithm. |
|---|
| 604 | + |
|---|
| 605 | +config ZSWAP_COMPRESSOR_DEFAULT_LZO |
|---|
| 606 | + bool "LZO" |
|---|
| 607 | + select CRYPTO_LZO |
|---|
| 608 | + help |
|---|
| 609 | + Use the LZO algorithm as the default compression algorithm. |
|---|
| 610 | + |
|---|
| 611 | +config ZSWAP_COMPRESSOR_DEFAULT_842 |
|---|
| 612 | + bool "842" |
|---|
| 613 | + select CRYPTO_842 |
|---|
| 614 | + help |
|---|
| 615 | + Use the 842 algorithm as the default compression algorithm. |
|---|
| 616 | + |
|---|
| 617 | +config ZSWAP_COMPRESSOR_DEFAULT_LZ4 |
|---|
| 618 | + bool "LZ4" |
|---|
| 619 | + select CRYPTO_LZ4 |
|---|
| 620 | + help |
|---|
| 621 | + Use the LZ4 algorithm as the default compression algorithm. |
|---|
| 622 | + |
|---|
| 623 | +config ZSWAP_COMPRESSOR_DEFAULT_LZ4HC |
|---|
| 624 | + bool "LZ4HC" |
|---|
| 625 | + select CRYPTO_LZ4HC |
|---|
| 626 | + help |
|---|
| 627 | + Use the LZ4HC algorithm as the default compression algorithm. |
|---|
| 628 | + |
|---|
| 629 | +config ZSWAP_COMPRESSOR_DEFAULT_ZSTD |
|---|
| 630 | + bool "zstd" |
|---|
| 631 | + select CRYPTO_ZSTD |
|---|
| 632 | + help |
|---|
| 633 | + Use the zstd algorithm as the default compression algorithm. |
|---|
| 634 | +endchoice |
|---|
| 635 | + |
|---|
| 636 | +config ZSWAP_COMPRESSOR_DEFAULT |
|---|
| 637 | + string |
|---|
| 638 | + depends on ZSWAP |
|---|
| 639 | + default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE |
|---|
| 640 | + default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO |
|---|
| 641 | + default "842" if ZSWAP_COMPRESSOR_DEFAULT_842 |
|---|
| 642 | + default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4 |
|---|
| 643 | + default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC |
|---|
| 644 | + default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD |
|---|
| 645 | + default "" |
|---|
| 646 | + |
|---|
| 647 | +choice |
|---|
| 648 | + prompt "Compressed cache for swap pages default allocator" |
|---|
| 649 | + depends on ZSWAP |
|---|
| 650 | + default ZSWAP_ZPOOL_DEFAULT_ZBUD |
|---|
| 651 | + help |
|---|
| 652 | + Selects the default allocator for the compressed cache for |
|---|
| 653 | + swap pages. |
|---|
| 654 | + The default is 'zbud' for compatibility, however please do |
|---|
| 655 | + read the description of each of the allocators below before |
|---|
| 656 | + making a right choice. |
|---|
| 657 | + |
|---|
| 658 | + The selection made here can be overridden by using the kernel |
|---|
| 659 | + command line 'zswap.zpool=' option. |
|---|
| 660 | + |
|---|
| 661 | +config ZSWAP_ZPOOL_DEFAULT_ZBUD |
|---|
| 662 | + bool "zbud" |
|---|
| 663 | + select ZBUD |
|---|
| 664 | + help |
|---|
| 665 | + Use the zbud allocator as the default allocator. |
|---|
| 666 | + |
|---|
| 667 | +config ZSWAP_ZPOOL_DEFAULT_Z3FOLD |
|---|
| 668 | + bool "z3fold" |
|---|
| 669 | + select Z3FOLD |
|---|
| 670 | + help |
|---|
| 671 | + Use the z3fold allocator as the default allocator. |
|---|
| 672 | + |
|---|
| 673 | +config ZSWAP_ZPOOL_DEFAULT_ZSMALLOC |
|---|
| 674 | + bool "zsmalloc" |
|---|
| 675 | + select ZSMALLOC |
|---|
| 676 | + help |
|---|
| 677 | + Use the zsmalloc allocator as the default allocator. |
|---|
| 678 | +endchoice |
|---|
| 679 | + |
|---|
| 680 | +config ZSWAP_ZPOOL_DEFAULT |
|---|
| 681 | + string |
|---|
| 682 | + depends on ZSWAP |
|---|
| 683 | + default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD |
|---|
| 684 | + default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD |
|---|
| 685 | + default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC |
|---|
| 686 | + default "" |
|---|
| 687 | + |
|---|
| 688 | +config ZSWAP_DEFAULT_ON |
|---|
| 689 | + bool "Enable the compressed cache for swap pages by default" |
|---|
| 690 | + depends on ZSWAP |
|---|
| 691 | + help |
|---|
| 692 | + If selected, the compressed cache for swap pages will be enabled |
|---|
| 693 | + at boot, otherwise it will be disabled. |
|---|
| 694 | + |
|---|
| 695 | + The selection made here can be overridden by using the kernel |
|---|
| 696 | + command line 'zswap.enabled=' option. |
|---|
| 697 | + |
|---|
| 555 | 698 | config ZPOOL |
|---|
| 556 | 699 | tristate "Common API for compressed memory storage" |
|---|
| 557 | | - default n |
|---|
| 558 | 700 | help |
|---|
| 559 | 701 | Compressed memory storage API. This allows using either zbud or |
|---|
| 560 | 702 | zsmalloc. |
|---|
| 561 | 703 | |
|---|
| 562 | 704 | config ZBUD |
|---|
| 563 | 705 | tristate "Low (Up to 2x) density storage for compressed pages" |
|---|
| 564 | | - default n |
|---|
| 565 | 706 | help |
|---|
| 566 | 707 | A special purpose allocator for storing compressed pages. |
|---|
| 567 | 708 | It is designed to store up to two compressed pages per physical |
|---|
| .. | .. |
|---|
| 572 | 713 | config Z3FOLD |
|---|
| 573 | 714 | tristate "Up to 3x density storage for compressed pages" |
|---|
| 574 | 715 | depends on ZPOOL |
|---|
| 575 | | - default n |
|---|
| 576 | 716 | help |
|---|
| 577 | 717 | A special purpose allocator for storing compressed pages. |
|---|
| 578 | 718 | It is designed to store up to three compressed pages per physical |
|---|
| .. | .. |
|---|
| 582 | 722 | config ZSMALLOC |
|---|
| 583 | 723 | tristate "Memory allocator for compressed pages" |
|---|
| 584 | 724 | depends on MMU |
|---|
| 585 | | - default n |
|---|
| 586 | 725 | help |
|---|
| 587 | 726 | zsmalloc is a slab-based memory allocator designed to store |
|---|
| 588 | 727 | compressed RAM pages. zsmalloc uses virtual memory mapping |
|---|
| .. | .. |
|---|
| 590 | 729 | non-standard allocator interface where a handle, not a pointer, is |
|---|
| 591 | 730 | returned by an alloc(). This handle must be mapped in order to |
|---|
| 592 | 731 | access the allocated space. |
|---|
| 593 | | - |
|---|
| 594 | | -config PGTABLE_MAPPING |
|---|
| 595 | | - bool "Use page table mapping to access object in zsmalloc" |
|---|
| 596 | | - depends on ZSMALLOC |
|---|
| 597 | | - help |
|---|
| 598 | | - By default, zsmalloc uses a copy-based object mapping method to |
|---|
| 599 | | - access allocations that span two pages. However, if a particular |
|---|
| 600 | | - architecture (ex, ARM) performs VM mapping faster than copying, |
|---|
| 601 | | - then you should select this. This causes zsmalloc to use page table |
|---|
| 602 | | - mapping rather than copying for object mapping. |
|---|
| 603 | | - |
|---|
| 604 | | - You can check speed with zsmalloc benchmark: |
|---|
| 605 | | - https://github.com/spartacus06/zsmapbench |
|---|
| 606 | 732 | |
|---|
| 607 | 733 | config ZSMALLOC_STAT |
|---|
| 608 | 734 | bool "Export zsmalloc statistics" |
|---|
| .. | .. |
|---|
| 613 | 739 | statistics about whats happening in zsmalloc and exports that |
|---|
| 614 | 740 | information to userspace via debugfs. |
|---|
| 615 | 741 | If unsure, say N. |
|---|
| 616 | | - |
|---|
| 617 | | -config MM_EVENT_STAT |
|---|
| 618 | | - bool "Track per-process MM event" |
|---|
| 619 | | - depends on MMU |
|---|
| 620 | | - help |
|---|
| 621 | | - This option enables per-process mm event stat(e.g., fault, reclaim, |
|---|
| 622 | | - compaction and so on ) with some interval(Default is 0.5sec). |
|---|
| 623 | | - Admin can see the stat from trace file via debugfs(e.g., |
|---|
| 624 | | - /sys/kernel/debug/tracing/trace) |
|---|
| 625 | | - |
|---|
| 626 | | - It includes max/average memory allocation latency for the interval |
|---|
| 627 | | - as well as event count so that admin can see what happens in VM side |
|---|
| 628 | | - (how many each event happens and how much processes spent time for |
|---|
| 629 | | - the MM event). If it's too large, that would be not good situation. |
|---|
| 630 | | - |
|---|
| 631 | | - System can dump the trace into bugreport when user allows the dump. |
|---|
| 632 | 742 | |
|---|
| 633 | 743 | config GENERIC_EARLY_IOREMAP |
|---|
| 634 | 744 | bool |
|---|
| .. | .. |
|---|
| 649 | 759 | |
|---|
| 650 | 760 | config DEFERRED_STRUCT_PAGE_INIT |
|---|
| 651 | 761 | bool "Defer initialisation of struct pages to kthreads" |
|---|
| 652 | | - default n |
|---|
| 653 | | - depends on NO_BOOTMEM |
|---|
| 654 | 762 | depends on SPARSEMEM |
|---|
| 655 | 763 | depends on !NEED_PER_CPU_KM |
|---|
| 656 | 764 | depends on 64BIT |
|---|
| 765 | + select PADATA |
|---|
| 657 | 766 | help |
|---|
| 658 | 767 | Ordinarily all struct pages are initialised during early boot in a |
|---|
| 659 | 768 | single thread. On very large machines this can take a considerable |
|---|
| 660 | 769 | amount of time. If this option is set, large machines will bring up |
|---|
| 661 | | - a subset of memmap at boot and then initialise the rest in parallel |
|---|
| 662 | | - by starting one-off "pgdatinitX" kernel thread for each node X. This |
|---|
| 663 | | - has a potential performance impact on processes running early in the |
|---|
| 770 | + a subset of memmap at boot and then initialise the rest in parallel. |
|---|
| 771 | + This has a potential performance impact on tasks running early in the |
|---|
| 664 | 772 | lifetime of the system until these kthreads finish the |
|---|
| 665 | 773 | initialisation. |
|---|
| 774 | + |
|---|
| 775 | +config PAGE_IDLE_FLAG |
|---|
| 776 | + bool |
|---|
| 777 | + select PAGE_EXTENSION if !64BIT |
|---|
| 778 | + help |
|---|
| 779 | + This adds PG_idle and PG_young flags to 'struct page'. PTE Accessed |
|---|
| 780 | + bit writers can set the state of the bit in the flags so that PTE |
|---|
| 781 | + Accessed bit readers may avoid disturbance. |
|---|
| 666 | 782 | |
|---|
| 667 | 783 | config IDLE_PAGE_TRACKING |
|---|
| 668 | 784 | bool "Enable idle page tracking" |
|---|
| 669 | 785 | depends on SYSFS && MMU |
|---|
| 670 | | - select PAGE_EXTENSION if !64BIT |
|---|
| 786 | + select PAGE_IDLE_FLAG |
|---|
| 671 | 787 | help |
|---|
| 672 | 788 | This feature allows to estimate the amount of user pages that have |
|---|
| 673 | 789 | not been touched during a given period of time. This information can |
|---|
| .. | .. |
|---|
| 677 | 793 | See Documentation/admin-guide/mm/idle_page_tracking.rst for |
|---|
| 678 | 794 | more details. |
|---|
| 679 | 795 | |
|---|
| 680 | | -# arch_add_memory() comprehends device memory |
|---|
| 681 | | -config ARCH_HAS_ZONE_DEVICE |
|---|
| 796 | +config ARCH_HAS_PTE_DEVMAP |
|---|
| 682 | 797 | bool |
|---|
| 683 | 798 | |
|---|
| 684 | 799 | config ZONE_DEVICE |
|---|
| .. | .. |
|---|
| 686 | 801 | depends on MEMORY_HOTPLUG |
|---|
| 687 | 802 | depends on MEMORY_HOTREMOVE |
|---|
| 688 | 803 | depends on SPARSEMEM_VMEMMAP |
|---|
| 689 | | - depends on ARCH_HAS_ZONE_DEVICE |
|---|
| 690 | | - select RADIX_TREE_MULTIORDER |
|---|
| 804 | + depends on ARCH_HAS_PTE_DEVMAP |
|---|
| 805 | + select XARRAY_MULTI |
|---|
| 691 | 806 | |
|---|
| 692 | 807 | help |
|---|
| 693 | 808 | Device memory hotplug support allows for establishing pmem, |
|---|
| .. | .. |
|---|
| 698 | 813 | |
|---|
| 699 | 814 | If FS_DAX is enabled, then say Y. |
|---|
| 700 | 815 | |
|---|
| 701 | | -config ARCH_HAS_HMM |
|---|
| 702 | | - bool |
|---|
| 703 | | - default y |
|---|
| 704 | | - depends on (X86_64 || PPC64) |
|---|
| 705 | | - depends on ZONE_DEVICE |
|---|
| 706 | | - depends on MMU && 64BIT |
|---|
| 707 | | - depends on MEMORY_HOTPLUG |
|---|
| 708 | | - depends on MEMORY_HOTREMOVE |
|---|
| 709 | | - depends on SPARSEMEM_VMEMMAP |
|---|
| 710 | | - |
|---|
| 711 | | -config MIGRATE_VMA_HELPER |
|---|
| 712 | | - bool |
|---|
| 713 | | - |
|---|
| 714 | 816 | config DEV_PAGEMAP_OPS |
|---|
| 715 | 817 | bool |
|---|
| 716 | 818 | |
|---|
| 717 | | -config HMM |
|---|
| 718 | | - bool |
|---|
| 719 | | - select MMU_NOTIFIER |
|---|
| 720 | | - select MIGRATE_VMA_HELPER |
|---|
| 721 | | - |
|---|
| 819 | +# |
|---|
| 820 | +# Helpers to mirror range of the CPU page tables of a process into device page |
|---|
| 821 | +# tables. |
|---|
| 822 | +# |
|---|
| 722 | 823 | config HMM_MIRROR |
|---|
| 723 | | - bool "HMM mirror CPU page table into a device page table" |
|---|
| 724 | | - depends on ARCH_HAS_HMM |
|---|
| 725 | | - select HMM |
|---|
| 726 | | - help |
|---|
| 727 | | - Select HMM_MIRROR if you want to mirror range of the CPU page table of a |
|---|
| 728 | | - process into a device page table. Here, mirror means "keep synchronized". |
|---|
| 729 | | - Prerequisites: the device must provide the ability to write-protect its |
|---|
| 730 | | - page tables (at PAGE_SIZE granularity), and must be able to recover from |
|---|
| 731 | | - the resulting potential page faults. |
|---|
| 824 | + bool |
|---|
| 825 | + depends on MMU |
|---|
| 732 | 826 | |
|---|
| 733 | 827 | config DEVICE_PRIVATE |
|---|
| 734 | 828 | bool "Unaddressable device memory (GPU memory, ...)" |
|---|
| 735 | | - depends on ARCH_HAS_HMM |
|---|
| 736 | | - select HMM |
|---|
| 829 | + depends on ZONE_DEVICE |
|---|
| 737 | 830 | select DEV_PAGEMAP_OPS |
|---|
| 738 | 831 | |
|---|
| 739 | 832 | help |
|---|
| .. | .. |
|---|
| 741 | 834 | memory; i.e., memory that is only accessible from the device (or |
|---|
| 742 | 835 | group of devices). You likely also want to select HMM_MIRROR. |
|---|
| 743 | 836 | |
|---|
| 744 | | -config DEVICE_PUBLIC |
|---|
| 745 | | - bool "Addressable device memory (like GPU memory)" |
|---|
| 746 | | - depends on ARCH_HAS_HMM |
|---|
| 747 | | - select HMM |
|---|
| 748 | | - select DEV_PAGEMAP_OPS |
|---|
| 749 | | - |
|---|
| 750 | | - help |
|---|
| 751 | | - Allows creation of struct pages to represent addressable device |
|---|
| 752 | | - memory; i.e., memory that is accessible from both the device and |
|---|
| 753 | | - the CPU |
|---|
| 837 | +config VMAP_PFN |
|---|
| 838 | + bool |
|---|
| 754 | 839 | |
|---|
| 755 | 840 | config FRAME_VECTOR |
|---|
| 756 | 841 | bool |
|---|
| .. | .. |
|---|
| 762 | 847 | |
|---|
| 763 | 848 | config PERCPU_STATS |
|---|
| 764 | 849 | bool "Collect percpu memory statistics" |
|---|
| 765 | | - default n |
|---|
| 766 | 850 | help |
|---|
| 767 | 851 | This feature collects and exposes statistics via debugfs. The |
|---|
| 768 | 852 | information includes global and per chunk statistics, which can |
|---|
| 769 | 853 | be used to help understand percpu memory usage. |
|---|
| 770 | 854 | |
|---|
| 855 | +config ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT |
|---|
| 856 | + def_bool n |
|---|
| 857 | + |
|---|
| 858 | +config SPECULATIVE_PAGE_FAULT |
|---|
| 859 | + bool "Speculative page faults" |
|---|
| 860 | + default y |
|---|
| 861 | + depends on ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT |
|---|
| 862 | + depends on MMU && SMP && !NUMA |
|---|
| 863 | + help |
|---|
| 864 | + Try to handle user space page faults without holding the mmap_sem. |
|---|
| 865 | + |
|---|
| 866 | + This should allow better concurrency for massively threaded process |
|---|
| 867 | + since the page fault handler will not wait for other threads memory |
|---|
| 868 | + layout change to be done, assuming that this change is done in another |
|---|
| 869 | + part of the process's memory space. This type of page fault is named |
|---|
| 870 | + speculative page fault. |
|---|
| 871 | + |
|---|
| 872 | + If the speculative page fault fails because of a concurrency is |
|---|
| 873 | + detected or because underlying PMD or PTE tables are not yet |
|---|
| 874 | + allocating, it is failing its processing and a classic page fault |
|---|
| 875 | + is then tried. |
|---|
| 876 | + |
|---|
| 771 | 877 | config GUP_BENCHMARK |
|---|
| 772 | | - bool "Enable infrastructure for get_user_pages_fast() benchmarking" |
|---|
| 773 | | - default n |
|---|
| 878 | + bool "Enable infrastructure for get_user_pages() and related calls benchmarking" |
|---|
| 774 | 879 | help |
|---|
| 775 | 880 | Provides /sys/kernel/debug/gup_benchmark that helps with testing |
|---|
| 776 | | - performance of get_user_pages_fast(). |
|---|
| 881 | + performance of get_user_pages() and related calls. |
|---|
| 777 | 882 | |
|---|
| 778 | 883 | See tools/testing/selftests/vm/gup_benchmark.c |
|---|
| 779 | 884 | |
|---|
| 885 | +config GUP_GET_PTE_LOW_HIGH |
|---|
| 886 | + bool |
|---|
| 887 | + |
|---|
| 888 | +config READ_ONLY_THP_FOR_FS |
|---|
| 889 | + bool "Read-only THP for filesystems (EXPERIMENTAL)" |
|---|
| 890 | + depends on TRANSPARENT_HUGEPAGE && SHMEM |
|---|
| 891 | + |
|---|
| 892 | + help |
|---|
| 893 | + Allow khugepaged to put read-only file-backed pages in THP. |
|---|
| 894 | + |
|---|
| 895 | + This is marked experimental because it is a new feature. Write |
|---|
| 896 | + support of file THPs will be developed in the next few release |
|---|
| 897 | + cycles. |
|---|
| 898 | + |
|---|
| 780 | 899 | config ARCH_HAS_PTE_SPECIAL |
|---|
| 781 | 900 | bool |
|---|
| 782 | 901 | |
|---|
| 902 | +# |
|---|
| 903 | +# Some architectures require a special hugepage directory format that is |
|---|
| 904 | +# required to support multiple hugepage sizes. For example a4fe3ce76 |
|---|
| 905 | +# "powerpc/mm: Allow more flexible layouts for hugepage pagetables" |
|---|
| 906 | +# introduced it on powerpc. This allows for a more flexible hugepage |
|---|
| 907 | +# pagetable layouts. |
|---|
| 908 | +# |
|---|
| 909 | +config ARCH_HAS_HUGEPD |
|---|
| 910 | + bool |
|---|
| 911 | + |
|---|
| 912 | +config MAPPING_DIRTY_HELPERS |
|---|
| 913 | + bool |
|---|
| 914 | + |
|---|
| 915 | +source "mm/damon/Kconfig" |
|---|
| 916 | + |
|---|
| 783 | 917 | endmenu |
|---|