Memory Management options
CONFIG_ARCH_NO_SWAP
CONFIG_SWAP Support for paging of anonymous memory (swap)
This option allows you to choose whether you want to have support for so called swap devices or swap files in your kernel that are used to provide more virtual memory than the actual RAM present in your computer. If unsure say Y.
- Depends on
&& BLOCK && !ARCH_NO_SWAP
If SWAP
CONFIG_ZSWAP Compressed cache for swap pages
A lightweight compressed cache for swap pages. It takes pages that are in the process of being swapped out and attempts to compress them into a dynamically allocated RAM-based memory pool. This can result in a significant I/O reduction on swap device and, in the case where decompressing from RAM is faster than swap device reads, can also improve workload performance.
If ZSWAP
CONFIG_ZSWAP_DEFAULT_ON Enable the compressed cache for swap pages by default
If selected, the compressed cache for swap pages will be enabled at boot, otherwise it will be disabled.
The selection made here can be overridden by using the kernel command line 'zswap.enabled=' option.
CONFIG_ZSWAP_SHRINKER_DEFAULT_ON Shrink the zswap pool on memory pressure
If selected, the zswap shrinker will be enabled, and the pages stored in the zswap pool will become available for reclaim (i.e written back to the backing swap device) on memory pressure.
This means that zswap writeback could happen even if the pool is not yet full, or the cgroup zswap limit has not been reached, reducing the chance that cold pages will reside in the zswap pool and consume memory indefinitely.
Default compressor
Selects the default compression algorithm for the compressed cache for swap pages.
For an overview what kind of performance can be expected from a particular compression algorithm please refer to the benchmarks available at the following LWN page: https://lwn.net/Articles/751795/
If in doubt, select 'LZO'.
The selection made here can be overridden by using the kernel command line 'zswap.compressor=' option.
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_DEFLATE Deflate
Use the Deflate algorithm as the default compression algorithm.
- Selects
CRYPTO_DEFLATE if ZSWAP
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZO LZO
Use the LZO algorithm as the default compression algorithm.
- Selects
CRYPTO_LZO if ZSWAP
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_842 842
Use the 842 algorithm as the default compression algorithm.
- Selects
CRYPTO_842 if ZSWAP
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4 LZ4
Use the LZ4 algorithm as the default compression algorithm.
- Selects
CRYPTO_LZ4 if ZSWAP
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_LZ4HC LZ4HC
Use the LZ4HC algorithm as the default compression algorithm.
- Selects
CRYPTO_LZ4HC if ZSWAP
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD zstd
Use the zstd algorithm as the default compression algorithm.
- Selects
CRYPTO_ZSTD if ZSWAP
CONFIG_ZSWAP_COMPRESSOR_DEFAULT
CONFIG_ZSMALLOC
- Off
- Module
- Built in
Zsmalloc allocator options
- Depends on
ZSMALLOC
Zsmalloc is a common backend allocator for zswap & zram
- Depends on
ZSMALLOC
CONFIG_ZSMALLOC_STAT Export zsmalloc statistics
This option enables code in the zsmalloc to collect various statistics about what's happening in zsmalloc and exports that information to userspace via debugfs. If unsure, say N.
CONFIG_ZSMALLOC_CHAIN_SIZE Maximum number of physical pages per-zspage
This option sets the upper limit on the number of physical pages that a zmalloc page (zspage) can consist of. The optimal zspage chain size is calculated for each size class during the initialization of the pool.
Changing this option can alter the characteristics of size classes, such as the number of pages per zspage and the number of objects per zspage. This can also result in different configurations of the pool, as zsmalloc merges size classes with similar characteristics.
For more information, see zsmalloc documentation.
Slab allocator options
CONFIG_SLUB
- Selects
IRQ_WORK
CONFIG_KVFREE_RCU_BATCHED
- Depends on
!SLUB_TINY && !TINY_RCU && !RCU_STRICT_GRACE_PERIOD
CONFIG_SLUB_TINY Configure for minimal memory footprint
Configures the slab allocator in a way to achieve minimal memory footprint, sacrificing scalability, debugging and other features. This is intended only for the smallest system that had used the SLOB allocator and is not recommended for systems with more than 16MB RAM.
If unsure, say N.
- Depends on
EXPERT && !COMPILE_TEST - Selects
SLAB_MERGE_DEFAULT if EXPERT && !COMPILE_TEST
CONFIG_SLAB_MERGE_DEFAULT Allow slab caches to be merged
For reduced kernel memory fragmentation, slab caches can be merged when they share the same size and other characteristics. This carries a risk of kernel heap overflows being able to overwrite objects from merged caches (and more easily control cache layout), which makes such heap attacks easier to exploit by attackers. By keeping caches unmerged, these kinds of exploits can usually only damage objects in the same cache. To disable merging at runtime, "slab_nomerge" can be passed on the kernel command line.
CONFIG_SLAB_FREELIST_RANDOM Randomize slab freelist
Randomizes the freelist order used on creating new pages. This security feature reduces the predictability of the kernel slab allocator against heap overflows.
- Depends on
!SLUB_TINY
CONFIG_SLAB_FREELIST_HARDENED Harden slab freelist metadata
Many kernel heap attacks try to target slab cache metadata and other infrastructure. This options makes minor performance sacrifices to harden the kernel slab allocator against common freelist exploit methods.
- Depends on
!SLUB_TINY
CONFIG_SLAB_BUCKETS Support allocation from separate kmalloc buckets
Kernel heap attacks frequently depend on being able to create specifically-sized allocations with user-controlled contents that will be allocated into the same kmalloc bucket as a target object. To avoid sharing these allocation buckets, provide an explicitly separated set of buckets to be used for user-controlled allocations. This may very slightly increase memory fragmentation, though in practice it's only a handful of extra pages since the bulk of user-controlled allocations are relatively long-lived.
If unsure, say Y.
- Depends on
!SLUB_TINY
CONFIG_SLUB_STATS Enable performance statistics
The statistics are useful to debug slab allocation behavior in order find ways to optimize the allocator. This should never be enabled for production use since keeping statistics slows down the allocator by a few percentage points. The slabinfo command supports the determination of the most active slabs to figure out which slabs are relevant to a particular load. Try running: slabinfo -DA
CONFIG_KMALLOC_PARTITION_CACHES Partitioned slab caches for normal kmalloc
A hardening feature that creates multiple isolated copies of slab caches for normal kmalloc allocations. This makes it more difficult to exploit memory-safety vulnerabilities by attacking vulnerable co-located memory objects. Several modes are provided.
Currently the number of copies is set to 16, a reasonably large value that effectively diverges the memory objects allocated for different subsystems or modules into different caches, at the expense of a limited degree of memory and CPU overhead that relates to hardware and system workload.
- Depends on
!SLUB_TINY
If KMALLOC_PARTITION_CACHES
Partitioned slab cache mode
Selects the slab cache partitioning mode.
CONFIG_KMALLOC_PARTITION_RANDOM Randomize slab caches for normal kmalloc
Randomly pick a slab cache based on code address and a per-boot random seed.
This makes it harder for attackers to predict object co-location. The placement is random: while attackers don't know which kmalloc cache an object will be allocated from, they might circumvent the randomization by retrying attacks across multiple machines until the target objects are co-located.
CONFIG_KMALLOC_PARTITION_TYPED Type based slab cache selection for normal kmalloc
Rely on Clang's allocation tokens to choose a slab cache, where token IDs are derived from the allocated type.
Unlike KMALLOC_PARTITION_RANDOM, cache assignment is deterministic based on type, which guarantees that objects of certain types are not placed in the same cache. This effectively mitigates certain classes of exploits that probabilistic defenses like KMALLOC_PARTITION_RANDOM only make harder but not impossible. However, this also means the cache assignment is predictable.
Clang's default token ID calculation returns a bounded hash with disjoint ranges for pointer-containing and pointerless objects: when used as the slab cache index, this prevents buffer overflows on primitive buffers from directly corrupting pointer-containing objects.
The current effectiveness of Clang's type inference can be judged by -Rpass=alloc-token, which provides diagnostics where (after dead-code elimination) type inference failed.
Requires Clang 22 or later.
- Depends on
KMALLOC_PARTITION_CACHES && CC_HAS_ALLOC_TOKEN
CONFIG_RANDOM_KMALLOC_CACHES
Transitional config for migration to KMALLOC_PARTITION_CACHES.
CONFIG_SHUFFLE_PAGE_ALLOCATOR Page allocator randomization
Randomization of the page allocator improves the average utilization of a direct-mapped memory-side-cache. See section 5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI 6.2a specification for an example of how a platform advertises the presence of a memory-side-cache. There are also incidental security benefits as it reduces the predictability of page allocations to compliment SLAB_FREELIST_RANDOM, but the default granularity of shuffling on the MAX_PAGE_ORDER i.e, 10th order of pages is selected based on cache utilization benefits on x86.
While the randomization improves cache utilization it may negatively impact workloads on platforms without a cache. For this reason, by default, the randomization is not enabled even if SHUFFLE_PAGE_ALLOCATOR=y. The randomization may be force enabled with the 'page_alloc.shuffle' kernel command line parameter.
Say Y if unsure.
CONFIG_COMPAT_BRK Disable heap randomization
Randomizing heap placement makes heap exploits harder, but it also breaks ancient binaries (including anything libc5 based). This option changes the bootup default to heap randomization disabled, and can be overridden at runtime by setting /proc/sys/kernel/randomize_va_space to 2.
On non-ancient distros (post-2000 ones) N is usually a safe choice.
CONFIG_MMAP_ALLOW_UNINITIALIZED Allow mmapped anonymous memory to be uninitialized
Normally, and according to the Linux spec, anonymous memory obtained from mmap() has its contents cleared before it is passed to userspace. Enabling this config option allows you to request that mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus providing a huge performance boost. If this option is not enabled, then the flag will be ignored.
This is taken advantage of by uClibc's malloc(), and also by ELF-FDPIC binfmt's brk and stack allocator.
Because of the obvious security issues, this option should only be enabled on embedded devices where you control what is run in userspace. Since that isn't generally a problem on no-MMU systems, it is normally safe to say Y here.
See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
- Depends on
EXPERT && !
CONFIG_SELECT_MEMORY_MODEL
- Depends on
Memory model
This option allows you to change some of the ways that Linux manages its memory internally. Most users will only have one option here selected by the architecture configuration. This is normal.
- Depends on
SELECT_MEMORY_MODEL
CONFIG_FLATMEM_MANUAL Flat Memory
This option is best suited for non-NUMA systems with flat address space. The FLATMEM is the most efficient system in terms of performance and resource consumption and it is the best option for smaller systems.
For systems that have holes in their physical address spaces and for features like NUMA and memory hotplug, choose "Sparse Memory".
If unsure, choose this option (Flat Memory) over any other.
- Depends on
SELECT_MEMORY_MODEL && ! && (! || )
CONFIG_SPARSEMEM_MANUAL Sparse Memory
This will be the only option for some systems, including memory hot-plug systems. This is normal.
This option provides efficient support for systems with holes is their physical address space and allows memory hot-plug and hot-remove.
If unsure, choose "Flat Memory" over this option.
- Depends on
SELECT_MEMORY_MODEL &&
CONFIG_SPARSEMEM
- Depends on
!SELECT_MEMORY_MODEL && || SPARSEMEM_MANUAL
CONFIG_FLATMEM
- Depends on
! && (!SPARSEMEM || FLATMEM_MANUAL)
CONFIG_SPARSEMEM_STATIC
CONFIG_SPARSEMEM_EXTREME
- Depends on
SPARSEMEM && !SPARSEMEM_STATIC
CONFIG_SPARSEMEM_VMEMMAP_ENABLE
CONFIG_SPARSEMEM_VMEMMAP
SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise pfn_to_page and page_to_pfn operations. This is the most efficient option when sufficient kernel resources are available.
- Depends on
SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
CONFIG_VMEMMAP_OPTIMIZATION
- Depends on
SPARSEMEM_VMEMMAP
CONFIG_ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
CONFIG_ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
CONFIG_HAVE_MEMBLOCK_PHYS_MAP
CONFIG_HAVE_GUP_FAST
- Depends on
CONFIG_ARCH_KEEP_MEMBLOCK
CONFIG_NUMA_KEEP_MEMINFO
CONFIG_MEMORY_ISOLATION
CONFIG_EXCLUSIVE_SYSTEM_RAM
- Depends on
!DEVMEM || STRICT_DEVMEM
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG
CONFIG_MEMORY_HOTPLUG Memory hotplug
- Depends on
SPARSEMEM_VMEMMAP && ARCH_ENABLE_MEMORY_HOTPLUG && - Selects
MEMORY_ISOLATION if SPARSEMEM_VMEMMAP && ARCH_ENABLE_MEMORY_HOTPLUG && - Selects
NUMA_KEEP_MEMINFO if SPARSEMEM_VMEMMAP && ARCH_ENABLE_MEMORY_HOTPLUG && &&
If MEMORY_HOTPLUG
Memory Hotplug Default Online Type
Default memory type for hotplugged memory.
This option sets the default policy setting for memory hotplug onlining policy (/sys/devices/system/memory/auto_online_blocks) which determines what happens to newly added memory regions. Policy setting can always be changed at runtime.
The default is 'offline'.
Select offline to defer onlining to drivers and user policy. Select auto to let the kernel choose what zones to utilize. Select online_kernel to generally allow kernel usage of this memory. Select online_movable to generally disallow kernel usage of this memory.
Example kernel usage would be page structs and page tables.
See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
CONFIG_MHP_DEFAULT_ONLINE_TYPE_OFFLINE offline
Hotplugged memory will not be onlined by default. Choose this for systems with drivers and user policy that handle onlining of hotplug memory policy.
CONFIG_MHP_DEFAULT_ONLINE_TYPE_ONLINE_AUTO auto
Select this if you want the kernel to automatically online hotplugged memory into the zone it thinks is reasonable. This memory may be utilized for kernel data.
CONFIG_MHP_DEFAULT_ONLINE_TYPE_ONLINE_KERNEL kernel
Select this if you want the kernel to automatically online hotplugged memory into a zone capable of being used for kernel data. This typically means ZONE_NORMAL.
CONFIG_MHP_DEFAULT_ONLINE_TYPE_ONLINE_MOVABLE movable
Select this if you want the kernel to automatically online hotplug memory into ZONE_MOVABLE. This memory will generally not be utilized for kernel data.
This should only be used when the admin knows sufficient ZONE_NORMAL memory is available to describe hotplug memory, otherwise hotplug memory may fail to online. For example, sufficient kernel-capable memory (ZONE_NORMAL) must be available to allocate page structs to describe ZONE_MOVABLE.
CONFIG_MEMORY_HOTREMOVE Allow for memory hot remove
- Selects
MIGRATION if MEMORY_HOTPLUG
CONFIG_MHP_MEMMAP_ON_MEMORY
- Depends on
MEMORY_HOTPLUG && ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
CONFIG_ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
CONFIG_SPLIT_PTE_PTLOCKS
CONFIG_ARCH_ENABLE_SPLIT_PMD_PTLOCK
CONFIG_SPLIT_PMD_PTLOCKS
- Depends on
SPLIT_PTE_PTLOCKS && ARCH_ENABLE_SPLIT_PMD_PTLOCK
CONFIG_BALLOON
CONFIG_BALLOON_MIGRATION Allow for balloon memory migration
Allow for migration of pages inflated in a memory balloon such that they can be allocated from memory areas only available for movable allocations (e.g., ZONE_MOVABLE, CMA) and such that they can be migrated for memory defragmentation purposes by memory compaction.
CONFIG_COMPACTION Allow for memory compaction
Compaction is the only memory management component to form high order (larger physically contiguous) memory blocks reliably. The page allocator relies on compaction heavily and the lack of the feature can lead to unexpected OOM killer invocations for high order memory requests. You shouldn't disable this option unless there really is a strong reason for it and then we would be really interested to hear about that at linux-mm@kvack.org.
- Depends on
- Selects
MIGRATION if
If COMPACTION
CONFIG_COMPACT_UNEVICTABLE_DEFAULT
CONFIG_PAGE_REPORTING Free page reporting
Free page reporting allows for the incremental acquisition of free pages from the buddy allocator for the purpose of reporting those pages to another entity, such as a hypervisor, so that the memory can be freed within the host for other uses.
CONFIG_NUMA_MIGRATION NUMA page migration
Support the migration of pages to other NUMA nodes, available to user space through interfaces like migrate_pages(), move_pages(), and mbind(). Selecting this option also enables support for page demotion for memory tiering.
- Depends on
&& - Selects
MIGRATION if &&
CONFIG_MIGRATION
- Depends on
CONFIG_DEVICE_MIGRATION
CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
CONFIG_ARCH_HAS_PMD_SOFTLEAVES
CONFIG_HUGETLB_PAGE_SIZE_VARIABLE
Allows the pageblock_order value to be dynamic instead of just standard HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available on a platform.
Note that the pageblock_order cannot exceed MAX_PAGE_ORDER and will be clamped down to MAX_PAGE_ORDER.
CONFIG_CONTIG_ALLOC
CONFIG_PCP_BATCH_SCALE_MAX Maximum scale factor of PCP (Per-CPU pageset) batch allocate/free
In page allocator, PCP (Per-CPU pageset) is refilled and drained in batches. The batch number is scaled automatically to improve page allocation/free throughput. But too large scale factor may hurt latency. This option sets the upper limit of scale factor to limit the maximum latency.
- Range
[0 6]
CONFIG_PHYS_ADDR_T_64BIT
CONFIG_MMU_NOTIFIER
- Selects
INTERVAL_TREE
CONFIG_KSM Enable KSM for page merging
Enable Kernel Samepage Merging: KSM periodically scans those areas of an application's address space that an app has advised may be mergeable. When it finds pages of identical content, it replaces the many instances by a single page with that content, so saving memory until one or another app needs to modify the content. Recommended for use with KVM, or with other duplicative applications. See Documentation/mm/ksm.rst for more information: KSM is inactive until a program has madvised that an area is MADV_MERGEABLE, and root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
- Depends on
- Selects
XXHASH if
CONFIG_DEFAULT_MMAP_MIN_ADDR Low address space to protect from user allocation
This is the portion of low virtual memory which should be protected from userspace allocation. Keeping a user from writing to low pages can help reduce the impact of kernel NULL pointer bugs.
For most arm64, ppc64 and x86 users with lots of address space a value of 65536 is reasonable and should cause no problems. On arm and other archs it should not be higher than 32768. Programs which use vm86 functionality or have some need to map this low address space will need CAP_SYS_RAWIO or disable this protection by setting the value to 0.
This value can be changed after boot using the /proc/sys/vm/mmap_min_addr tunable.
- Depends on
CONFIG_ARCH_SUPPORTS_MEMORY_FAILURE
CONFIG_MEMORY_FAILURE Enable recovery from hardware memory errors
Enables code to recover from some memory failures on systems with MCA recovery. This allows a system to continue running even when some of its memory has uncorrected errors. This requires special hardware support and typically ECC memory.
- Depends on
&& ARCH_SUPPORTS_MEMORY_FAILURE - Selects
INTERVAL_TREE if && ARCH_SUPPORTS_MEMORY_FAILURE - Selects
MIGRATION if && ARCH_SUPPORTS_MEMORY_FAILURE
If MEMORY_FAILURE
CONFIG_HWPOISON_INJECT HWPoison pages injector
- Off
- Module
- Built in
- Depends on
MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS - Selects
PROC_PAGE_MONITOR if MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
CONFIG_NOMMU_INITIAL_TRIM_EXCESS Turn on mmap() excess space trimming before booting
The NOMMU mmap() frequently needs to allocate large contiguous chunks of memory on which to store mappings, but it can only ask the system allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently more than it requires. To deal with this, mmap() is able to trim off the excess and return it to the allocator.
If trimming is enabled, the excess is trimmed off and returned to the system allocator, which can cause extra fragmentation, particularly if there are a lot of transient processes.
If trimming is disabled, the excess is kept, but not used, which for long-term mappings means that the space is wasted.
Trimming can be dynamically controlled through a sysctl option (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of excess pages there must be before trimming should occur, or zero if no trimming is to occur.
This option specifies the initial value of this option. The default of 1 says that all excess pages should be trimmed.
See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
- Depends on
!
CONFIG_ARCH_WANT_GENERAL_HUGETLB
CONFIG_ARCH_WANTS_THP_SWAP
CONFIG_PERSISTENT_HUGE_ZERO_FOLIO Allocate a PMD sized folio for zeroing
Enable this option to reduce the runtime refcounting overhead of the huge zero folio and expand the places in the kernel that can use huge zero folios. For instance, block I/O benefits from access to large folios for zeroing memory.
With this option enabled, the huge zero folio is allocated once and never freed. One full huge page's worth of memory shall be used.
Say Y if your system has lots of memory. Say N if you are memory constrained.
- Depends on
TRANSPARENT_HUGEPAGE
CONFIG_MM_ID
CONFIG_TRANSPARENT_HUGEPAGE Transparent Hugepage Support
Transparent Hugepages allows the kernel to use huge pages and huge tlb transparently to the applications whenever possible. This feature can improve computing performance to certain applications by speeding up page faults during memory allocation, by reducing the number of tlb misses and by speeding up the pagetable walking.
If memory constrained on embedded, you may want to say N.
- Depends on
HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT - Selects
COMPACTION if HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT - Selects
XARRAY_MULTI if HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT - Selects
MM_ID if HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
If TRANSPARENT_HUGEPAGE
Transparent Hugepage Support sysfs defaults
Selects the sysfs defaults for Transparent Hugepage Support.
CONFIG_TRANSPARENT_HUGEPAGE_ALWAYS always
Enabling Transparent Hugepage always, can increase the memory footprint of applications without a guaranteed benefit but it will work automatically for all applications.
CONFIG_TRANSPARENT_HUGEPAGE_MADVISE madvise
Enabling Transparent Hugepage madvise, will only provide a performance improvement benefit to the applications using madvise(MADV_HUGEPAGE) but it won't risk to increase the memory footprint of applications without a guaranteed benefit.
CONFIG_TRANSPARENT_HUGEPAGE_NEVER never
Disable Transparent Hugepage by default. It can still be enabled at runtime via sysfs.
Shmem hugepage allocation defaults
Selects the hugepage allocation policy defaults for the internal shmem mount.
The selection made here can be overridden by using the kernel command line 'transparent_hugepage_shmem=' option.
CONFIG_TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER never
Disable hugepage allocation for shmem mount by default. It can still be enabled with the kernel command line 'transparent_hugepage_shmem=' option or at runtime via sysfs knob. Note that madvise(MADV_COLLAPSE) can still cause transparent huge pages to be obtained even if this mode is specified.
CONFIG_TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ALWAYS always
Always attempt to allocate hugepage for shmem mount, can increase the memory footprint of applications without a guaranteed benefit but it will work automatically for all applications.
CONFIG_TRANSPARENT_HUGEPAGE_SHMEM_HUGE_WITHIN_SIZE within_size
Enable hugepage allocation for shmem mount if the allocation will be fully within the i_size. This configuration also takes into account any madvise(MADV_HUGEPAGE) hints that may be provided by the applications.
CONFIG_TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ADVISE advise
Enable hugepage allocation for the shmem mount exclusively when applications supply the madvise(MADV_HUGEPAGE) hint. This ensures that hugepages are used only in response to explicit requests from applications.
Tmpfs hugepage allocation defaults
Selects the hugepage allocation policy defaults for the tmpfs mount.
The selection made here can be overridden by using the kernel command line 'transparent_hugepage_tmpfs=' option.
CONFIG_TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER never
Disable hugepage allocation for tmpfs mount by default. It can still be enabled with the kernel command line 'transparent_hugepage_tmpfs=' option. Note that madvise(MADV_COLLAPSE) can still cause transparent huge pages to be obtained even if this mode is specified.
CONFIG_TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ALWAYS always
Always attempt to allocate hugepage for tmpfs mount, can increase the memory footprint of applications without a guaranteed benefit but it will work automatically for all applications.
CONFIG_TRANSPARENT_HUGEPAGE_TMPFS_HUGE_WITHIN_SIZE within_size
Enable hugepage allocation for tmpfs mount if the allocation will be fully within the i_size. This configuration also takes into account any madvise(MADV_HUGEPAGE) hints that may be provided by the applications.
CONFIG_TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ADVISE advise
Enable hugepage allocation for the tmpfs mount exclusively when applications supply the madvise(MADV_HUGEPAGE) hint. This ensures that hugepages are used only in response to explicit requests from applications.
CONFIG_THP_SWAP
Swap transparent huge pages in one piece, without splitting. XXX: For now, swap cluster backing transparent huge page will be split after swapout.
For selection by architectures with reasonable THP sizes.
- Depends on
TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP &&
CONFIG_NO_PAGE_MAPCOUNT No per-page mapcount (EXPERIMENTAL)
Do not maintain per-page mapcounts for pages part of larger allocations, such as transparent huge pages.
When this config option is enabled, some interfaces that relied on this information will rely on less-precise per-allocation information instead: for example, using the average per-page mapcount in such a large allocation instead of the per-page mapcount.
EXPERIMENTAL because the impact of some changes is still unclear.
CONFIG_PAGE_MAPCOUNT
CONFIG_PGTABLE_HAS_HUGE_LEAVES
CONFIG_HAVE_GIGANTIC_FOLIOS
CONFIG_ASYNC_KERNEL_PGTABLE_FREE
CONFIG_ARCH_SUPPORTS_HUGE_PFNMAP
- Depends on
TRANSPARENT_HUGEPAGE
CONFIG_ARCH_SUPPORTS_PMD_PFNMAP
- Depends on
ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE
CONFIG_ARCH_SUPPORTS_PUD_PFNMAP
CONFIG_ARCH_MODULE_NEEDS_WEAK_PER_CPU
CONFIG_NEED_PER_CPU_KM
- Depends on
! || !
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK
CONFIG_USE_PERCPU_NUMA_NODE_ID
CONFIG_HAVE_SETUP_PER_CPU_AREA
CONFIG_CMA Contiguous Memory Allocator
This enables the Contiguous Memory Allocator which allows other subsystems to allocate big physically-contiguous blocks of memory. CMA reserves a region of memory and allows only movable pages to be allocated from it. This way, the kernel can use the memory for pagecache and when a subsystem requests for contiguous area, the allocated pages are migrated away to serve the contiguous request.
If unsure, say "n".
- Depends on
- Selects
MIGRATION if - Selects
MEMORY_ISOLATION if
If CMA
CONFIG_CMA_DEBUGFS CMA debugfs interface
Turns on the DebugFS interface for CMA.
CONFIG_CMA_SYSFS CMA information through sysfs interface
This option exposes some sysfs attributes to get information from CMA.
CONFIG_CMA_AREAS Maximum count of the CMA areas
CMA allows to create CMA areas for particular purpose, mainly, used as device private area. This parameter sets the maximum number of CMA area in the system.
If unsure, leave the default value "8" in UMA and "20" in NUMA.
CONFIG_ARCH_FORCE_MAX_ORDER
CONFIG_PAGE_BLOCK_MAX_ORDER Page Block Order Upper Limit
The page block order refers to the power of two number of pages that are physically contiguous and can have a migrate type associated to them. The maximum size of the page block order is at least limited by ARCH_FORCE_MAX_ORDER/MAX_PAGE_ORDER.
This config adds a new upper limit of default page block order when the page block order is required to be smaller than ARCH_FORCE_MAX_ORDER/MAX_PAGE_ORDER or other limits (see include/linux/pageblock-flags.h for details).
Reducing pageblock order can negatively impact THP generation success rate. If your workloads use THP heavily, please use this option with caution.
Don't change if unsure.
- Range
[1 10] if =0 - Range
[1 ] if !=0
CONFIG_MEM_SOFT_DIRTY Track memory changes
This option enables memory changes tracking by introducing a soft-dirty bit on pte-s. This bit it set when someone writes into a page just as regular dirty bit, but unlike the latter it can be cleared by hands.
See Documentation/admin-guide/mm/soft-dirty.rst for more details.
- Depends on
CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS - Selects
PROC_PAGE_MONITOR if CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
CONFIG_GENERIC_EARLY_IOREMAP
CONFIG_STACK_MAX_DEFAULT_SIZE_MB Default maximum user stack size for 32-bit processes (MB)
This is the maximum stack size in Megabytes in the VM layout of 32-bit user processes when the stack grows upwards (currently only on parisc arch) when the RLIMIT_STACK hard limit is unlimited.
A sane initial value is 100 MB.
- Depends on
STACK_GROWSUP && (! || ) - Range
[8 2048] if STACK_GROWSUP && (! || )
CONFIG_DEFERRED_STRUCT_PAGE_INIT Defer initialisation of struct pages to kthreads
Ordinarily all struct pages are initialised during early boot in a single thread. On very large machines this can take a considerable amount of time. If this option is set, large machines will bring up a subset of memmap at boot and then initialise the rest in parallel. This has a potential performance impact on tasks running early in the lifetime of the system until these kthreads finish the initialisation.
- Depends on
SPARSEMEM && !NEED_PER_CPU_KM && && !KMSAN - Selects
PADATA if SPARSEMEM && !NEED_PER_CPU_KM && && !KMSAN
CONFIG_PAGE_IDLE_FLAG
This adds PG_idle and PG_young flags to 'struct page'. PTE Accessed bit writers can set the state of the bit in the flags so that PTE Accessed bit readers may avoid disturbance.
- Selects
PAGE_EXTENSION if !
CONFIG_IDLE_PAGE_TRACKING Enable idle page tracking
This feature allows to estimate the amount of user pages that have not been touched during a given period of time. This information can be useful to tune memory cgroup limits and/or for job placement within a compute cluster.
See Documentation/admin-guide/mm/idle_page_tracking.rst for more details.
- Depends on
SYSFS && - Selects
PAGE_IDLE_FLAG if SYSFS &&
CONFIG_ARCH_HAS_CPU_CACHE_ALIASING
CONFIG_ARCH_HAS_CACHE_LINE_SIZE
CONFIG_ARCH_HAS_CURRENT_STACK_POINTER
In support of HARDENED_USERCOPY performing stack variable lifetime checking, an architecture-agnostic way to find the stack pointer is needed. Once an architecture defines an unsigned long global register alias named "current_stack_pointer", this config can be selected.
CONFIG_ARCH_HAS_ZONE_DMA_SET
CONFIG_ZONE_DMA Support DMA zone
CONFIG_ZONE_DMA32 Support DMA32 zone
- Depends on
!
CONFIG_ZONE_DEVICE Device memory (pmem, HMM, etc...) hotplug support
Device memory hotplug support allows for establishing pmem, or other device driver discovered memory regions, in the memmap. This allows pfn_to_page() lookups of otherwise "device-physical" addresses which is needed for DAX, PCI_P2PDMA, and DEVICE_PRIVATE features among others.
Enabling this option will reduce the entropy of x86 KASLR memory regions. For example - on a 46 bit system, the entropy goes down from 16 bits to 15 bits. The actual reduction in entropy depends on the physical address bits, on processor features, kernel config (5 level page table) and physical memory present on the system.
- Depends on
MEMORY_HOTREMOVE - Selects
VMEMMAP_OPTIMIZATION if MEMORY_HOTREMOVE && ARCH_WANT_OPTIMIZE_DAX_VMEMMAP - Selects
XARRAY_MULTI if MEMORY_HOTREMOVE
CONFIG_HMM_MIRROR
- Depends on
- Selects
MMU_NOTIFIER if
CONFIG_GET_FREE_REGION
CONFIG_DEVICE_PRIVATE Unaddressable device memory (GPU memory, ...)
Allows creation of struct pages to represent unaddressable device memory; i.e., memory that is only accessible from the device (or group of devices). You likely also want to select HMM_MIRROR.
- Depends on
ZONE_DEVICE - Selects
GET_FREE_REGION if ZONE_DEVICE
CONFIG_VMAP_PFN
CONFIG_ARCH_USES_HIGH_VMA_FLAGS
CONFIG_ARCH_HAS_PKEYS
CONFIG_ARCH_USES_PG_ARCH_2
CONFIG_ARCH_USES_PG_ARCH_3
CONFIG_VM_EVENT_COUNTERS Enable VM event counters for /proc/vmstat
VM event counters are needed for event counts to be shown. This option allows the disabling of the VM event counters on EXPERT systems. /proc/vmstat will only show page counts if VM event counters are disabled.
CONFIG_PERCPU_STATS Collect percpu memory statistics
This feature collects and exposes statistics via debugfs. The information includes global and per chunk statistics, which can be used to help understand percpu memory usage.
CONFIG_GUP_TEST Enable infrastructure for get_user_pages()-related unit tests and benchmarks
Provides /sys/kernel/debug/gup_test, which in turn provides a way to make ioctl calls that can launch kernel-based unit tests and benchmarks for the get_user_pages*() and pin_user_pages*() families of API calls.
These include benchmark testing of the _fast variants of get_user_pages*() and pin_user_pages*(), as well as tests of the non-_fast variants.
See tools/testing/selftests/mm/gup.c and tools/mm/gup_bench.c.
- Depends on
DEBUG_FS
GUP_TEST needs to have DEBUG_FS enabled
CONFIG_GUP_GET_PXX_LOW_HIGH
CONFIG_DMAPOOL_TEST Enable a module to run time tests on dma_pool
- Off
- Module
- Built in
Provides a test module that will allocate and free many blocks of various sizes and report how long it takes. This is intended to provide a consistent way to measure how changes to the dma_pool_alloc/free routines affect performance.
- Depends on
HAS_DMA
CONFIG_ARCH_HAS_PTE_SPECIAL
CONFIG_MAPPING_DIRTY_HELPERS
CONFIG_KMAP_LOCAL
CONFIG_KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
CONFIG_MEMFD_CREATE Enable memfd_create() system call
CONFIG_SECRETMEM Enable memfd_secret() system call
Enable the memfd_secret() system call with the ability to create memory areas visible only in the context of the owning process and not mapped to other processes and other kernel page tables.
- Depends on
ARCH_HAS_SET_DIRECT_MAP
CONFIG_ANON_VMA_NAME Anonymous VMA name support
Allow naming anonymous virtual memory areas.
This feature allows assigning names to virtual memory areas. Assigned names can be later retrieved from /proc/pid/maps and /proc/pid/smaps and help identifying individual anonymous memory areas. Assigning a name to anonymous virtual memory area might prevent that area from being merged with adjacent virtual memory areas due to the difference in their name.
- Depends on
PROC_FS && ADVISE_SYSCALLS &&
CONFIG_HAVE_ARCH_USERFAULTFD_WP
Arch has userfaultfd write protection support
CONFIG_HAVE_ARCH_USERFAULTFD_MINOR
Arch has userfaultfd minor fault support
CONFIG_USERFAULTFD_RWP
Userfaultfd read-write protection (UFFDIO_RWPROTECT) delivers a userfaultfd notification on every access -- read or write -- to a protected range, letting userspace observe the working set of a process.
- Depends on
&& ARCH_HAS_PTE_PROTNONE && HAVE_ARCH_USERFAULTFD_WP
CONFIG_USERFAULTFD Enable userfaultfd() system call
Enable the userfaultfd() system call that allows to intercept and handle page faults in userland.
- Depends on
If USERFAULTFD
CONFIG_PTE_MARKER_UFFD_WP Userfaultfd write protection support for shmem/hugetlbfs
Allows to create marker PTEs for userfaultfd write protection purposes. It is required to enable userfaultfd write protection on file-backed memory types like shmem and hugetlbfs.
- Depends on
USERFAULTFD && HAVE_ARCH_USERFAULTFD_WP
CONFIG_LRU_GEN Multi-Gen LRU
A high performance LRU implementation to overcommit memory. See Documentation/admin-guide/mm/multigen_lru.rst for details.
- Depends on
&& ( || !SPARSEMEM || SPARSEMEM_VMEMMAP)
If LRU_GEN
CONFIG_LRU_GEN_ENABLED Enable by default
This option enables the multi-gen LRU by default.
CONFIG_LRU_GEN_STATS Full stats for debugging
Do not enable this option unless you plan to look at historical stats from evicted generations for debugging purpose.
This option has a per-memcg and per-node memory overhead.
CONFIG_LRU_GEN_WALKS_MMU
- Depends on
LRU_GEN && ARCH_HAS_HW_PTE_YOUNG
CONFIG_LOCK_MM_AND_FIND_VMA
- Depends on
!STACK_GROWSUP
CONFIG_IOMMU_MM_DATA
CONFIG_EXECMEM
CONFIG_NUMA_MEMBLKS
CONFIG_NUMA_EMU NUMA emulation
Enable NUMA emulation. A flat machine will be split into virtual nodes when booted with "numa=fake=N", where N is the number of nodes. This is only useful for debugging.
- Depends on
NUMA_MEMBLKS && (X86 || GENERIC_ARCH_NUMA)
CONFIG_GENERIC_ARCH_NUMA
Enable support for generic NUMA implementation. Currently, RISC-V and ARM64 use it.
- Selects
NUMA_MEMBLKS
CONFIG_ARCH_HAS_USER_SHADOW_STACK
The architecture has hardware support for userspace shadow call stacks (eg, x86 CET, arm64 GCS or RISC-V Zicfiss).
CONFIG_HAVE_ARCH_TLB_REMOVE_TABLE
CONFIG_PT_RECLAIM
Try to reclaim empty user page table pages in paths other than munmap and exit_mmap path.
Note: now only empty user PTE page table pages will be reclaimed.
- Depends on
&& !HAVE_ARCH_TLB_REMOVE_TABLE
CONFIG_FIND_NORMAL_PAGE
CONFIG_ARCH_HAS_LAZY_MMU_MODE
The architecture uses the lazy MMU mode. This allows changes to MMU-related architectural state to be deferred until the mode is exited. See <linux/pgtable.h> for details.
CONFIG_LAZY_MMU_MODE_KUNIT_TEST KUnit tests for the lazy MMU mode
- Off
- Module
- Built in
Enable this option to check that the lazy MMU mode interface behaves as expected. Only tests for the generic interface are included (not architecture-specific behaviours).
If unsure, say N.
- Depends on
ARCH_HAS_LAZY_MMU_MODE && KUNIT
CONFIG_ARCH_HAS_CHECK_WX
CONFIG_CHECK_WX Warn on W+X mappings at boot
Generate a warning if any W+X mappings are found at boot.
This is useful for discovering cases where the kernel is leaving W+X mappings after applying NX, as such mappings are a security risk.
Look for a message in dmesg output like this:
<arch>/mm: Checked W+X mappings: passed, no W+X pages found.
or like this, if the check failed:
<arch>/mm: Checked W+X mappings: failed, <N> W+X pages found.
Note that even if the check fails, your kernel is possibly still fine, as W+X mappings are not a security hole in themselves, what they do is that they make the exploitation of other unfixed kernel bugs easier.
There is no runtime or memory usage effect of this option once the kernel has booted up - it's a one time check.
If in doubt, say "Y".
- Depends on
ARCH_HAS_CHECK_WX && ARCH_HAS_PTDUMP && - Selects
PTDUMP if ARCH_HAS_CHECK_WX && ARCH_HAS_PTDUMP &&
CONFIG_ARCH_HAS_PTDUMP
CONFIG_PTDUMP
- arch/alpha/Kconfig:89
- arch/arc/Kconfig:70
- arch/arm/Kconfig:319
- arch/arm64/Kconfig:278
- arch/csky/Kconfig:160
- arch/hexagon/Kconfig:57
- arch/loongarch/Kconfig:787
- arch/m68k/Kconfig:84
- arch/microblaze/Kconfig:93
- arch/mips/Kconfig:3046
- arch/nios2/Kconfig:69
- arch/openrisc/Kconfig:54
- arch/parisc/Kconfig:106
- arch/powerpc/Kconfig:30
- arch/riscv/Kconfig:292
- arch/s390/Kconfig:2
- arch/sh/mm/Kconfig:4
- arch/sparc/Kconfig:140
- arch/um/Kconfig:52
- arch/x86/Kconfig:356
- arch/xtensa/Kconfig:94
- arch/alpha/Kconfig:465
- arch/arc/Kconfig:167
- arch/arm/Kconfig:910
- arch/arm64/Kconfig:358
- arch/csky/Kconfig:313
- arch/hexagon/Kconfig:104
- arch/loongarch/Kconfig:513
- arch/mips/Kconfig:2700
- arch/openrisc/Kconfig:191
- arch/parisc/Kconfig:314
- arch/powerpc/platforms/Kconfig.cputype:550
- arch/riscv/Kconfig:437
- arch/s390/Kconfig:530
- arch/sh/Kconfig:560
- arch/sparc/Kconfig:158
- arch/um/Kconfig:97
- arch/x86/Kconfig:437
- arch/xtensa/Kconfig:245
- arch/alpha/Kconfig:484
- arch/arc/Kconfig:175
- arch/arm/Kconfig:1063
- arch/arm64/Kconfig:1702
- arch/csky/Kconfig:318
- arch/hexagon/Kconfig:109
- arch/loongarch/Kconfig:542
- arch/m68k/Kconfig.cpu:552
- arch/microblaze/Kconfig:123
- arch/mips/Kconfig:2756
- arch/nios2/Kconfig:72
- arch/openrisc/Kconfig:185
- arch/parisc/Kconfig:367
- arch/powerpc/platforms/Kconfig.cputype:570
- arch/riscv/Kconfig:450
- arch/s390/Kconfig:533
- arch/sh/Kconfig:582
- arch/sparc/Kconfig:180
- arch/um/Kconfig:132
- arch/x86/Kconfig:1037
- arch/xtensa/Kconfig:253