0001 # SPDX-License-Identifier: GPL-2.0-only
0002
0003 menu "Memory Management options"
0004
0005 #
0006 # For some reason microblaze and nios2 hard code SWAP=n. Hopefully we can
0007 # add proper SWAP support to them, in which case this can be remove.
0008 #
0009 config ARCH_NO_SWAP
0010 bool
0011
0012 config ZPOOL
0013 bool
0014
0015 menuconfig SWAP
0016 bool "Support for paging of anonymous memory (swap)"
0017 depends on MMU && BLOCK && !ARCH_NO_SWAP
0018 default y
0019 help
0020 This option allows you to choose whether you want to have support
0021 for so called swap devices or swap files in your kernel that are
0022 used to provide more virtual memory than the actual RAM present
0023 in your computer. If unsure say Y.
0024
0025 config ZSWAP
0026 bool "Compressed cache for swap pages (EXPERIMENTAL)"
0027 depends on SWAP
0028 select FRONTSWAP
0029 select CRYPTO
0030 select ZPOOL
0031 help
0032 A lightweight compressed cache for swap pages. It takes
0033 pages that are in the process of being swapped out and attempts to
0034 compress them into a dynamically allocated RAM-based memory pool.
0035 This can result in a significant I/O reduction on swap device and,
0036 in the case where decompressing from RAM is faster than swap device
0037 reads, can also improve workload performance.
0038
0039 This is marked experimental because it is a new feature (as of
0040 v3.11) that interacts heavily with memory reclaim. While these
0041 interactions don't cause any known issues on simple memory setups,
0042 they have not be fully explored on the large set of potential
0043 configurations and workloads that exist.
0044
0045 config ZSWAP_DEFAULT_ON
0046 bool "Enable the compressed cache for swap pages by default"
0047 depends on ZSWAP
0048 help
0049 If selected, the compressed cache for swap pages will be enabled
0050 at boot, otherwise it will be disabled.
0051
0052 The selection made here can be overridden by using the kernel
0053 command line 'zswap.enabled=' option.
0054
0055 choice
0056 prompt "Default compressor"
0057 depends on ZSWAP
0058 default ZSWAP_COMPRESSOR_DEFAULT_LZO
0059 help
0060 Selects the default compression algorithm for the compressed cache
0061 for swap pages.
0062
0063 For an overview what kind of performance can be expected from
0064 a particular compression algorithm please refer to the benchmarks
0065 available at the following LWN page:
0066 https://lwn.net/Articles/751795/
0067
0068 If in doubt, select 'LZO'.
0069
0070 The selection made here can be overridden by using the kernel
0071 command line 'zswap.compressor=' option.
0072
0073 config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
0074 bool "Deflate"
0075 select CRYPTO_DEFLATE
0076 help
0077 Use the Deflate algorithm as the default compression algorithm.
0078
0079 config ZSWAP_COMPRESSOR_DEFAULT_LZO
0080 bool "LZO"
0081 select CRYPTO_LZO
0082 help
0083 Use the LZO algorithm as the default compression algorithm.
0084
0085 config ZSWAP_COMPRESSOR_DEFAULT_842
0086 bool "842"
0087 select CRYPTO_842
0088 help
0089 Use the 842 algorithm as the default compression algorithm.
0090
0091 config ZSWAP_COMPRESSOR_DEFAULT_LZ4
0092 bool "LZ4"
0093 select CRYPTO_LZ4
0094 help
0095 Use the LZ4 algorithm as the default compression algorithm.
0096
0097 config ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
0098 bool "LZ4HC"
0099 select CRYPTO_LZ4HC
0100 help
0101 Use the LZ4HC algorithm as the default compression algorithm.
0102
0103 config ZSWAP_COMPRESSOR_DEFAULT_ZSTD
0104 bool "zstd"
0105 select CRYPTO_ZSTD
0106 help
0107 Use the zstd algorithm as the default compression algorithm.
0108 endchoice
0109
0110 config ZSWAP_COMPRESSOR_DEFAULT
0111 string
0112 depends on ZSWAP
0113 default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
0114 default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
0115 default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
0116 default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
0117 default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
0118 default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
0119 default ""
0120
0121 choice
0122 prompt "Default allocator"
0123 depends on ZSWAP
0124 default ZSWAP_ZPOOL_DEFAULT_ZBUD
0125 help
0126 Selects the default allocator for the compressed cache for
0127 swap pages.
0128 The default is 'zbud' for compatibility, however please do
0129 read the description of each of the allocators below before
0130 making a right choice.
0131
0132 The selection made here can be overridden by using the kernel
0133 command line 'zswap.zpool=' option.
0134
0135 config ZSWAP_ZPOOL_DEFAULT_ZBUD
0136 bool "zbud"
0137 select ZBUD
0138 help
0139 Use the zbud allocator as the default allocator.
0140
0141 config ZSWAP_ZPOOL_DEFAULT_Z3FOLD
0142 bool "z3fold"
0143 select Z3FOLD
0144 help
0145 Use the z3fold allocator as the default allocator.
0146
0147 config ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
0148 bool "zsmalloc"
0149 select ZSMALLOC
0150 help
0151 Use the zsmalloc allocator as the default allocator.
0152 endchoice
0153
0154 config ZSWAP_ZPOOL_DEFAULT
0155 string
0156 depends on ZSWAP
0157 default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD
0158 default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD
0159 default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
0160 default ""
0161
0162 config ZBUD
0163 tristate "2:1 compression allocator (zbud)"
0164 depends on ZSWAP
0165 help
0166 A special purpose allocator for storing compressed pages.
0167 It is designed to store up to two compressed pages per physical
0168 page. While this design limits storage density, it has simple and
0169 deterministic reclaim properties that make it preferable to a higher
0170 density approach when reclaim will be used.
0171
0172 config Z3FOLD
0173 tristate "3:1 compression allocator (z3fold)"
0174 depends on ZSWAP
0175 help
0176 A special purpose allocator for storing compressed pages.
0177 It is designed to store up to three compressed pages per physical
0178 page. It is a ZBUD derivative so the simplicity and determinism are
0179 still there.
0180
0181 config ZSMALLOC
0182 tristate
0183 prompt "N:1 compression allocator (zsmalloc)" if ZSWAP
0184 depends on MMU
0185 help
0186 zsmalloc is a slab-based memory allocator designed to store
0187 pages of various compression levels efficiently. It achieves
0188 the highest storage density with the least amount of fragmentation.
0189
0190 config ZSMALLOC_STAT
0191 bool "Export zsmalloc statistics"
0192 depends on ZSMALLOC
0193 select DEBUG_FS
0194 help
0195 This option enables code in the zsmalloc to collect various
0196 statistics about what's happening in zsmalloc and exports that
0197 information to userspace via debugfs.
0198 If unsure, say N.
0199
0200 menu "SLAB allocator options"
0201
0202 choice
0203 prompt "Choose SLAB allocator"
0204 default SLUB
0205 help
0206 This option allows to select a slab allocator.
0207
0208 config SLAB
0209 bool "SLAB"
0210 depends on !PREEMPT_RT
0211 select HAVE_HARDENED_USERCOPY_ALLOCATOR
0212 help
0213 The regular slab allocator that is established and known to work
0214 well in all environments. It organizes cache hot objects in
0215 per cpu and per node queues.
0216
0217 config SLUB
0218 bool "SLUB (Unqueued Allocator)"
0219 select HAVE_HARDENED_USERCOPY_ALLOCATOR
0220 help
0221 SLUB is a slab allocator that minimizes cache line usage
0222 instead of managing queues of cached objects (SLAB approach).
0223 Per cpu caching is realized using slabs of objects instead
0224 of queues of objects. SLUB can use memory efficiently
0225 and has enhanced diagnostics. SLUB is the default choice for
0226 a slab allocator.
0227
0228 config SLOB
0229 depends on EXPERT
0230 bool "SLOB (Simple Allocator)"
0231 depends on !PREEMPT_RT
0232 help
0233 SLOB replaces the stock allocator with a drastically simpler
0234 allocator. SLOB is generally more space efficient but
0235 does not perform as well on large systems.
0236
0237 endchoice
0238
0239 config SLAB_MERGE_DEFAULT
0240 bool "Allow slab caches to be merged"
0241 default y
0242 depends on SLAB || SLUB
0243 help
0244 For reduced kernel memory fragmentation, slab caches can be
0245 merged when they share the same size and other characteristics.
0246 This carries a risk of kernel heap overflows being able to
0247 overwrite objects from merged caches (and more easily control
0248 cache layout), which makes such heap attacks easier to exploit
0249 by attackers. By keeping caches unmerged, these kinds of exploits
0250 can usually only damage objects in the same cache. To disable
0251 merging at runtime, "slab_nomerge" can be passed on the kernel
0252 command line.
0253
0254 config SLAB_FREELIST_RANDOM
0255 bool "Randomize slab freelist"
0256 depends on SLAB || SLUB
0257 help
0258 Randomizes the freelist order used on creating new pages. This
0259 security feature reduces the predictability of the kernel slab
0260 allocator against heap overflows.
0261
0262 config SLAB_FREELIST_HARDENED
0263 bool "Harden slab freelist metadata"
0264 depends on SLAB || SLUB
0265 help
0266 Many kernel heap attacks try to target slab cache metadata and
0267 other infrastructure. This options makes minor performance
0268 sacrifices to harden the kernel slab allocator against common
0269 freelist exploit methods. Some slab implementations have more
0270 sanity-checking than others. This option is most effective with
0271 CONFIG_SLUB.
0272
0273 config SLUB_STATS
0274 default n
0275 bool "Enable SLUB performance statistics"
0276 depends on SLUB && SYSFS
0277 help
0278 SLUB statistics are useful to debug SLUBs allocation behavior in
0279 order find ways to optimize the allocator. This should never be
0280 enabled for production use since keeping statistics slows down
0281 the allocator by a few percentage points. The slabinfo command
0282 supports the determination of the most active slabs to figure
0283 out which slabs are relevant to a particular load.
0284 Try running: slabinfo -DA
0285
0286 config SLUB_CPU_PARTIAL
0287 default y
0288 depends on SLUB && SMP
0289 bool "SLUB per cpu partial cache"
0290 help
0291 Per cpu partial caches accelerate objects allocation and freeing
0292 that is local to a processor at the price of more indeterminism
0293 in the latency of the free. On overflow these caches will be cleared
0294 which requires the taking of locks that may cause latency spikes.
0295 Typically one would choose no for a realtime system.
0296
0297 endmenu # SLAB allocator options
0298
0299 config SHUFFLE_PAGE_ALLOCATOR
0300 bool "Page allocator randomization"
0301 default SLAB_FREELIST_RANDOM && ACPI_NUMA
0302 help
0303 Randomization of the page allocator improves the average
0304 utilization of a direct-mapped memory-side-cache. See section
0305 5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
0306 6.2a specification for an example of how a platform advertises
0307 the presence of a memory-side-cache. There are also incidental
0308 security benefits as it reduces the predictability of page
0309 allocations to compliment SLAB_FREELIST_RANDOM, but the
0310 default granularity of shuffling on the "MAX_ORDER - 1" i.e,
0311 10th order of pages is selected based on cache utilization
0312 benefits on x86.
0313
0314 While the randomization improves cache utilization it may
0315 negatively impact workloads on platforms without a cache. For
0316 this reason, by default, the randomization is enabled only
0317 after runtime detection of a direct-mapped memory-side-cache.
0318 Otherwise, the randomization may be force enabled with the
0319 'page_alloc.shuffle' kernel command line parameter.
0320
0321 Say Y if unsure.
0322
0323 config COMPAT_BRK
0324 bool "Disable heap randomization"
0325 default y
0326 help
0327 Randomizing heap placement makes heap exploits harder, but it
0328 also breaks ancient binaries (including anything libc5 based).
0329 This option changes the bootup default to heap randomization
0330 disabled, and can be overridden at runtime by setting
0331 /proc/sys/kernel/randomize_va_space to 2.
0332
0333 On non-ancient distros (post-2000 ones) N is usually a safe choice.
0334
0335 config MMAP_ALLOW_UNINITIALIZED
0336 bool "Allow mmapped anonymous memory to be uninitialized"
0337 depends on EXPERT && !MMU
0338 default n
0339 help
0340 Normally, and according to the Linux spec, anonymous memory obtained
0341 from mmap() has its contents cleared before it is passed to
0342 userspace. Enabling this config option allows you to request that
0343 mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
0344 providing a huge performance boost. If this option is not enabled,
0345 then the flag will be ignored.
0346
0347 This is taken advantage of by uClibc's malloc(), and also by
0348 ELF-FDPIC binfmt's brk and stack allocator.
0349
0350 Because of the obvious security issues, this option should only be
0351 enabled on embedded devices where you control what is run in
0352 userspace. Since that isn't generally a problem on no-MMU systems,
0353 it is normally safe to say Y here.
0354
0355 See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
0356
0357 config SELECT_MEMORY_MODEL
0358 def_bool y
0359 depends on ARCH_SELECT_MEMORY_MODEL
0360
0361 choice
0362 prompt "Memory model"
0363 depends on SELECT_MEMORY_MODEL
0364 default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
0365 default FLATMEM_MANUAL
0366 help
0367 This option allows you to change some of the ways that
0368 Linux manages its memory internally. Most users will
0369 only have one option here selected by the architecture
0370 configuration. This is normal.
0371
0372 config FLATMEM_MANUAL
0373 bool "Flat Memory"
0374 depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
0375 help
0376 This option is best suited for non-NUMA systems with
0377 flat address space. The FLATMEM is the most efficient
0378 system in terms of performance and resource consumption
0379 and it is the best option for smaller systems.
0380
0381 For systems that have holes in their physical address
0382 spaces and for features like NUMA and memory hotplug,
0383 choose "Sparse Memory".
0384
0385 If unsure, choose this option (Flat Memory) over any other.
0386
0387 config SPARSEMEM_MANUAL
0388 bool "Sparse Memory"
0389 depends on ARCH_SPARSEMEM_ENABLE
0390 help
0391 This will be the only option for some systems, including
0392 memory hot-plug systems. This is normal.
0393
0394 This option provides efficient support for systems with
0395 holes is their physical address space and allows memory
0396 hot-plug and hot-remove.
0397
0398 If unsure, choose "Flat Memory" over this option.
0399
0400 endchoice
0401
0402 config SPARSEMEM
0403 def_bool y
0404 depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
0405
0406 config FLATMEM
0407 def_bool y
0408 depends on !SPARSEMEM || FLATMEM_MANUAL
0409
0410 #
0411 # SPARSEMEM_EXTREME (which is the default) does some bootmem
0412 # allocations when sparse_init() is called. If this cannot
0413 # be done on your architecture, select this option. However,
0414 # statically allocating the mem_section[] array can potentially
0415 # consume vast quantities of .bss, so be careful.
0416 #
0417 # This option will also potentially produce smaller runtime code
0418 # with gcc 3.4 and later.
0419 #
0420 config SPARSEMEM_STATIC
0421 bool
0422
0423 #
0424 # Architecture platforms which require a two level mem_section in SPARSEMEM
0425 # must select this option. This is usually for architecture platforms with
0426 # an extremely sparse physical address space.
0427 #
0428 config SPARSEMEM_EXTREME
0429 def_bool y
0430 depends on SPARSEMEM && !SPARSEMEM_STATIC
0431
0432 config SPARSEMEM_VMEMMAP_ENABLE
0433 bool
0434
0435 config SPARSEMEM_VMEMMAP
0436 bool "Sparse Memory virtual memmap"
0437 depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
0438 default y
0439 help
0440 SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
0441 pfn_to_page and page_to_pfn operations. This is the most
0442 efficient option when sufficient kernel resources are available.
0443
0444 config HAVE_MEMBLOCK_PHYS_MAP
0445 bool
0446
0447 config HAVE_FAST_GUP
0448 depends on MMU
0449 bool
0450
0451 # Don't discard allocated memory used to track "memory" and "reserved" memblocks
0452 # after early boot, so it can still be used to test for validity of memory.
0453 # Also, memblocks are updated with memory hot(un)plug.
0454 config ARCH_KEEP_MEMBLOCK
0455 bool
0456
0457 # Keep arch NUMA mapping infrastructure post-init.
0458 config NUMA_KEEP_MEMINFO
0459 bool
0460
0461 config MEMORY_ISOLATION
0462 bool
0463
0464 # IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked
0465 # IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via
0466 # /dev/mem.
0467 config EXCLUSIVE_SYSTEM_RAM
0468 def_bool y
0469 depends on !DEVMEM || STRICT_DEVMEM
0470
0471 #
0472 # Only be set on architectures that have completely implemented memory hotplug
0473 # feature. If you are not sure, don't touch it.
0474 #
0475 config HAVE_BOOTMEM_INFO_NODE
0476 def_bool n
0477
0478 config ARCH_ENABLE_MEMORY_HOTPLUG
0479 bool
0480
0481 config ARCH_ENABLE_MEMORY_HOTREMOVE
0482 bool
0483
0484 # eventually, we can have this option just 'select SPARSEMEM'
0485 menuconfig MEMORY_HOTPLUG
0486 bool "Memory hotplug"
0487 select MEMORY_ISOLATION
0488 depends on SPARSEMEM
0489 depends on ARCH_ENABLE_MEMORY_HOTPLUG
0490 depends on 64BIT
0491 select NUMA_KEEP_MEMINFO if NUMA
0492
0493 if MEMORY_HOTPLUG
0494
0495 config MEMORY_HOTPLUG_DEFAULT_ONLINE
0496 bool "Online the newly added memory blocks by default"
0497 depends on MEMORY_HOTPLUG
0498 help
0499 This option sets the default policy setting for memory hotplug
0500 onlining policy (/sys/devices/system/memory/auto_online_blocks) which
0501 determines what happens to newly added memory regions. Policy setting
0502 can always be changed at runtime.
0503 See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
0504
0505 Say Y here if you want all hot-plugged memory blocks to appear in
0506 'online' state by default.
0507 Say N here if you want the default policy to keep all hot-plugged
0508 memory blocks in 'offline' state.
0509
0510 config MEMORY_HOTREMOVE
0511 bool "Allow for memory hot remove"
0512 select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
0513 depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
0514 depends on MIGRATION
0515
0516 config MHP_MEMMAP_ON_MEMORY
0517 def_bool y
0518 depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
0519 depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
0520
0521 endif # MEMORY_HOTPLUG
0522
0523 # Heavily threaded applications may benefit from splitting the mm-wide
0524 # page_table_lock, so that faults on different parts of the user address
0525 # space can be handled with less contention: split it at this NR_CPUS.
0526 # Default to 4 for wider testing, though 8 might be more appropriate.
0527 # ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
0528 # PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
0529 # SPARC32 allocates multiple pte tables within a single page, and therefore
0530 # a per-page lock leads to problems when multiple tables need to be locked
0531 # at the same time (e.g. copy_page_range()).
0532 # DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
0533 #
0534 config SPLIT_PTLOCK_CPUS
0535 int
0536 default "999999" if !MMU
0537 default "999999" if ARM && !CPU_CACHE_VIPT
0538 default "999999" if PARISC && !PA20
0539 default "999999" if SPARC32
0540 default "4"
0541
0542 config ARCH_ENABLE_SPLIT_PMD_PTLOCK
0543 bool
0544
0545 #
0546 # support for memory balloon
0547 config MEMORY_BALLOON
0548 bool
0549
0550 #
0551 # support for memory balloon compaction
0552 config BALLOON_COMPACTION
0553 bool "Allow for balloon memory compaction/migration"
0554 def_bool y
0555 depends on COMPACTION && MEMORY_BALLOON
0556 help
0557 Memory fragmentation introduced by ballooning might reduce
0558 significantly the number of 2MB contiguous memory blocks that can be
0559 used within a guest, thus imposing performance penalties associated
0560 with the reduced number of transparent huge pages that could be used
0561 by the guest workload. Allowing the compaction & migration for memory
0562 pages enlisted as being part of memory balloon devices avoids the
0563 scenario aforementioned and helps improving memory defragmentation.
0564
0565 #
0566 # support for memory compaction
0567 config COMPACTION
0568 bool "Allow for memory compaction"
0569 def_bool y
0570 select MIGRATION
0571 depends on MMU
0572 help
0573 Compaction is the only memory management component to form
0574 high order (larger physically contiguous) memory blocks
0575 reliably. The page allocator relies on compaction heavily and
0576 the lack of the feature can lead to unexpected OOM killer
0577 invocations for high order memory requests. You shouldn't
0578 disable this option unless there really is a strong reason for
0579 it and then we would be really interested to hear about that at
0580 linux-mm@kvack.org.
0581
0582 #
0583 # support for free page reporting
0584 config PAGE_REPORTING
0585 bool "Free page reporting"
0586 def_bool n
0587 help
0588 Free page reporting allows for the incremental acquisition of
0589 free pages from the buddy allocator for the purpose of reporting
0590 those pages to another entity, such as a hypervisor, so that the
0591 memory can be freed within the host for other uses.
0592
0593 #
0594 # support for page migration
0595 #
0596 config MIGRATION
0597 bool "Page migration"
0598 def_bool y
0599 depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
0600 help
0601 Allows the migration of the physical location of pages of processes
0602 while the virtual addresses are not changed. This is useful in
0603 two situations. The first is on NUMA systems to put pages nearer
0604 to the processors accessing. The second is when allocating huge
0605 pages as migration can relocate pages to satisfy a huge page
0606 allocation instead of reclaiming.
0607
0608 config DEVICE_MIGRATION
0609 def_bool MIGRATION && ZONE_DEVICE
0610
0611 config ARCH_ENABLE_HUGEPAGE_MIGRATION
0612 bool
0613
0614 config ARCH_ENABLE_THP_MIGRATION
0615 bool
0616
0617 config HUGETLB_PAGE_SIZE_VARIABLE
0618 def_bool n
0619 help
0620 Allows the pageblock_order value to be dynamic instead of just standard
0621 HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
0622 on a platform.
0623
0624 Note that the pageblock_order cannot exceed MAX_ORDER - 1 and will be
0625 clamped down to MAX_ORDER - 1.
0626
0627 config CONTIG_ALLOC
0628 def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
0629
0630 config PHYS_ADDR_T_64BIT
0631 def_bool 64BIT
0632
0633 config BOUNCE
0634 bool "Enable bounce buffers"
0635 default y
0636 depends on BLOCK && MMU && HIGHMEM
0637 help
0638 Enable bounce buffers for devices that cannot access the full range of
0639 memory available to the CPU. Enabled by default when HIGHMEM is
0640 selected, but you may say n to override this.
0641
0642 config MMU_NOTIFIER
0643 bool
0644 select SRCU
0645 select INTERVAL_TREE
0646
0647 config KSM
0648 bool "Enable KSM for page merging"
0649 depends on MMU
0650 select XXHASH
0651 help
0652 Enable Kernel Samepage Merging: KSM periodically scans those areas
0653 of an application's address space that an app has advised may be
0654 mergeable. When it finds pages of identical content, it replaces
0655 the many instances by a single page with that content, so
0656 saving memory until one or another app needs to modify the content.
0657 Recommended for use with KVM, or with other duplicative applications.
0658 See Documentation/mm/ksm.rst for more information: KSM is inactive
0659 until a program has madvised that an area is MADV_MERGEABLE, and
0660 root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
0661
0662 config DEFAULT_MMAP_MIN_ADDR
0663 int "Low address space to protect from user allocation"
0664 depends on MMU
0665 default 4096
0666 help
0667 This is the portion of low virtual memory which should be protected
0668 from userspace allocation. Keeping a user from writing to low pages
0669 can help reduce the impact of kernel NULL pointer bugs.
0670
0671 For most ia64, ppc64 and x86 users with lots of address space
0672 a value of 65536 is reasonable and should cause no problems.
0673 On arm and other archs it should not be higher than 32768.
0674 Programs which use vm86 functionality or have some need to map
0675 this low address space will need CAP_SYS_RAWIO or disable this
0676 protection by setting the value to 0.
0677
0678 This value can be changed after boot using the
0679 /proc/sys/vm/mmap_min_addr tunable.
0680
0681 config ARCH_SUPPORTS_MEMORY_FAILURE
0682 bool
0683
0684 config MEMORY_FAILURE
0685 depends on MMU
0686 depends on ARCH_SUPPORTS_MEMORY_FAILURE
0687 bool "Enable recovery from hardware memory errors"
0688 select MEMORY_ISOLATION
0689 select RAS
0690 help
0691 Enables code to recover from some memory failures on systems
0692 with MCA recovery. This allows a system to continue running
0693 even when some of its memory has uncorrected errors. This requires
0694 special hardware support and typically ECC memory.
0695
0696 config HWPOISON_INJECT
0697 tristate "HWPoison pages injector"
0698 depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
0699 select PROC_PAGE_MONITOR
0700
0701 config NOMMU_INITIAL_TRIM_EXCESS
0702 int "Turn on mmap() excess space trimming before booting"
0703 depends on !MMU
0704 default 1
0705 help
0706 The NOMMU mmap() frequently needs to allocate large contiguous chunks
0707 of memory on which to store mappings, but it can only ask the system
0708 allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
0709 more than it requires. To deal with this, mmap() is able to trim off
0710 the excess and return it to the allocator.
0711
0712 If trimming is enabled, the excess is trimmed off and returned to the
0713 system allocator, which can cause extra fragmentation, particularly
0714 if there are a lot of transient processes.
0715
0716 If trimming is disabled, the excess is kept, but not used, which for
0717 long-term mappings means that the space is wasted.
0718
0719 Trimming can be dynamically controlled through a sysctl option
0720 (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
0721 excess pages there must be before trimming should occur, or zero if
0722 no trimming is to occur.
0723
0724 This option specifies the initial value of this option. The default
0725 of 1 says that all excess pages should be trimmed.
0726
0727 See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
0728
0729 config ARCH_WANT_GENERAL_HUGETLB
0730 bool
0731
0732 config ARCH_WANTS_THP_SWAP
0733 def_bool n
0734
0735 menuconfig TRANSPARENT_HUGEPAGE
0736 bool "Transparent Hugepage Support"
0737 depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
0738 select COMPACTION
0739 select XARRAY_MULTI
0740 help
0741 Transparent Hugepages allows the kernel to use huge pages and
0742 huge tlb transparently to the applications whenever possible.
0743 This feature can improve computing performance to certain
0744 applications by speeding up page faults during memory
0745 allocation, by reducing the number of tlb misses and by speeding
0746 up the pagetable walking.
0747
0748 If memory constrained on embedded, you may want to say N.
0749
0750 if TRANSPARENT_HUGEPAGE
0751
0752 choice
0753 prompt "Transparent Hugepage Support sysfs defaults"
0754 depends on TRANSPARENT_HUGEPAGE
0755 default TRANSPARENT_HUGEPAGE_ALWAYS
0756 help
0757 Selects the sysfs defaults for Transparent Hugepage Support.
0758
0759 config TRANSPARENT_HUGEPAGE_ALWAYS
0760 bool "always"
0761 help
0762 Enabling Transparent Hugepage always, can increase the
0763 memory footprint of applications without a guaranteed
0764 benefit but it will work automatically for all applications.
0765
0766 config TRANSPARENT_HUGEPAGE_MADVISE
0767 bool "madvise"
0768 help
0769 Enabling Transparent Hugepage madvise, will only provide a
0770 performance improvement benefit to the applications using
0771 madvise(MADV_HUGEPAGE) but it won't risk to increase the
0772 memory footprint of applications without a guaranteed
0773 benefit.
0774 endchoice
0775
0776 config THP_SWAP
0777 def_bool y
0778 depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP
0779 help
0780 Swap transparent huge pages in one piece, without splitting.
0781 XXX: For now, swap cluster backing transparent huge page
0782 will be split after swapout.
0783
0784 For selection by architectures with reasonable THP sizes.
0785
0786 config READ_ONLY_THP_FOR_FS
0787 bool "Read-only THP for filesystems (EXPERIMENTAL)"
0788 depends on TRANSPARENT_HUGEPAGE && SHMEM
0789
0790 help
0791 Allow khugepaged to put read-only file-backed pages in THP.
0792
0793 This is marked experimental because it is a new feature. Write
0794 support of file THPs will be developed in the next few release
0795 cycles.
0796
0797 endif # TRANSPARENT_HUGEPAGE
0798
0799 #
0800 # UP and nommu archs use km based percpu allocator
0801 #
0802 config NEED_PER_CPU_KM
0803 depends on !SMP || !MMU
0804 bool
0805 default y
0806
0807 config NEED_PER_CPU_EMBED_FIRST_CHUNK
0808 bool
0809
0810 config NEED_PER_CPU_PAGE_FIRST_CHUNK
0811 bool
0812
0813 config USE_PERCPU_NUMA_NODE_ID
0814 bool
0815
0816 config HAVE_SETUP_PER_CPU_AREA
0817 bool
0818
0819 config FRONTSWAP
0820 bool
0821
0822 config CMA
0823 bool "Contiguous Memory Allocator"
0824 depends on MMU
0825 select MIGRATION
0826 select MEMORY_ISOLATION
0827 help
0828 This enables the Contiguous Memory Allocator which allows other
0829 subsystems to allocate big physically-contiguous blocks of memory.
0830 CMA reserves a region of memory and allows only movable pages to
0831 be allocated from it. This way, the kernel can use the memory for
0832 pagecache and when a subsystem requests for contiguous area, the
0833 allocated pages are migrated away to serve the contiguous request.
0834
0835 If unsure, say "n".
0836
0837 config CMA_DEBUG
0838 bool "CMA debug messages (DEVELOPMENT)"
0839 depends on DEBUG_KERNEL && CMA
0840 help
0841 Turns on debug messages in CMA. This produces KERN_DEBUG
0842 messages for every CMA call as well as various messages while
0843 processing calls such as dma_alloc_from_contiguous().
0844 This option does not affect warning and error messages.
0845
0846 config CMA_DEBUGFS
0847 bool "CMA debugfs interface"
0848 depends on CMA && DEBUG_FS
0849 help
0850 Turns on the DebugFS interface for CMA.
0851
0852 config CMA_SYSFS
0853 bool "CMA information through sysfs interface"
0854 depends on CMA && SYSFS
0855 help
0856 This option exposes some sysfs attributes to get information
0857 from CMA.
0858
0859 config CMA_AREAS
0860 int "Maximum count of the CMA areas"
0861 depends on CMA
0862 default 19 if NUMA
0863 default 7
0864 help
0865 CMA allows to create CMA areas for particular purpose, mainly,
0866 used as device private area. This parameter sets the maximum
0867 number of CMA area in the system.
0868
0869 If unsure, leave the default value "7" in UMA and "19" in NUMA.
0870
0871 config MEM_SOFT_DIRTY
0872 bool "Track memory changes"
0873 depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
0874 select PROC_PAGE_MONITOR
0875 help
0876 This option enables memory changes tracking by introducing a
0877 soft-dirty bit on pte-s. This bit it set when someone writes
0878 into a page just as regular dirty bit, but unlike the latter
0879 it can be cleared by hands.
0880
0881 See Documentation/admin-guide/mm/soft-dirty.rst for more details.
0882
0883 config GENERIC_EARLY_IOREMAP
0884 bool
0885
0886 config STACK_MAX_DEFAULT_SIZE_MB
0887 int "Default maximum user stack size for 32-bit processes (MB)"
0888 default 100
0889 range 8 2048
0890 depends on STACK_GROWSUP && (!64BIT || COMPAT)
0891 help
0892 This is the maximum stack size in Megabytes in the VM layout of 32-bit
0893 user processes when the stack grows upwards (currently only on parisc
0894 arch) when the RLIMIT_STACK hard limit is unlimited.
0895
0896 A sane initial value is 100 MB.
0897
0898 config DEFERRED_STRUCT_PAGE_INIT
0899 bool "Defer initialisation of struct pages to kthreads"
0900 depends on SPARSEMEM
0901 depends on !NEED_PER_CPU_KM
0902 depends on 64BIT
0903 select PADATA
0904 help
0905 Ordinarily all struct pages are initialised during early boot in a
0906 single thread. On very large machines this can take a considerable
0907 amount of time. If this option is set, large machines will bring up
0908 a subset of memmap at boot and then initialise the rest in parallel.
0909 This has a potential performance impact on tasks running early in the
0910 lifetime of the system until these kthreads finish the
0911 initialisation.
0912
0913 config PAGE_IDLE_FLAG
0914 bool
0915 select PAGE_EXTENSION if !64BIT
0916 help
0917 This adds PG_idle and PG_young flags to 'struct page'. PTE Accessed
0918 bit writers can set the state of the bit in the flags so that PTE
0919 Accessed bit readers may avoid disturbance.
0920
0921 config IDLE_PAGE_TRACKING
0922 bool "Enable idle page tracking"
0923 depends on SYSFS && MMU
0924 select PAGE_IDLE_FLAG
0925 help
0926 This feature allows to estimate the amount of user pages that have
0927 not been touched during a given period of time. This information can
0928 be useful to tune memory cgroup limits and/or for job placement
0929 within a compute cluster.
0930
0931 See Documentation/admin-guide/mm/idle_page_tracking.rst for
0932 more details.
0933
0934 config ARCH_HAS_CACHE_LINE_SIZE
0935 bool
0936
0937 config ARCH_HAS_CURRENT_STACK_POINTER
0938 bool
0939 help
0940 In support of HARDENED_USERCOPY performing stack variable lifetime
0941 checking, an architecture-agnostic way to find the stack pointer
0942 is needed. Once an architecture defines an unsigned long global
0943 register alias named "current_stack_pointer", this config can be
0944 selected.
0945
0946 config ARCH_HAS_PTE_DEVMAP
0947 bool
0948
0949 config ARCH_HAS_ZONE_DMA_SET
0950 bool
0951
0952 config ZONE_DMA
0953 bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
0954 default y if ARM64 || X86
0955
0956 config ZONE_DMA32
0957 bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
0958 depends on !X86_32
0959 default y if ARM64
0960
0961 config ZONE_DEVICE
0962 bool "Device memory (pmem, HMM, etc...) hotplug support"
0963 depends on MEMORY_HOTPLUG
0964 depends on MEMORY_HOTREMOVE
0965 depends on SPARSEMEM_VMEMMAP
0966 depends on ARCH_HAS_PTE_DEVMAP
0967 select XARRAY_MULTI
0968
0969 help
0970 Device memory hotplug support allows for establishing pmem,
0971 or other device driver discovered memory regions, in the
0972 memmap. This allows pfn_to_page() lookups of otherwise
0973 "device-physical" addresses which is needed for using a DAX
0974 mapping in an O_DIRECT operation, among other things.
0975
0976 If FS_DAX is enabled, then say Y.
0977
0978 #
0979 # Helpers to mirror range of the CPU page tables of a process into device page
0980 # tables.
0981 #
0982 config HMM_MIRROR
0983 bool
0984 depends on MMU
0985
0986 config GET_FREE_REGION
0987 depends on SPARSEMEM
0988 bool
0989
0990 config DEVICE_PRIVATE
0991 bool "Unaddressable device memory (GPU memory, ...)"
0992 depends on ZONE_DEVICE
0993 select GET_FREE_REGION
0994
0995 help
0996 Allows creation of struct pages to represent unaddressable device
0997 memory; i.e., memory that is only accessible from the device (or
0998 group of devices). You likely also want to select HMM_MIRROR.
0999
1000 config VMAP_PFN
1001 bool
1002
1003 config ARCH_USES_HIGH_VMA_FLAGS
1004 bool
1005 config ARCH_HAS_PKEYS
1006 bool
1007
1008 config VM_EVENT_COUNTERS
1009 default y
1010 bool "Enable VM event counters for /proc/vmstat" if EXPERT
1011 help
1012 VM event counters are needed for event counts to be shown.
1013 This option allows the disabling of the VM event counters
1014 on EXPERT systems. /proc/vmstat will only show page counts
1015 if VM event counters are disabled.
1016
1017 config PERCPU_STATS
1018 bool "Collect percpu memory statistics"
1019 help
1020 This feature collects and exposes statistics via debugfs. The
1021 information includes global and per chunk statistics, which can
1022 be used to help understand percpu memory usage.
1023
1024 config GUP_TEST
1025 bool "Enable infrastructure for get_user_pages()-related unit tests"
1026 depends on DEBUG_FS
1027 help
1028 Provides /sys/kernel/debug/gup_test, which in turn provides a way
1029 to make ioctl calls that can launch kernel-based unit tests for
1030 the get_user_pages*() and pin_user_pages*() family of API calls.
1031
1032 These tests include benchmark testing of the _fast variants of
1033 get_user_pages*() and pin_user_pages*(), as well as smoke tests of
1034 the non-_fast variants.
1035
1036 There is also a sub-test that allows running dump_page() on any
1037 of up to eight pages (selected by command line args) within the
1038 range of user-space addresses. These pages are either pinned via
1039 pin_user_pages*(), or pinned via get_user_pages*(), as specified
1040 by other command line arguments.
1041
1042 See tools/testing/selftests/vm/gup_test.c
1043
1044 comment "GUP_TEST needs to have DEBUG_FS enabled"
1045 depends on !GUP_TEST && !DEBUG_FS
1046
1047 config GUP_GET_PTE_LOW_HIGH
1048 bool
1049
1050 config ARCH_HAS_PTE_SPECIAL
1051 bool
1052
1053 #
1054 # Some architectures require a special hugepage directory format that is
1055 # required to support multiple hugepage sizes. For example a4fe3ce76
1056 # "powerpc/mm: Allow more flexible layouts for hugepage pagetables"
1057 # introduced it on powerpc. This allows for a more flexible hugepage
1058 # pagetable layouts.
1059 #
1060 config ARCH_HAS_HUGEPD
1061 bool
1062
1063 config MAPPING_DIRTY_HELPERS
1064 bool
1065
1066 config KMAP_LOCAL
1067 bool
1068
1069 config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
1070 bool
1071
1072 # struct io_mapping based helper. Selected by drivers that need them
1073 config IO_MAPPING
1074 bool
1075
1076 config SECRETMEM
1077 def_bool ARCH_HAS_SET_DIRECT_MAP && !EMBEDDED
1078
1079 config ANON_VMA_NAME
1080 bool "Anonymous VMA name support"
1081 depends on PROC_FS && ADVISE_SYSCALLS && MMU
1082
1083 help
1084 Allow naming anonymous virtual memory areas.
1085
1086 This feature allows assigning names to virtual memory areas. Assigned
1087 names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
1088 and help identifying individual anonymous memory areas.
1089 Assigning a name to anonymous virtual memory area might prevent that
1090 area from being merged with adjacent virtual memory areas due to the
1091 difference in their name.
1092
1093 config USERFAULTFD
1094 bool "Enable userfaultfd() system call"
1095 depends on MMU
1096 help
1097 Enable the userfaultfd() system call that allows to intercept and
1098 handle page faults in userland.
1099
1100 config HAVE_ARCH_USERFAULTFD_WP
1101 bool
1102 help
1103 Arch has userfaultfd write protection support
1104
1105 config HAVE_ARCH_USERFAULTFD_MINOR
1106 bool
1107 help
1108 Arch has userfaultfd minor fault support
1109
1110 config PTE_MARKER
1111 bool
1112
1113 help
1114 Allows to create marker PTEs for file-backed memory.
1115
1116 config PTE_MARKER_UFFD_WP
1117 bool "Userfaultfd write protection support for shmem/hugetlbfs"
1118 default y
1119 depends on HAVE_ARCH_USERFAULTFD_WP
1120 select PTE_MARKER
1121
1122 help
1123 Allows to create marker PTEs for userfaultfd write protection
1124 purposes. It is required to enable userfaultfd write protection on
1125 file-backed memory types like shmem and hugetlbfs.
1126
1127 source "mm/damon/Kconfig"
1128
1129 endmenu