Linux 6.9-rc1
[linux-2.6-microblaze.git] / mm / Kconfig
index e59cf5f..b1448aa 100644 (file)
@@ -23,9 +23,8 @@ menuconfig SWAP
          in your computer.  If unsure say Y.
 
 config ZSWAP
-       bool "Compressed cache for swap pages (EXPERIMENTAL)"
+       bool "Compressed cache for swap pages"
        depends on SWAP
-       select FRONTSWAP
        select CRYPTO
        select ZPOOL
        help
@@ -36,12 +35,6 @@ config ZSWAP
          in the case where decompressing from RAM is faster than swap device
          reads, can also improve workload performance.
 
-         This is marked experimental because it is a new feature (as of
-         v3.11) that interacts heavily with memory reclaim.  While these
-         interactions don't cause any known issues on simple memory setups,
-         they have not be fully explored on the large set of potential
-         configurations and workloads that exist.
-
 config ZSWAP_DEFAULT_ON
        bool "Enable the compressed cache for swap pages by default"
        depends on ZSWAP
@@ -52,6 +45,20 @@ config ZSWAP_DEFAULT_ON
          The selection made here can be overridden by using the kernel
          command line 'zswap.enabled=' option.
 
+config ZSWAP_SHRINKER_DEFAULT_ON
+       bool "Shrink the zswap pool on memory pressure"
+       depends on ZSWAP
+       default n
+       help
+         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.
+
 choice
        prompt "Default compressor"
        depends on ZSWAP
@@ -121,6 +128,7 @@ config ZSWAP_COMPRESSOR_DEFAULT
 choice
        prompt "Default allocator"
        depends on ZSWAP
+       default ZSWAP_ZPOOL_DEFAULT_ZSMALLOC if MMU
        default ZSWAP_ZPOOL_DEFAULT_ZBUD
        help
          Selects the default allocator for the compressed cache for
@@ -197,49 +205,46 @@ config ZSMALLOC_STAT
          information to userspace via debugfs.
          If unsure, say N.
 
-menu "SLAB allocator options"
-
-choice
-       prompt "Choose SLAB allocator"
-       default SLUB
+config ZSMALLOC_CHAIN_SIZE
+       int "Maximum number of physical pages per-zspage"
+       default 8
+       range 4 16
+       depends on ZSMALLOC
        help
-          This option allows to select a slab allocator.
+         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.
 
-config SLAB
-       bool "SLAB"
-       depends on !PREEMPT_RT
-       select HAVE_HARDENED_USERCOPY_ALLOCATOR
-       help
-         The regular slab allocator that is established and known to work
-         well in all environments. It organizes cache hot objects in
-         per cpu and per node queues.
+         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.
+
+menu "Slab allocator options"
 
 config SLUB
-       bool "SLUB (Unqueued Allocator)"
-       select HAVE_HARDENED_USERCOPY_ALLOCATOR
-       help
-          SLUB is a slab allocator that minimizes cache line usage
-          instead of managing queues of cached objects (SLAB approach).
-          Per cpu caching is realized using slabs of objects instead
-          of queues of objects. SLUB can use memory efficiently
-          and has enhanced diagnostics. SLUB is the default choice for
-          a slab allocator.
+       def_bool y
 
-config SLOB
+config SLUB_TINY
+       bool "Configure for minimal memory footprint"
        depends on EXPERT
-       bool "SLOB (Simple Allocator)"
-       depends on !PREEMPT_RT
+       select SLAB_MERGE_DEFAULT
        help
-          SLOB replaces the stock allocator with a drastically simpler
-          allocator. SLOB is generally more space efficient but
-          does not perform as well on large systems.
+          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.
 
-endchoice
+          If unsure, say N.
 
 config SLAB_MERGE_DEFAULT
        bool "Allow slab caches to be merged"
        default y
-       depends on SLAB || SLUB
        help
          For reduced kernel memory fragmentation, slab caches can be
          merged when they share the same size and other characteristics.
@@ -253,7 +258,7 @@ config SLAB_MERGE_DEFAULT
 
 config SLAB_FREELIST_RANDOM
        bool "Randomize slab freelist"
-       depends on SLAB || SLUB
+       depends on !SLUB_TINY
        help
          Randomizes the freelist order used on creating new pages. This
          security feature reduces the predictability of the kernel slab
@@ -261,21 +266,19 @@ config SLAB_FREELIST_RANDOM
 
 config SLAB_FREELIST_HARDENED
        bool "Harden slab freelist metadata"
-       depends on SLAB || SLUB
+       depends on !SLUB_TINY
        help
          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. Some slab implementations have more
-         sanity-checking than others. This option is most effective with
-         CONFIG_SLUB.
+         freelist exploit methods.
 
 config SLUB_STATS
        default n
-       bool "Enable SLUB performance statistics"
-       depends on SLUB && SYSFS
+       bool "Enable performance statistics"
+       depends on SYSFS && !SLUB_TINY
        help
-         SLUB statistics are useful to debug SLUBs allocation behavior in
+         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
@@ -285,8 +288,8 @@ config SLUB_STATS
 
 config SLUB_CPU_PARTIAL
        default y
-       depends on SLUB && SMP
-       bool "SLUB per cpu partial cache"
+       depends on SMP && !SLUB_TINY
+       bool "Enable per cpu partial caches"
        help
          Per cpu partial caches accelerate objects allocation and freeing
          that is local to a processor at the price of more indeterminism
@@ -294,7 +297,24 @@ config SLUB_CPU_PARTIAL
          which requires the taking of locks that may cause latency spikes.
          Typically one would choose no for a realtime system.
 
-endmenu # SLAB allocator options
+config RANDOM_KMALLOC_CACHES
+       default n
+       depends on !SLUB_TINY
+       bool "Randomize slab caches for normal kmalloc"
+       help
+         A hardening feature that creates multiple copies of slab caches for
+         normal kmalloc allocation and makes kmalloc randomly pick one based
+         on code address, which makes the attackers more difficult to spray
+         vulnerable memory objects on the heap for the purpose of exploiting
+         memory vulnerabilities.
+
+         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.
+
+endmenu # Slab allocator options
 
 config SHUFFLE_PAGE_ALLOCATOR
        bool "Page allocator randomization"
@@ -307,9 +327,9 @@ config SHUFFLE_PAGE_ALLOCATOR
          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_ORDER - 1" i.e,
-         10th order of pages is selected based on cache utilization
-         benefits on x86.
+         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
@@ -440,6 +460,15 @@ 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.
+#
+# Select this config option from the architecture Kconfig, if it is preferred
+# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
+#
+config ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
+       bool
+
+config ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
+       bool
 
 config HAVE_MEMBLOCK_PHYS_MAP
        bool
@@ -520,6 +549,9 @@ config MHP_MEMMAP_ON_MEMORY
 
 endif # MEMORY_HOTPLUG
 
+config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
+       bool
+
 # Heavily threaded applications may benefit from splitting the mm-wide
 # page_table_lock, so that faults on different parts of the user address
 # space can be handled with less contention: split it at this NR_CPUS.
@@ -551,7 +583,7 @@ config MEMORY_BALLOON
 # support for memory balloon compaction
 config BALLOON_COMPACTION
        bool "Allow for balloon memory compaction/migration"
-       def_bool y
+       default y
        depends on COMPACTION && MEMORY_BALLOON
        help
          Memory fragmentation introduced by ballooning might reduce
@@ -566,7 +598,7 @@ config BALLOON_COMPACTION
 # support for memory compaction
 config COMPACTION
        bool "Allow for memory compaction"
-       def_bool y
+       default y
        select MIGRATION
        depends on MMU
        help
@@ -579,11 +611,16 @@ config COMPACTION
          it and then we would be really interested to hear about that at
          linux-mm@kvack.org.
 
+config COMPACT_UNEVICTABLE_DEFAULT
+       int
+       depends on COMPACTION
+       default 0 if PREEMPT_RT
+       default 1
+
 #
 # support for free page reporting
 config PAGE_REPORTING
        bool "Free page reporting"
-       def_bool n
        help
          Free page reporting allows for the incremental acquisition of
          free pages from the buddy allocator for the purpose of reporting
@@ -595,7 +632,7 @@ config PAGE_REPORTING
 #
 config MIGRATION
        bool "Page migration"
-       def_bool y
+       default y
        depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
        help
          Allows the migration of the physical location of pages of processes
@@ -621,12 +658,23 @@ config HUGETLB_PAGE_SIZE_VARIABLE
          HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
          on a platform.
 
-         Note that the pageblock_order cannot exceed MAX_ORDER - 1 and will be
-         clamped down to MAX_ORDER - 1.
+         Note that the pageblock_order cannot exceed MAX_PAGE_ORDER and will be
+         clamped down to MAX_PAGE_ORDER.
 
 config CONTIG_ALLOC
        def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
 
+config PCP_BATCH_SCALE_MAX
+       int "Maximum scale factor of PCP (Per-CPU pageset) batch allocate/free"
+       default 5
+       range 0 6
+       help
+         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.
+
 config PHYS_ADDR_T_64BIT
        def_bool 64BIT
 
@@ -641,7 +689,6 @@ config BOUNCE
 
 config MMU_NOTIFIER
        bool
-       select SRCU
        select INTERVAL_TREE
 
 config KSM
@@ -668,7 +715,7 @@ config DEFAULT_MMAP_MIN_ADDR
          from userspace allocation.  Keeping a user from writing to low pages
          can help reduce the impact of kernel NULL pointer bugs.
 
-         For most ia64, ppc64 and x86 users with lots of address space
+         For most 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
@@ -771,11 +818,17 @@ choice
          madvise(MADV_HUGEPAGE) but it won't risk to increase the
          memory footprint of applications without a guaranteed
          benefit.
+
+       config TRANSPARENT_HUGEPAGE_NEVER
+               bool "never"
+       help
+         Disable Transparent Hugepage by default. It can still be
+         enabled at runtime via sysfs.
 endchoice
 
 config THP_SWAP
        def_bool y
-       depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP
+       depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT
        help
          Swap transparent huge pages in one piece, without splitting.
          XXX: For now, swap cluster backing transparent huge page
@@ -816,9 +869,6 @@ config USE_PERCPU_NUMA_NODE_ID
 config HAVE_SETUP_PER_CPU_AREA
        bool
 
-config FRONTSWAP
-       bool
-
 config CMA
        bool "Contiguous Memory Allocator"
        depends on MMU
@@ -834,15 +884,6 @@ config CMA
 
          If unsure, say "n".
 
-config CMA_DEBUG
-       bool "CMA debug messages (DEVELOPMENT)"
-       depends on DEBUG_KERNEL && CMA
-       help
-         Turns on debug messages in CMA.  This produces KERN_DEBUG
-         messages for every CMA call as well as various messages while
-         processing calls such as dma_alloc_from_contiguous().
-         This option does not affect warning and error messages.
-
 config CMA_DEBUGFS
        bool "CMA debugfs interface"
        depends on CMA && DEBUG_FS
@@ -859,14 +900,14 @@ config CMA_SYSFS
 config CMA_AREAS
        int "Maximum count of the CMA areas"
        depends on CMA
-       default 19 if NUMA
-       default 7
+       default 20 if NUMA
+       default 8
        help
          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 "7" in UMA and "19" in NUMA.
+         If unsure, leave the default value "8" in UMA and "20" in NUMA.
 
 config MEM_SOFT_DIRTY
        bool "Track memory changes"
@@ -931,6 +972,12 @@ config IDLE_PAGE_TRACKING
          See Documentation/admin-guide/mm/idle_page_tracking.rst for
          more details.
 
+# Architectures which implement cpu_dcache_is_aliasing() to query
+# whether the data caches are aliased (VIVT or VIPT with dcache
+# aliasing) need to select this.
+config ARCH_HAS_CPU_CACHE_ALIASING
+       bool
+
 config ARCH_HAS_CACHE_LINE_SIZE
        bool
 
@@ -983,9 +1030,14 @@ config HMM_MIRROR
        bool
        depends on MMU
 
+config GET_FREE_REGION
+       depends on SPARSEMEM
+       bool
+
 config DEVICE_PRIVATE
        bool "Unaddressable device memory (GPU memory, ...)"
        depends on ZONE_DEVICE
+       select GET_FREE_REGION
 
        help
          Allows creation of struct pages to represent unaddressable device
@@ -1000,6 +1052,14 @@ config ARCH_USES_HIGH_VMA_FLAGS
 config ARCH_HAS_PKEYS
        bool
 
+config ARCH_USES_PG_ARCH_X
+       bool
+       help
+         Enable the definition of PG_arch_x page flags with x > 1. Only
+         suitable for 64-bit architectures with CONFIG_FLATMEM or
+         CONFIG_SPARSEMEM_VMEMMAP enabled, otherwise there may not be
+         enough room for additional bits in page->flags.
+
 config VM_EVENT_COUNTERS
        default y
        bool "Enable VM event counters for /proc/vmstat" if EXPERT
@@ -1034,14 +1094,23 @@ config GUP_TEST
          pin_user_pages*(), or pinned via get_user_pages*(), as specified
          by other command line arguments.
 
-         See tools/testing/selftests/vm/gup_test.c
+         See tools/testing/selftests/mm/gup_test.c
 
 comment "GUP_TEST needs to have DEBUG_FS enabled"
        depends on !GUP_TEST && !DEBUG_FS
 
-config GUP_GET_PTE_LOW_HIGH
+config GUP_GET_PXX_LOW_HIGH
        bool
 
+config DMAPOOL_TEST
+       tristate "Enable a module to run time tests on dma_pool"
+       depends on HAS_DMA
+       help
+         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.
+
 config ARCH_HAS_PTE_SPECIAL
        bool
 
@@ -1068,8 +1137,17 @@ config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
 config IO_MAPPING
        bool
 
+config MEMFD_CREATE
+       bool "Enable memfd_create() system call" if EXPERT
+
 config SECRETMEM
-       def_bool ARCH_HAS_SET_DIRECT_MAP && !EMBEDDED
+       default y
+       bool "Enable memfd_secret() system call" if EXPERT
+       depends on ARCH_HAS_SET_DIRECT_MAP
+       help
+         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.
 
 config ANON_VMA_NAME
        bool "Anonymous VMA name support"
@@ -1085,13 +1163,6 @@ config ANON_VMA_NAME
          area from being merged with adjacent virtual memory areas due to the
          difference in their name.
 
-config USERFAULTFD
-       bool "Enable userfaultfd() system call"
-       depends on MMU
-       help
-         Enable the userfaultfd() system call that allows to intercept and
-         handle page faults in userland.
-
 config HAVE_ARCH_USERFAULTFD_WP
        bool
        help
@@ -1102,22 +1173,73 @@ config HAVE_ARCH_USERFAULTFD_MINOR
        help
          Arch has userfaultfd minor fault support
 
-config PTE_MARKER
-       bool
-
+menuconfig USERFAULTFD
+       bool "Enable userfaultfd() system call"
+       depends on MMU
        help
-         Allows to create marker PTEs for file-backed memory.
+         Enable the userfaultfd() system call that allows to intercept and
+         handle page faults in userland.
 
+if USERFAULTFD
 config PTE_MARKER_UFFD_WP
        bool "Userfaultfd write protection support for shmem/hugetlbfs"
        default y
        depends on HAVE_ARCH_USERFAULTFD_WP
-       select PTE_MARKER
 
        help
          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.
+endif # USERFAULTFD
+
+# multi-gen LRU {
+config LRU_GEN
+       bool "Multi-Gen LRU"
+       depends on MMU
+       # make sure folio->flags has enough spare bits
+       depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
+       help
+         A high performance LRU implementation to overcommit memory. See
+         Documentation/admin-guide/mm/multigen_lru.rst for details.
+
+config LRU_GEN_ENABLED
+       bool "Enable by default"
+       depends on LRU_GEN
+       help
+         This option enables the multi-gen LRU by default.
+
+config LRU_GEN_STATS
+       bool "Full stats for debugging"
+       depends on LRU_GEN
+       help
+         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
+       def_bool y
+       depends on LRU_GEN && ARCH_HAS_HW_PTE_YOUNG
+# }
+
+config ARCH_SUPPORTS_PER_VMA_LOCK
+       def_bool n
+
+config PER_VMA_LOCK
+       def_bool y
+       depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP
+       help
+         Allow per-vma locking during page fault handling.
+
+         This feature allows locking each virtual memory area separately when
+         handling page faults instead of taking mmap_lock.
+
+config LOCK_MM_AND_FIND_VMA
+       bool
+       depends on !STACK_GROWSUP
+
+config IOMMU_MM_DATA
+       bool
 
 source "mm/damon/Kconfig"