162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci
362306a36Sopenharmony_cimenu "Memory Management options"
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#
662306a36Sopenharmony_ci# For some reason microblaze and nios2 hard code SWAP=n.  Hopefully we can
762306a36Sopenharmony_ci# add proper SWAP support to them, in which case this can be remove.
862306a36Sopenharmony_ci#
962306a36Sopenharmony_ciconfig ARCH_NO_SWAP
1062306a36Sopenharmony_ci	bool
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciconfig ZPOOL
1362306a36Sopenharmony_ci	bool
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_cimenuconfig SWAP
1662306a36Sopenharmony_ci	bool "Support for paging of anonymous memory (swap)"
1762306a36Sopenharmony_ci	depends on MMU && BLOCK && !ARCH_NO_SWAP
1862306a36Sopenharmony_ci	default y
1962306a36Sopenharmony_ci	help
2062306a36Sopenharmony_ci	  This option allows you to choose whether you want to have support
2162306a36Sopenharmony_ci	  for so called swap devices or swap files in your kernel that are
2262306a36Sopenharmony_ci	  used to provide more virtual memory than the actual RAM present
2362306a36Sopenharmony_ci	  in your computer.  If unsure say Y.
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciconfig ZSWAP
2662306a36Sopenharmony_ci	bool "Compressed cache for swap pages"
2762306a36Sopenharmony_ci	depends on SWAP
2862306a36Sopenharmony_ci	select CRYPTO
2962306a36Sopenharmony_ci	select ZPOOL
3062306a36Sopenharmony_ci	help
3162306a36Sopenharmony_ci	  A lightweight compressed cache for swap pages.  It takes
3262306a36Sopenharmony_ci	  pages that are in the process of being swapped out and attempts to
3362306a36Sopenharmony_ci	  compress them into a dynamically allocated RAM-based memory pool.
3462306a36Sopenharmony_ci	  This can result in a significant I/O reduction on swap device and,
3562306a36Sopenharmony_ci	  in the case where decompressing from RAM is faster than swap device
3662306a36Sopenharmony_ci	  reads, can also improve workload performance.
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciconfig CMA_REUSE
3962306a36Sopenharmony_ci	bool "CMA reuse feature"
4062306a36Sopenharmony_ci	depends on CMA
4162306a36Sopenharmony_ci	help
4262306a36Sopenharmony_ci	  If enabled, it will add MIGRATE_CMA to pcp lists and movable
4362306a36Sopenharmony_ci	  allocations with __GFP_CMA flag will use cma areas prior to
4462306a36Sopenharmony_ci	  movable areas.
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci	  It improves the utilization ratio of cma areas.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciconfig ZSWAP_DEFAULT_ON
4962306a36Sopenharmony_ci	bool "Enable the compressed cache for swap pages by default"
5062306a36Sopenharmony_ci	depends on ZSWAP
5162306a36Sopenharmony_ci	help
5262306a36Sopenharmony_ci	  If selected, the compressed cache for swap pages will be enabled
5362306a36Sopenharmony_ci	  at boot, otherwise it will be disabled.
5462306a36Sopenharmony_ci
5562306a36Sopenharmony_ci	  The selection made here can be overridden by using the kernel
5662306a36Sopenharmony_ci	  command line 'zswap.enabled=' option.
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciconfig ZSWAP_EXCLUSIVE_LOADS_DEFAULT_ON
5962306a36Sopenharmony_ci	bool "Invalidate zswap entries when pages are loaded"
6062306a36Sopenharmony_ci	depends on ZSWAP
6162306a36Sopenharmony_ci	help
6262306a36Sopenharmony_ci	  If selected, exclusive loads for zswap will be enabled at boot,
6362306a36Sopenharmony_ci	  otherwise it will be disabled.
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci	  If exclusive loads are enabled, when a page is loaded from zswap,
6662306a36Sopenharmony_ci	  the zswap entry is invalidated at once, as opposed to leaving it
6762306a36Sopenharmony_ci	  in zswap until the swap entry is freed.
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci	  This avoids having two copies of the same page in memory
7062306a36Sopenharmony_ci	  (compressed and uncompressed) after faulting in a page from zswap.
7162306a36Sopenharmony_ci	  The cost is that if the page was never dirtied and needs to be
7262306a36Sopenharmony_ci	  swapped out again, it will be re-compressed.
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_cichoice
7562306a36Sopenharmony_ci	prompt "Default compressor"
7662306a36Sopenharmony_ci	depends on ZSWAP
7762306a36Sopenharmony_ci	default ZSWAP_COMPRESSOR_DEFAULT_LZO
7862306a36Sopenharmony_ci	help
7962306a36Sopenharmony_ci	  Selects the default compression algorithm for the compressed cache
8062306a36Sopenharmony_ci	  for swap pages.
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci	  For an overview what kind of performance can be expected from
8362306a36Sopenharmony_ci	  a particular compression algorithm please refer to the benchmarks
8462306a36Sopenharmony_ci	  available at the following LWN page:
8562306a36Sopenharmony_ci	  https://lwn.net/Articles/751795/
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci	  If in doubt, select 'LZO'.
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci	  The selection made here can be overridden by using the kernel
9062306a36Sopenharmony_ci	  command line 'zswap.compressor=' option.
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ciconfig ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
9362306a36Sopenharmony_ci	bool "Deflate"
9462306a36Sopenharmony_ci	select CRYPTO_DEFLATE
9562306a36Sopenharmony_ci	help
9662306a36Sopenharmony_ci	  Use the Deflate algorithm as the default compression algorithm.
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ciconfig ZSWAP_COMPRESSOR_DEFAULT_LZO
9962306a36Sopenharmony_ci	bool "LZO"
10062306a36Sopenharmony_ci	select CRYPTO_LZO
10162306a36Sopenharmony_ci	help
10262306a36Sopenharmony_ci	  Use the LZO algorithm as the default compression algorithm.
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ciconfig ZSWAP_COMPRESSOR_DEFAULT_842
10562306a36Sopenharmony_ci	bool "842"
10662306a36Sopenharmony_ci	select CRYPTO_842
10762306a36Sopenharmony_ci	help
10862306a36Sopenharmony_ci	  Use the 842 algorithm as the default compression algorithm.
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ciconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4
11162306a36Sopenharmony_ci	bool "LZ4"
11262306a36Sopenharmony_ci	select CRYPTO_LZ4
11362306a36Sopenharmony_ci	help
11462306a36Sopenharmony_ci	  Use the LZ4 algorithm as the default compression algorithm.
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ciconfig ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
11762306a36Sopenharmony_ci	bool "LZ4HC"
11862306a36Sopenharmony_ci	select CRYPTO_LZ4HC
11962306a36Sopenharmony_ci	help
12062306a36Sopenharmony_ci	  Use the LZ4HC algorithm as the default compression algorithm.
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ciconfig ZSWAP_COMPRESSOR_DEFAULT_ZSTD
12362306a36Sopenharmony_ci	bool "zstd"
12462306a36Sopenharmony_ci	select CRYPTO_ZSTD
12562306a36Sopenharmony_ci	help
12662306a36Sopenharmony_ci	  Use the zstd algorithm as the default compression algorithm.
12762306a36Sopenharmony_ciendchoice
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ciconfig ZSWAP_COMPRESSOR_DEFAULT
13062306a36Sopenharmony_ci       string
13162306a36Sopenharmony_ci       depends on ZSWAP
13262306a36Sopenharmony_ci       default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
13362306a36Sopenharmony_ci       default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
13462306a36Sopenharmony_ci       default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
13562306a36Sopenharmony_ci       default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
13662306a36Sopenharmony_ci       default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
13762306a36Sopenharmony_ci       default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
13862306a36Sopenharmony_ci       default ""
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_cichoice
14162306a36Sopenharmony_ci	prompt "Default allocator"
14262306a36Sopenharmony_ci	depends on ZSWAP
14362306a36Sopenharmony_ci	default ZSWAP_ZPOOL_DEFAULT_ZBUD
14462306a36Sopenharmony_ci	help
14562306a36Sopenharmony_ci	  Selects the default allocator for the compressed cache for
14662306a36Sopenharmony_ci	  swap pages.
14762306a36Sopenharmony_ci	  The default is 'zbud' for compatibility, however please do
14862306a36Sopenharmony_ci	  read the description of each of the allocators below before
14962306a36Sopenharmony_ci	  making a right choice.
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci	  The selection made here can be overridden by using the kernel
15262306a36Sopenharmony_ci	  command line 'zswap.zpool=' option.
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ciconfig ZSWAP_ZPOOL_DEFAULT_ZBUD
15562306a36Sopenharmony_ci	bool "zbud"
15662306a36Sopenharmony_ci	select ZBUD
15762306a36Sopenharmony_ci	help
15862306a36Sopenharmony_ci	  Use the zbud allocator as the default allocator.
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ciconfig ZSWAP_ZPOOL_DEFAULT_Z3FOLD
16162306a36Sopenharmony_ci	bool "z3fold"
16262306a36Sopenharmony_ci	select Z3FOLD
16362306a36Sopenharmony_ci	help
16462306a36Sopenharmony_ci	  Use the z3fold allocator as the default allocator.
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ciconfig ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
16762306a36Sopenharmony_ci	bool "zsmalloc"
16862306a36Sopenharmony_ci	select ZSMALLOC
16962306a36Sopenharmony_ci	help
17062306a36Sopenharmony_ci	  Use the zsmalloc allocator as the default allocator.
17162306a36Sopenharmony_ciendchoice
17262306a36Sopenharmony_ci
17362306a36Sopenharmony_ciconfig ZSWAP_ZPOOL_DEFAULT
17462306a36Sopenharmony_ci       string
17562306a36Sopenharmony_ci       depends on ZSWAP
17662306a36Sopenharmony_ci       default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD
17762306a36Sopenharmony_ci       default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD
17862306a36Sopenharmony_ci       default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
17962306a36Sopenharmony_ci       default ""
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ciconfig ZBUD
18262306a36Sopenharmony_ci	tristate "2:1 compression allocator (zbud)"
18362306a36Sopenharmony_ci	depends on ZSWAP
18462306a36Sopenharmony_ci	help
18562306a36Sopenharmony_ci	  A special purpose allocator for storing compressed pages.
18662306a36Sopenharmony_ci	  It is designed to store up to two compressed pages per physical
18762306a36Sopenharmony_ci	  page.  While this design limits storage density, it has simple and
18862306a36Sopenharmony_ci	  deterministic reclaim properties that make it preferable to a higher
18962306a36Sopenharmony_ci	  density approach when reclaim will be used.
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ciconfig Z3FOLD
19262306a36Sopenharmony_ci	tristate "3:1 compression allocator (z3fold)"
19362306a36Sopenharmony_ci	depends on ZSWAP
19462306a36Sopenharmony_ci	help
19562306a36Sopenharmony_ci	  A special purpose allocator for storing compressed pages.
19662306a36Sopenharmony_ci	  It is designed to store up to three compressed pages per physical
19762306a36Sopenharmony_ci	  page. It is a ZBUD derivative so the simplicity and determinism are
19862306a36Sopenharmony_ci	  still there.
19962306a36Sopenharmony_ci
20062306a36Sopenharmony_ciconfig ZSMALLOC
20162306a36Sopenharmony_ci	tristate
20262306a36Sopenharmony_ci	prompt "N:1 compression allocator (zsmalloc)" if ZSWAP
20362306a36Sopenharmony_ci	depends on MMU
20462306a36Sopenharmony_ci	help
20562306a36Sopenharmony_ci	  zsmalloc is a slab-based memory allocator designed to store
20662306a36Sopenharmony_ci	  pages of various compression levels efficiently. It achieves
20762306a36Sopenharmony_ci	  the highest storage density with the least amount of fragmentation.
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ciconfig ZSMALLOC_STAT
21062306a36Sopenharmony_ci	bool "Export zsmalloc statistics"
21162306a36Sopenharmony_ci	depends on ZSMALLOC
21262306a36Sopenharmony_ci	select DEBUG_FS
21362306a36Sopenharmony_ci	help
21462306a36Sopenharmony_ci	  This option enables code in the zsmalloc to collect various
21562306a36Sopenharmony_ci	  statistics about what's happening in zsmalloc and exports that
21662306a36Sopenharmony_ci	  information to userspace via debugfs.
21762306a36Sopenharmony_ci	  If unsure, say N.
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ciconfig ZSMALLOC_CHAIN_SIZE
22062306a36Sopenharmony_ci	int "Maximum number of physical pages per-zspage"
22162306a36Sopenharmony_ci	default 8
22262306a36Sopenharmony_ci	range 4 16
22362306a36Sopenharmony_ci	depends on ZSMALLOC
22462306a36Sopenharmony_ci	help
22562306a36Sopenharmony_ci	  This option sets the upper limit on the number of physical pages
22662306a36Sopenharmony_ci	  that a zmalloc page (zspage) can consist of. The optimal zspage
22762306a36Sopenharmony_ci	  chain size is calculated for each size class during the
22862306a36Sopenharmony_ci	  initialization of the pool.
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ci	  Changing this option can alter the characteristics of size classes,
23162306a36Sopenharmony_ci	  such as the number of pages per zspage and the number of objects
23262306a36Sopenharmony_ci	  per zspage. This can also result in different configurations of
23362306a36Sopenharmony_ci	  the pool, as zsmalloc merges size classes with similar
23462306a36Sopenharmony_ci	  characteristics.
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci	  For more information, see zsmalloc documentation.
23762306a36Sopenharmony_ci
23862306a36Sopenharmony_cimenu "SLAB allocator options"
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_cichoice
24162306a36Sopenharmony_ci	prompt "Choose SLAB allocator"
24262306a36Sopenharmony_ci	default SLUB
24362306a36Sopenharmony_ci	help
24462306a36Sopenharmony_ci	   This option allows to select a slab allocator.
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ciconfig SLAB_DEPRECATED
24762306a36Sopenharmony_ci	bool "SLAB (DEPRECATED)"
24862306a36Sopenharmony_ci	depends on !PREEMPT_RT
24962306a36Sopenharmony_ci	help
25062306a36Sopenharmony_ci	  Deprecated and scheduled for removal in a few cycles. Replaced by
25162306a36Sopenharmony_ci	  SLUB.
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_ci	  If you cannot migrate to SLUB, please contact linux-mm@kvack.org
25462306a36Sopenharmony_ci	  and the people listed in the SLAB ALLOCATOR section of MAINTAINERS
25562306a36Sopenharmony_ci	  file, explaining why.
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_ci	  The regular slab allocator that is established and known to work
25862306a36Sopenharmony_ci	  well in all environments. It organizes cache hot objects in
25962306a36Sopenharmony_ci	  per cpu and per node queues.
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_ciconfig SLUB
26262306a36Sopenharmony_ci	bool "SLUB (Unqueued Allocator)"
26362306a36Sopenharmony_ci	help
26462306a36Sopenharmony_ci	   SLUB is a slab allocator that minimizes cache line usage
26562306a36Sopenharmony_ci	   instead of managing queues of cached objects (SLAB approach).
26662306a36Sopenharmony_ci	   Per cpu caching is realized using slabs of objects instead
26762306a36Sopenharmony_ci	   of queues of objects. SLUB can use memory efficiently
26862306a36Sopenharmony_ci	   and has enhanced diagnostics. SLUB is the default choice for
26962306a36Sopenharmony_ci	   a slab allocator.
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_ciendchoice
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ciconfig SLAB
27462306a36Sopenharmony_ci	bool
27562306a36Sopenharmony_ci	default y
27662306a36Sopenharmony_ci	depends on SLAB_DEPRECATED
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ciconfig SLUB_TINY
27962306a36Sopenharmony_ci	bool "Configure SLUB for minimal memory footprint"
28062306a36Sopenharmony_ci	depends on SLUB && EXPERT
28162306a36Sopenharmony_ci	select SLAB_MERGE_DEFAULT
28262306a36Sopenharmony_ci	help
28362306a36Sopenharmony_ci	   Configures the SLUB allocator in a way to achieve minimal memory
28462306a36Sopenharmony_ci	   footprint, sacrificing scalability, debugging and other features.
28562306a36Sopenharmony_ci	   This is intended only for the smallest system that had used the
28662306a36Sopenharmony_ci	   SLOB allocator and is not recommended for systems with more than
28762306a36Sopenharmony_ci	   16MB RAM.
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci	   If unsure, say N.
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ciconfig SLAB_MERGE_DEFAULT
29262306a36Sopenharmony_ci	bool "Allow slab caches to be merged"
29362306a36Sopenharmony_ci	default y
29462306a36Sopenharmony_ci	depends on SLAB || SLUB
29562306a36Sopenharmony_ci	help
29662306a36Sopenharmony_ci	  For reduced kernel memory fragmentation, slab caches can be
29762306a36Sopenharmony_ci	  merged when they share the same size and other characteristics.
29862306a36Sopenharmony_ci	  This carries a risk of kernel heap overflows being able to
29962306a36Sopenharmony_ci	  overwrite objects from merged caches (and more easily control
30062306a36Sopenharmony_ci	  cache layout), which makes such heap attacks easier to exploit
30162306a36Sopenharmony_ci	  by attackers. By keeping caches unmerged, these kinds of exploits
30262306a36Sopenharmony_ci	  can usually only damage objects in the same cache. To disable
30362306a36Sopenharmony_ci	  merging at runtime, "slab_nomerge" can be passed on the kernel
30462306a36Sopenharmony_ci	  command line.
30562306a36Sopenharmony_ci
30662306a36Sopenharmony_ciconfig SLAB_FREELIST_RANDOM
30762306a36Sopenharmony_ci	bool "Randomize slab freelist"
30862306a36Sopenharmony_ci	depends on SLAB || (SLUB && !SLUB_TINY)
30962306a36Sopenharmony_ci	help
31062306a36Sopenharmony_ci	  Randomizes the freelist order used on creating new pages. This
31162306a36Sopenharmony_ci	  security feature reduces the predictability of the kernel slab
31262306a36Sopenharmony_ci	  allocator against heap overflows.
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ciconfig SLAB_FREELIST_HARDENED
31562306a36Sopenharmony_ci	bool "Harden slab freelist metadata"
31662306a36Sopenharmony_ci	depends on SLAB || (SLUB && !SLUB_TINY)
31762306a36Sopenharmony_ci	help
31862306a36Sopenharmony_ci	  Many kernel heap attacks try to target slab cache metadata and
31962306a36Sopenharmony_ci	  other infrastructure. This options makes minor performance
32062306a36Sopenharmony_ci	  sacrifices to harden the kernel slab allocator against common
32162306a36Sopenharmony_ci	  freelist exploit methods. Some slab implementations have more
32262306a36Sopenharmony_ci	  sanity-checking than others. This option is most effective with
32362306a36Sopenharmony_ci	  CONFIG_SLUB.
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ciconfig SLUB_STATS
32662306a36Sopenharmony_ci	default n
32762306a36Sopenharmony_ci	bool "Enable SLUB performance statistics"
32862306a36Sopenharmony_ci	depends on SLUB && SYSFS && !SLUB_TINY
32962306a36Sopenharmony_ci	help
33062306a36Sopenharmony_ci	  SLUB statistics are useful to debug SLUBs allocation behavior in
33162306a36Sopenharmony_ci	  order find ways to optimize the allocator. This should never be
33262306a36Sopenharmony_ci	  enabled for production use since keeping statistics slows down
33362306a36Sopenharmony_ci	  the allocator by a few percentage points. The slabinfo command
33462306a36Sopenharmony_ci	  supports the determination of the most active slabs to figure
33562306a36Sopenharmony_ci	  out which slabs are relevant to a particular load.
33662306a36Sopenharmony_ci	  Try running: slabinfo -DA
33762306a36Sopenharmony_ci
33862306a36Sopenharmony_ciconfig SLUB_CPU_PARTIAL
33962306a36Sopenharmony_ci	default y
34062306a36Sopenharmony_ci	depends on SLUB && SMP && !SLUB_TINY
34162306a36Sopenharmony_ci	bool "SLUB per cpu partial cache"
34262306a36Sopenharmony_ci	help
34362306a36Sopenharmony_ci	  Per cpu partial caches accelerate objects allocation and freeing
34462306a36Sopenharmony_ci	  that is local to a processor at the price of more indeterminism
34562306a36Sopenharmony_ci	  in the latency of the free. On overflow these caches will be cleared
34662306a36Sopenharmony_ci	  which requires the taking of locks that may cause latency spikes.
34762306a36Sopenharmony_ci	  Typically one would choose no for a realtime system.
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ciconfig RANDOM_KMALLOC_CACHES
35062306a36Sopenharmony_ci	default n
35162306a36Sopenharmony_ci	depends on SLUB && !SLUB_TINY
35262306a36Sopenharmony_ci	bool "Randomize slab caches for normal kmalloc"
35362306a36Sopenharmony_ci	help
35462306a36Sopenharmony_ci	  A hardening feature that creates multiple copies of slab caches for
35562306a36Sopenharmony_ci	  normal kmalloc allocation and makes kmalloc randomly pick one based
35662306a36Sopenharmony_ci	  on code address, which makes the attackers more difficult to spray
35762306a36Sopenharmony_ci	  vulnerable memory objects on the heap for the purpose of exploiting
35862306a36Sopenharmony_ci	  memory vulnerabilities.
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ci	  Currently the number of copies is set to 16, a reasonably large value
36162306a36Sopenharmony_ci	  that effectively diverges the memory objects allocated for different
36262306a36Sopenharmony_ci	  subsystems or modules into different caches, at the expense of a
36362306a36Sopenharmony_ci	  limited degree of memory and CPU overhead that relates to hardware and
36462306a36Sopenharmony_ci	  system workload.
36562306a36Sopenharmony_ci
36662306a36Sopenharmony_ciendmenu # SLAB allocator options
36762306a36Sopenharmony_ci
36862306a36Sopenharmony_ciconfig SHUFFLE_PAGE_ALLOCATOR
36962306a36Sopenharmony_ci	bool "Page allocator randomization"
37062306a36Sopenharmony_ci	default SLAB_FREELIST_RANDOM && ACPI_NUMA
37162306a36Sopenharmony_ci	help
37262306a36Sopenharmony_ci	  Randomization of the page allocator improves the average
37362306a36Sopenharmony_ci	  utilization of a direct-mapped memory-side-cache. See section
37462306a36Sopenharmony_ci	  5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
37562306a36Sopenharmony_ci	  6.2a specification for an example of how a platform advertises
37662306a36Sopenharmony_ci	  the presence of a memory-side-cache. There are also incidental
37762306a36Sopenharmony_ci	  security benefits as it reduces the predictability of page
37862306a36Sopenharmony_ci	  allocations to compliment SLAB_FREELIST_RANDOM, but the
37962306a36Sopenharmony_ci	  default granularity of shuffling on the MAX_ORDER i.e, 10th
38062306a36Sopenharmony_ci	  order of pages is selected based on cache utilization benefits
38162306a36Sopenharmony_ci	  on x86.
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci	  While the randomization improves cache utilization it may
38462306a36Sopenharmony_ci	  negatively impact workloads on platforms without a cache. For
38562306a36Sopenharmony_ci	  this reason, by default, the randomization is enabled only
38662306a36Sopenharmony_ci	  after runtime detection of a direct-mapped memory-side-cache.
38762306a36Sopenharmony_ci	  Otherwise, the randomization may be force enabled with the
38862306a36Sopenharmony_ci	  'page_alloc.shuffle' kernel command line parameter.
38962306a36Sopenharmony_ci
39062306a36Sopenharmony_ci	  Say Y if unsure.
39162306a36Sopenharmony_ci
39262306a36Sopenharmony_ciconfig COMPAT_BRK
39362306a36Sopenharmony_ci	bool "Disable heap randomization"
39462306a36Sopenharmony_ci	default y
39562306a36Sopenharmony_ci	help
39662306a36Sopenharmony_ci	  Randomizing heap placement makes heap exploits harder, but it
39762306a36Sopenharmony_ci	  also breaks ancient binaries (including anything libc5 based).
39862306a36Sopenharmony_ci	  This option changes the bootup default to heap randomization
39962306a36Sopenharmony_ci	  disabled, and can be overridden at runtime by setting
40062306a36Sopenharmony_ci	  /proc/sys/kernel/randomize_va_space to 2.
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_ci	  On non-ancient distros (post-2000 ones) N is usually a safe choice.
40362306a36Sopenharmony_ci
40462306a36Sopenharmony_ciconfig MMAP_ALLOW_UNINITIALIZED
40562306a36Sopenharmony_ci	bool "Allow mmapped anonymous memory to be uninitialized"
40662306a36Sopenharmony_ci	depends on EXPERT && !MMU
40762306a36Sopenharmony_ci	default n
40862306a36Sopenharmony_ci	help
40962306a36Sopenharmony_ci	  Normally, and according to the Linux spec, anonymous memory obtained
41062306a36Sopenharmony_ci	  from mmap() has its contents cleared before it is passed to
41162306a36Sopenharmony_ci	  userspace.  Enabling this config option allows you to request that
41262306a36Sopenharmony_ci	  mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
41362306a36Sopenharmony_ci	  providing a huge performance boost.  If this option is not enabled,
41462306a36Sopenharmony_ci	  then the flag will be ignored.
41562306a36Sopenharmony_ci
41662306a36Sopenharmony_ci	  This is taken advantage of by uClibc's malloc(), and also by
41762306a36Sopenharmony_ci	  ELF-FDPIC binfmt's brk and stack allocator.
41862306a36Sopenharmony_ci
41962306a36Sopenharmony_ci	  Because of the obvious security issues, this option should only be
42062306a36Sopenharmony_ci	  enabled on embedded devices where you control what is run in
42162306a36Sopenharmony_ci	  userspace.  Since that isn't generally a problem on no-MMU systems,
42262306a36Sopenharmony_ci	  it is normally safe to say Y here.
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
42562306a36Sopenharmony_ci
42662306a36Sopenharmony_ciconfig SELECT_MEMORY_MODEL
42762306a36Sopenharmony_ci	def_bool y
42862306a36Sopenharmony_ci	depends on ARCH_SELECT_MEMORY_MODEL
42962306a36Sopenharmony_ci
43062306a36Sopenharmony_cichoice
43162306a36Sopenharmony_ci	prompt "Memory model"
43262306a36Sopenharmony_ci	depends on SELECT_MEMORY_MODEL
43362306a36Sopenharmony_ci	default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
43462306a36Sopenharmony_ci	default FLATMEM_MANUAL
43562306a36Sopenharmony_ci	help
43662306a36Sopenharmony_ci	  This option allows you to change some of the ways that
43762306a36Sopenharmony_ci	  Linux manages its memory internally. Most users will
43862306a36Sopenharmony_ci	  only have one option here selected by the architecture
43962306a36Sopenharmony_ci	  configuration. This is normal.
44062306a36Sopenharmony_ci
44162306a36Sopenharmony_ciconfig FLATMEM_MANUAL
44262306a36Sopenharmony_ci	bool "Flat Memory"
44362306a36Sopenharmony_ci	depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
44462306a36Sopenharmony_ci	help
44562306a36Sopenharmony_ci	  This option is best suited for non-NUMA systems with
44662306a36Sopenharmony_ci	  flat address space. The FLATMEM is the most efficient
44762306a36Sopenharmony_ci	  system in terms of performance and resource consumption
44862306a36Sopenharmony_ci	  and it is the best option for smaller systems.
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_ci	  For systems that have holes in their physical address
45162306a36Sopenharmony_ci	  spaces and for features like NUMA and memory hotplug,
45262306a36Sopenharmony_ci	  choose "Sparse Memory".
45362306a36Sopenharmony_ci
45462306a36Sopenharmony_ci	  If unsure, choose this option (Flat Memory) over any other.
45562306a36Sopenharmony_ci
45662306a36Sopenharmony_ciconfig SPARSEMEM_MANUAL
45762306a36Sopenharmony_ci	bool "Sparse Memory"
45862306a36Sopenharmony_ci	depends on ARCH_SPARSEMEM_ENABLE
45962306a36Sopenharmony_ci	help
46062306a36Sopenharmony_ci	  This will be the only option for some systems, including
46162306a36Sopenharmony_ci	  memory hot-plug systems.  This is normal.
46262306a36Sopenharmony_ci
46362306a36Sopenharmony_ci	  This option provides efficient support for systems with
46462306a36Sopenharmony_ci	  holes is their physical address space and allows memory
46562306a36Sopenharmony_ci	  hot-plug and hot-remove.
46662306a36Sopenharmony_ci
46762306a36Sopenharmony_ci	  If unsure, choose "Flat Memory" over this option.
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_ciendchoice
47062306a36Sopenharmony_ci
47162306a36Sopenharmony_ciconfig MEMORY_MONITOR
47262306a36Sopenharmony_ci	bool "ENABLE MEMORY_MONITOR"
47362306a36Sopenharmony_ci	depends on PROC_FS
47462306a36Sopenharmony_ci	default n
47562306a36Sopenharmony_ci	help
47662306a36Sopenharmony_ci		MEMORY_MONITOR is a monitor of some memory reclaim method.
47762306a36Sopenharmony_ci		Now, kswapd wake up monitor use it.
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_ciconfig HYPERHOLD_FILE_LRU
48062306a36Sopenharmony_ci	bool "Enable HyperHold FILE LRU"
48162306a36Sopenharmony_ci	depends on HYPERHOLD && MEMCG
48262306a36Sopenharmony_ci	select HYPERHOLD_MEMCG
48362306a36Sopenharmony_ci	default n
48462306a36Sopenharmony_ci	help
48562306a36Sopenharmony_ci	  File-LRU is a mechanism that put file page in global lru list,
48662306a36Sopenharmony_ci	  and anon page in memcg lru list(if MEMCG is enable), what's
48762306a36Sopenharmony_ci	  more, recliam of anonymous pages and file page are separated.
48862306a36Sopenharmony_ci
48962306a36Sopenharmony_ciconfig HYPERHOLD_MEMCG
49062306a36Sopenharmony_ci	bool "Enable Memcg Management in HyperHold"
49162306a36Sopenharmony_ci	depends on HYPERHOLD && MEMCG
49262306a36Sopenharmony_ci	help
49362306a36Sopenharmony_ci	  Add more attributes in memory cgroup, these attribute is used
49462306a36Sopenharmony_ci	  to show information, shrink memory, swapin page and so on.
49562306a36Sopenharmony_ci
49662306a36Sopenharmony_ciconfig HYPERHOLD_ZSWAPD
49762306a36Sopenharmony_ci	bool "Enable zswapd thread to reclaim anon pages in background"
49862306a36Sopenharmony_ci	depends on HYPERHOLD && ZRAM
49962306a36Sopenharmony_ci	default n
50062306a36Sopenharmony_ci	help
50162306a36Sopenharmony_ci	  zswapd is a kernel thread that reclaim anonymous pages in the
50262306a36Sopenharmony_ci	  background. When the use of swap pages reaches the watermark
50362306a36Sopenharmony_ci	  and the refault of anonymous pages is high, the content of
50462306a36Sopenharmony_ci	  zram will exchanged to eswap by a certain percentage.
50562306a36Sopenharmony_ci
50662306a36Sopenharmony_ciconfig SPARSEMEM
50762306a36Sopenharmony_ci	def_bool y
50862306a36Sopenharmony_ci	depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
50962306a36Sopenharmony_ci
51062306a36Sopenharmony_ciconfig FLATMEM
51162306a36Sopenharmony_ci	def_bool y
51262306a36Sopenharmony_ci	depends on !SPARSEMEM || FLATMEM_MANUAL
51362306a36Sopenharmony_ci
51462306a36Sopenharmony_ci#
51562306a36Sopenharmony_ci# SPARSEMEM_EXTREME (which is the default) does some bootmem
51662306a36Sopenharmony_ci# allocations when sparse_init() is called.  If this cannot
51762306a36Sopenharmony_ci# be done on your architecture, select this option.  However,
51862306a36Sopenharmony_ci# statically allocating the mem_section[] array can potentially
51962306a36Sopenharmony_ci# consume vast quantities of .bss, so be careful.
52062306a36Sopenharmony_ci#
52162306a36Sopenharmony_ci# This option will also potentially produce smaller runtime code
52262306a36Sopenharmony_ci# with gcc 3.4 and later.
52362306a36Sopenharmony_ci#
52462306a36Sopenharmony_ciconfig SPARSEMEM_STATIC
52562306a36Sopenharmony_ci	bool
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_ci#
52862306a36Sopenharmony_ci# Architecture platforms which require a two level mem_section in SPARSEMEM
52962306a36Sopenharmony_ci# must select this option. This is usually for architecture platforms with
53062306a36Sopenharmony_ci# an extremely sparse physical address space.
53162306a36Sopenharmony_ci#
53262306a36Sopenharmony_ciconfig SPARSEMEM_EXTREME
53362306a36Sopenharmony_ci	def_bool y
53462306a36Sopenharmony_ci	depends on SPARSEMEM && !SPARSEMEM_STATIC
53562306a36Sopenharmony_ci
53662306a36Sopenharmony_ciconfig SPARSEMEM_VMEMMAP_ENABLE
53762306a36Sopenharmony_ci	bool
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_ciconfig SPARSEMEM_VMEMMAP
54062306a36Sopenharmony_ci	bool "Sparse Memory virtual memmap"
54162306a36Sopenharmony_ci	depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
54262306a36Sopenharmony_ci	default y
54362306a36Sopenharmony_ci	help
54462306a36Sopenharmony_ci	  SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
54562306a36Sopenharmony_ci	  pfn_to_page and page_to_pfn operations.  This is the most
54662306a36Sopenharmony_ci	  efficient option when sufficient kernel resources are available.
54762306a36Sopenharmony_ci#
54862306a36Sopenharmony_ci# Select this config option from the architecture Kconfig, if it is preferred
54962306a36Sopenharmony_ci# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
55062306a36Sopenharmony_ci#
55162306a36Sopenharmony_ciconfig ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
55262306a36Sopenharmony_ci	bool
55362306a36Sopenharmony_ci
55462306a36Sopenharmony_ciconfig ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
55562306a36Sopenharmony_ci	bool
55662306a36Sopenharmony_ci
55762306a36Sopenharmony_ciconfig HAVE_MEMBLOCK_PHYS_MAP
55862306a36Sopenharmony_ci	bool
55962306a36Sopenharmony_ci
56062306a36Sopenharmony_ciconfig HAVE_FAST_GUP
56162306a36Sopenharmony_ci	depends on MMU
56262306a36Sopenharmony_ci	bool
56362306a36Sopenharmony_ci
56462306a36Sopenharmony_ci# Don't discard allocated memory used to track "memory" and "reserved" memblocks
56562306a36Sopenharmony_ci# after early boot, so it can still be used to test for validity of memory.
56662306a36Sopenharmony_ci# Also, memblocks are updated with memory hot(un)plug.
56762306a36Sopenharmony_ciconfig ARCH_KEEP_MEMBLOCK
56862306a36Sopenharmony_ci	bool
56962306a36Sopenharmony_ci
57062306a36Sopenharmony_ci# Keep arch NUMA mapping infrastructure post-init.
57162306a36Sopenharmony_ciconfig NUMA_KEEP_MEMINFO
57262306a36Sopenharmony_ci	bool
57362306a36Sopenharmony_ci
57462306a36Sopenharmony_ciconfig MEMORY_ISOLATION
57562306a36Sopenharmony_ci	bool
57662306a36Sopenharmony_ci
57762306a36Sopenharmony_ci# IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked
57862306a36Sopenharmony_ci# IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via
57962306a36Sopenharmony_ci# /dev/mem.
58062306a36Sopenharmony_ciconfig EXCLUSIVE_SYSTEM_RAM
58162306a36Sopenharmony_ci	def_bool y
58262306a36Sopenharmony_ci	depends on !DEVMEM || STRICT_DEVMEM
58362306a36Sopenharmony_ci
58462306a36Sopenharmony_ci#
58562306a36Sopenharmony_ci# Only be set on architectures that have completely implemented memory hotplug
58662306a36Sopenharmony_ci# feature. If you are not sure, don't touch it.
58762306a36Sopenharmony_ci#
58862306a36Sopenharmony_ciconfig HAVE_BOOTMEM_INFO_NODE
58962306a36Sopenharmony_ci	def_bool n
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ciconfig ARCH_ENABLE_MEMORY_HOTPLUG
59262306a36Sopenharmony_ci	bool
59362306a36Sopenharmony_ci
59462306a36Sopenharmony_ciconfig ARCH_ENABLE_MEMORY_HOTREMOVE
59562306a36Sopenharmony_ci	bool
59662306a36Sopenharmony_ci
59762306a36Sopenharmony_ci# eventually, we can have this option just 'select SPARSEMEM'
59862306a36Sopenharmony_cimenuconfig MEMORY_HOTPLUG
59962306a36Sopenharmony_ci	bool "Memory hotplug"
60062306a36Sopenharmony_ci	select MEMORY_ISOLATION
60162306a36Sopenharmony_ci	depends on SPARSEMEM
60262306a36Sopenharmony_ci	depends on ARCH_ENABLE_MEMORY_HOTPLUG
60362306a36Sopenharmony_ci	depends on 64BIT
60462306a36Sopenharmony_ci	select NUMA_KEEP_MEMINFO if NUMA
60562306a36Sopenharmony_ci
60662306a36Sopenharmony_ciif MEMORY_HOTPLUG
60762306a36Sopenharmony_ci
60862306a36Sopenharmony_ciconfig MEMORY_HOTPLUG_DEFAULT_ONLINE
60962306a36Sopenharmony_ci	bool "Online the newly added memory blocks by default"
61062306a36Sopenharmony_ci	depends on MEMORY_HOTPLUG
61162306a36Sopenharmony_ci	help
61262306a36Sopenharmony_ci	  This option sets the default policy setting for memory hotplug
61362306a36Sopenharmony_ci	  onlining policy (/sys/devices/system/memory/auto_online_blocks) which
61462306a36Sopenharmony_ci	  determines what happens to newly added memory regions. Policy setting
61562306a36Sopenharmony_ci	  can always be changed at runtime.
61662306a36Sopenharmony_ci	  See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
61762306a36Sopenharmony_ci
61862306a36Sopenharmony_ci	  Say Y here if you want all hot-plugged memory blocks to appear in
61962306a36Sopenharmony_ci	  'online' state by default.
62062306a36Sopenharmony_ci	  Say N here if you want the default policy to keep all hot-plugged
62162306a36Sopenharmony_ci	  memory blocks in 'offline' state.
62262306a36Sopenharmony_ci
62362306a36Sopenharmony_ciconfig MEMORY_HOTREMOVE
62462306a36Sopenharmony_ci	bool "Allow for memory hot remove"
62562306a36Sopenharmony_ci	select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
62662306a36Sopenharmony_ci	depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
62762306a36Sopenharmony_ci	depends on MIGRATION
62862306a36Sopenharmony_ci
62962306a36Sopenharmony_ciconfig MHP_MEMMAP_ON_MEMORY
63062306a36Sopenharmony_ci	def_bool y
63162306a36Sopenharmony_ci	depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
63262306a36Sopenharmony_ci	depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
63362306a36Sopenharmony_ci
63462306a36Sopenharmony_ciendif # MEMORY_HOTPLUG
63562306a36Sopenharmony_ci
63662306a36Sopenharmony_ciconfig ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
63762306a36Sopenharmony_ci       bool
63862306a36Sopenharmony_ci
63962306a36Sopenharmony_ci# Heavily threaded applications may benefit from splitting the mm-wide
64062306a36Sopenharmony_ci# page_table_lock, so that faults on different parts of the user address
64162306a36Sopenharmony_ci# space can be handled with less contention: split it at this NR_CPUS.
64262306a36Sopenharmony_ci# Default to 4 for wider testing, though 8 might be more appropriate.
64362306a36Sopenharmony_ci# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
64462306a36Sopenharmony_ci# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
64562306a36Sopenharmony_ci# SPARC32 allocates multiple pte tables within a single page, and therefore
64662306a36Sopenharmony_ci# a per-page lock leads to problems when multiple tables need to be locked
64762306a36Sopenharmony_ci# at the same time (e.g. copy_page_range()).
64862306a36Sopenharmony_ci# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
64962306a36Sopenharmony_ci#
65062306a36Sopenharmony_ciconfig SPLIT_PTLOCK_CPUS
65162306a36Sopenharmony_ci	int
65262306a36Sopenharmony_ci	default "999999" if !MMU
65362306a36Sopenharmony_ci	default "999999" if ARM && !CPU_CACHE_VIPT
65462306a36Sopenharmony_ci	default "999999" if PARISC && !PA20
65562306a36Sopenharmony_ci	default "999999" if SPARC32
65662306a36Sopenharmony_ci	default "4"
65762306a36Sopenharmony_ci
65862306a36Sopenharmony_ciconfig ARCH_ENABLE_SPLIT_PMD_PTLOCK
65962306a36Sopenharmony_ci	bool
66062306a36Sopenharmony_ci
66162306a36Sopenharmony_ci#
66262306a36Sopenharmony_ci# support for memory balloon
66362306a36Sopenharmony_ciconfig MEMORY_BALLOON
66462306a36Sopenharmony_ci	bool
66562306a36Sopenharmony_ci
66662306a36Sopenharmony_ci#
66762306a36Sopenharmony_ci# support for memory balloon compaction
66862306a36Sopenharmony_ciconfig BALLOON_COMPACTION
66962306a36Sopenharmony_ci	bool "Allow for balloon memory compaction/migration"
67062306a36Sopenharmony_ci	def_bool y
67162306a36Sopenharmony_ci	depends on COMPACTION && MEMORY_BALLOON
67262306a36Sopenharmony_ci	help
67362306a36Sopenharmony_ci	  Memory fragmentation introduced by ballooning might reduce
67462306a36Sopenharmony_ci	  significantly the number of 2MB contiguous memory blocks that can be
67562306a36Sopenharmony_ci	  used within a guest, thus imposing performance penalties associated
67662306a36Sopenharmony_ci	  with the reduced number of transparent huge pages that could be used
67762306a36Sopenharmony_ci	  by the guest workload. Allowing the compaction & migration for memory
67862306a36Sopenharmony_ci	  pages enlisted as being part of memory balloon devices avoids the
67962306a36Sopenharmony_ci	  scenario aforementioned and helps improving memory defragmentation.
68062306a36Sopenharmony_ci
68162306a36Sopenharmony_ci#
68262306a36Sopenharmony_ci# support for memory compaction
68362306a36Sopenharmony_ciconfig COMPACTION
68462306a36Sopenharmony_ci	bool "Allow for memory compaction"
68562306a36Sopenharmony_ci	def_bool y
68662306a36Sopenharmony_ci	select MIGRATION
68762306a36Sopenharmony_ci	depends on MMU
68862306a36Sopenharmony_ci	help
68962306a36Sopenharmony_ci	  Compaction is the only memory management component to form
69062306a36Sopenharmony_ci	  high order (larger physically contiguous) memory blocks
69162306a36Sopenharmony_ci	  reliably. The page allocator relies on compaction heavily and
69262306a36Sopenharmony_ci	  the lack of the feature can lead to unexpected OOM killer
69362306a36Sopenharmony_ci	  invocations for high order memory requests. You shouldn't
69462306a36Sopenharmony_ci	  disable this option unless there really is a strong reason for
69562306a36Sopenharmony_ci	  it and then we would be really interested to hear about that at
69662306a36Sopenharmony_ci	  linux-mm@kvack.org.
69762306a36Sopenharmony_ci
69862306a36Sopenharmony_ciconfig COMPACT_UNEVICTABLE_DEFAULT
69962306a36Sopenharmony_ci	int
70062306a36Sopenharmony_ci	depends on COMPACTION
70162306a36Sopenharmony_ci	default 0 if PREEMPT_RT
70262306a36Sopenharmony_ci	default 1
70362306a36Sopenharmony_ci
70462306a36Sopenharmony_ci#
70562306a36Sopenharmony_ci# support for free page reporting
70662306a36Sopenharmony_ciconfig PAGE_REPORTING
70762306a36Sopenharmony_ci	bool "Free page reporting"
70862306a36Sopenharmony_ci	def_bool n
70962306a36Sopenharmony_ci	help
71062306a36Sopenharmony_ci	  Free page reporting allows for the incremental acquisition of
71162306a36Sopenharmony_ci	  free pages from the buddy allocator for the purpose of reporting
71262306a36Sopenharmony_ci	  those pages to another entity, such as a hypervisor, so that the
71362306a36Sopenharmony_ci	  memory can be freed within the host for other uses.
71462306a36Sopenharmony_ci
71562306a36Sopenharmony_ci#
71662306a36Sopenharmony_ci# support for page migration
71762306a36Sopenharmony_ci#
71862306a36Sopenharmony_ciconfig MIGRATION
71962306a36Sopenharmony_ci	bool "Page migration"
72062306a36Sopenharmony_ci	def_bool y
72162306a36Sopenharmony_ci	depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
72262306a36Sopenharmony_ci	help
72362306a36Sopenharmony_ci	  Allows the migration of the physical location of pages of processes
72462306a36Sopenharmony_ci	  while the virtual addresses are not changed. This is useful in
72562306a36Sopenharmony_ci	  two situations. The first is on NUMA systems to put pages nearer
72662306a36Sopenharmony_ci	  to the processors accessing. The second is when allocating huge
72762306a36Sopenharmony_ci	  pages as migration can relocate pages to satisfy a huge page
72862306a36Sopenharmony_ci	  allocation instead of reclaiming.
72962306a36Sopenharmony_ci
73062306a36Sopenharmony_ciconfig DEVICE_MIGRATION
73162306a36Sopenharmony_ci	def_bool MIGRATION && ZONE_DEVICE
73262306a36Sopenharmony_ci
73362306a36Sopenharmony_ciconfig ARCH_ENABLE_HUGEPAGE_MIGRATION
73462306a36Sopenharmony_ci	bool
73562306a36Sopenharmony_ci
73662306a36Sopenharmony_ciconfig ARCH_ENABLE_THP_MIGRATION
73762306a36Sopenharmony_ci	bool
73862306a36Sopenharmony_ci
73962306a36Sopenharmony_ciconfig HUGETLB_PAGE_SIZE_VARIABLE
74062306a36Sopenharmony_ci	def_bool n
74162306a36Sopenharmony_ci	help
74262306a36Sopenharmony_ci	  Allows the pageblock_order value to be dynamic instead of just standard
74362306a36Sopenharmony_ci	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
74462306a36Sopenharmony_ci	  on a platform.
74562306a36Sopenharmony_ci
74662306a36Sopenharmony_ci	  Note that the pageblock_order cannot exceed MAX_ORDER and will be
74762306a36Sopenharmony_ci	  clamped down to MAX_ORDER.
74862306a36Sopenharmony_ci
74962306a36Sopenharmony_ciconfig CONTIG_ALLOC
75062306a36Sopenharmony_ci	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
75162306a36Sopenharmony_ci
75262306a36Sopenharmony_ciconfig PHYS_ADDR_T_64BIT
75362306a36Sopenharmony_ci	def_bool 64BIT
75462306a36Sopenharmony_ci
75562306a36Sopenharmony_ciconfig BOUNCE
75662306a36Sopenharmony_ci	bool "Enable bounce buffers"
75762306a36Sopenharmony_ci	default y
75862306a36Sopenharmony_ci	depends on BLOCK && MMU && HIGHMEM
75962306a36Sopenharmony_ci	help
76062306a36Sopenharmony_ci	  Enable bounce buffers for devices that cannot access the full range of
76162306a36Sopenharmony_ci	  memory available to the CPU. Enabled by default when HIGHMEM is
76262306a36Sopenharmony_ci	  selected, but you may say n to override this.
76362306a36Sopenharmony_ci
76462306a36Sopenharmony_ciconfig MMU_NOTIFIER
76562306a36Sopenharmony_ci	bool
76662306a36Sopenharmony_ci	select INTERVAL_TREE
76762306a36Sopenharmony_ci
76862306a36Sopenharmony_ciconfig KSM
76962306a36Sopenharmony_ci	bool "Enable KSM for page merging"
77062306a36Sopenharmony_ci	depends on MMU
77162306a36Sopenharmony_ci	select XXHASH
77262306a36Sopenharmony_ci	help
77362306a36Sopenharmony_ci	  Enable Kernel Samepage Merging: KSM periodically scans those areas
77462306a36Sopenharmony_ci	  of an application's address space that an app has advised may be
77562306a36Sopenharmony_ci	  mergeable.  When it finds pages of identical content, it replaces
77662306a36Sopenharmony_ci	  the many instances by a single page with that content, so
77762306a36Sopenharmony_ci	  saving memory until one or another app needs to modify the content.
77862306a36Sopenharmony_ci	  Recommended for use with KVM, or with other duplicative applications.
77962306a36Sopenharmony_ci	  See Documentation/mm/ksm.rst for more information: KSM is inactive
78062306a36Sopenharmony_ci	  until a program has madvised that an area is MADV_MERGEABLE, and
78162306a36Sopenharmony_ci	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
78262306a36Sopenharmony_ci
78362306a36Sopenharmony_ciconfig DEFAULT_MMAP_MIN_ADDR
78462306a36Sopenharmony_ci	int "Low address space to protect from user allocation"
78562306a36Sopenharmony_ci	depends on MMU
78662306a36Sopenharmony_ci	default 4096
78762306a36Sopenharmony_ci	help
78862306a36Sopenharmony_ci	  This is the portion of low virtual memory which should be protected
78962306a36Sopenharmony_ci	  from userspace allocation.  Keeping a user from writing to low pages
79062306a36Sopenharmony_ci	  can help reduce the impact of kernel NULL pointer bugs.
79162306a36Sopenharmony_ci
79262306a36Sopenharmony_ci	  For most ia64, ppc64 and x86 users with lots of address space
79362306a36Sopenharmony_ci	  a value of 65536 is reasonable and should cause no problems.
79462306a36Sopenharmony_ci	  On arm and other archs it should not be higher than 32768.
79562306a36Sopenharmony_ci	  Programs which use vm86 functionality or have some need to map
79662306a36Sopenharmony_ci	  this low address space will need CAP_SYS_RAWIO or disable this
79762306a36Sopenharmony_ci	  protection by setting the value to 0.
79862306a36Sopenharmony_ci
79962306a36Sopenharmony_ci	  This value can be changed after boot using the
80062306a36Sopenharmony_ci	  /proc/sys/vm/mmap_min_addr tunable.
80162306a36Sopenharmony_ci
80262306a36Sopenharmony_ciconfig ARCH_SUPPORTS_MEMORY_FAILURE
80362306a36Sopenharmony_ci	bool
80462306a36Sopenharmony_ci
80562306a36Sopenharmony_ciconfig MEMORY_FAILURE
80662306a36Sopenharmony_ci	depends on MMU
80762306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_MEMORY_FAILURE
80862306a36Sopenharmony_ci	bool "Enable recovery from hardware memory errors"
80962306a36Sopenharmony_ci	select MEMORY_ISOLATION
81062306a36Sopenharmony_ci	select RAS
81162306a36Sopenharmony_ci	help
81262306a36Sopenharmony_ci	  Enables code to recover from some memory failures on systems
81362306a36Sopenharmony_ci	  with MCA recovery. This allows a system to continue running
81462306a36Sopenharmony_ci	  even when some of its memory has uncorrected errors. This requires
81562306a36Sopenharmony_ci	  special hardware support and typically ECC memory.
81662306a36Sopenharmony_ci
81762306a36Sopenharmony_ciconfig HWPOISON_INJECT
81862306a36Sopenharmony_ci	tristate "HWPoison pages injector"
81962306a36Sopenharmony_ci	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
82062306a36Sopenharmony_ci	select PROC_PAGE_MONITOR
82162306a36Sopenharmony_ci
82262306a36Sopenharmony_ciconfig NOMMU_INITIAL_TRIM_EXCESS
82362306a36Sopenharmony_ci	int "Turn on mmap() excess space trimming before booting"
82462306a36Sopenharmony_ci	depends on !MMU
82562306a36Sopenharmony_ci	default 1
82662306a36Sopenharmony_ci	help
82762306a36Sopenharmony_ci	  The NOMMU mmap() frequently needs to allocate large contiguous chunks
82862306a36Sopenharmony_ci	  of memory on which to store mappings, but it can only ask the system
82962306a36Sopenharmony_ci	  allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
83062306a36Sopenharmony_ci	  more than it requires.  To deal with this, mmap() is able to trim off
83162306a36Sopenharmony_ci	  the excess and return it to the allocator.
83262306a36Sopenharmony_ci
83362306a36Sopenharmony_ci	  If trimming is enabled, the excess is trimmed off and returned to the
83462306a36Sopenharmony_ci	  system allocator, which can cause extra fragmentation, particularly
83562306a36Sopenharmony_ci	  if there are a lot of transient processes.
83662306a36Sopenharmony_ci
83762306a36Sopenharmony_ci	  If trimming is disabled, the excess is kept, but not used, which for
83862306a36Sopenharmony_ci	  long-term mappings means that the space is wasted.
83962306a36Sopenharmony_ci
84062306a36Sopenharmony_ci	  Trimming can be dynamically controlled through a sysctl option
84162306a36Sopenharmony_ci	  (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
84262306a36Sopenharmony_ci	  excess pages there must be before trimming should occur, or zero if
84362306a36Sopenharmony_ci	  no trimming is to occur.
84462306a36Sopenharmony_ci
84562306a36Sopenharmony_ci	  This option specifies the initial value of this option.  The default
84662306a36Sopenharmony_ci	  of 1 says that all excess pages should be trimmed.
84762306a36Sopenharmony_ci
84862306a36Sopenharmony_ci	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
84962306a36Sopenharmony_ci
85062306a36Sopenharmony_ciconfig ARCH_WANT_GENERAL_HUGETLB
85162306a36Sopenharmony_ci	bool
85262306a36Sopenharmony_ci
85362306a36Sopenharmony_ciconfig ARCH_WANTS_THP_SWAP
85462306a36Sopenharmony_ci	def_bool n
85562306a36Sopenharmony_ci
85662306a36Sopenharmony_cimenuconfig TRANSPARENT_HUGEPAGE
85762306a36Sopenharmony_ci	bool "Transparent Hugepage Support"
85862306a36Sopenharmony_ci	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
85962306a36Sopenharmony_ci	select COMPACTION
86062306a36Sopenharmony_ci	select XARRAY_MULTI
86162306a36Sopenharmony_ci	help
86262306a36Sopenharmony_ci	  Transparent Hugepages allows the kernel to use huge pages and
86362306a36Sopenharmony_ci	  huge tlb transparently to the applications whenever possible.
86462306a36Sopenharmony_ci	  This feature can improve computing performance to certain
86562306a36Sopenharmony_ci	  applications by speeding up page faults during memory
86662306a36Sopenharmony_ci	  allocation, by reducing the number of tlb misses and by speeding
86762306a36Sopenharmony_ci	  up the pagetable walking.
86862306a36Sopenharmony_ci
86962306a36Sopenharmony_ci	  If memory constrained on embedded, you may want to say N.
87062306a36Sopenharmony_ci
87162306a36Sopenharmony_ciif TRANSPARENT_HUGEPAGE
87262306a36Sopenharmony_ci
87362306a36Sopenharmony_cichoice
87462306a36Sopenharmony_ci	prompt "Transparent Hugepage Support sysfs defaults"
87562306a36Sopenharmony_ci	depends on TRANSPARENT_HUGEPAGE
87662306a36Sopenharmony_ci	default TRANSPARENT_HUGEPAGE_ALWAYS
87762306a36Sopenharmony_ci	help
87862306a36Sopenharmony_ci	  Selects the sysfs defaults for Transparent Hugepage Support.
87962306a36Sopenharmony_ci
88062306a36Sopenharmony_ci	config TRANSPARENT_HUGEPAGE_ALWAYS
88162306a36Sopenharmony_ci		bool "always"
88262306a36Sopenharmony_ci	help
88362306a36Sopenharmony_ci	  Enabling Transparent Hugepage always, can increase the
88462306a36Sopenharmony_ci	  memory footprint of applications without a guaranteed
88562306a36Sopenharmony_ci	  benefit but it will work automatically for all applications.
88662306a36Sopenharmony_ci
88762306a36Sopenharmony_ci	config TRANSPARENT_HUGEPAGE_MADVISE
88862306a36Sopenharmony_ci		bool "madvise"
88962306a36Sopenharmony_ci	help
89062306a36Sopenharmony_ci	  Enabling Transparent Hugepage madvise, will only provide a
89162306a36Sopenharmony_ci	  performance improvement benefit to the applications using
89262306a36Sopenharmony_ci	  madvise(MADV_HUGEPAGE) but it won't risk to increase the
89362306a36Sopenharmony_ci	  memory footprint of applications without a guaranteed
89462306a36Sopenharmony_ci	  benefit.
89562306a36Sopenharmony_ciendchoice
89662306a36Sopenharmony_ci
89762306a36Sopenharmony_ciconfig THP_SWAP
89862306a36Sopenharmony_ci	def_bool y
89962306a36Sopenharmony_ci	depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT
90062306a36Sopenharmony_ci	help
90162306a36Sopenharmony_ci	  Swap transparent huge pages in one piece, without splitting.
90262306a36Sopenharmony_ci	  XXX: For now, swap cluster backing transparent huge page
90362306a36Sopenharmony_ci	  will be split after swapout.
90462306a36Sopenharmony_ci
90562306a36Sopenharmony_ci	  For selection by architectures with reasonable THP sizes.
90662306a36Sopenharmony_ci
90762306a36Sopenharmony_ciconfig READ_ONLY_THP_FOR_FS
90862306a36Sopenharmony_ci	bool "Read-only THP for filesystems (EXPERIMENTAL)"
90962306a36Sopenharmony_ci	depends on TRANSPARENT_HUGEPAGE && SHMEM
91062306a36Sopenharmony_ci
91162306a36Sopenharmony_ci	help
91262306a36Sopenharmony_ci	  Allow khugepaged to put read-only file-backed pages in THP.
91362306a36Sopenharmony_ci
91462306a36Sopenharmony_ci	  This is marked experimental because it is a new feature. Write
91562306a36Sopenharmony_ci	  support of file THPs will be developed in the next few release
91662306a36Sopenharmony_ci	  cycles.
91762306a36Sopenharmony_ci
91862306a36Sopenharmony_ciendif # TRANSPARENT_HUGEPAGE
91962306a36Sopenharmony_ci
92062306a36Sopenharmony_ci#
92162306a36Sopenharmony_ci# UP and nommu archs use km based percpu allocator
92262306a36Sopenharmony_ci#
92362306a36Sopenharmony_ciconfig NEED_PER_CPU_KM
92462306a36Sopenharmony_ci	depends on !SMP || !MMU
92562306a36Sopenharmony_ci	bool
92662306a36Sopenharmony_ci	default y
92762306a36Sopenharmony_ci
92862306a36Sopenharmony_ciconfig NEED_PER_CPU_EMBED_FIRST_CHUNK
92962306a36Sopenharmony_ci	bool
93062306a36Sopenharmony_ci
93162306a36Sopenharmony_ciconfig NEED_PER_CPU_PAGE_FIRST_CHUNK
93262306a36Sopenharmony_ci	bool
93362306a36Sopenharmony_ci
93462306a36Sopenharmony_ciconfig USE_PERCPU_NUMA_NODE_ID
93562306a36Sopenharmony_ci	bool
93662306a36Sopenharmony_ci
93762306a36Sopenharmony_ciconfig HAVE_SETUP_PER_CPU_AREA
93862306a36Sopenharmony_ci	bool
93962306a36Sopenharmony_ci
94062306a36Sopenharmony_ciconfig CMA
94162306a36Sopenharmony_ci	bool "Contiguous Memory Allocator"
94262306a36Sopenharmony_ci	depends on MMU
94362306a36Sopenharmony_ci	select MIGRATION
94462306a36Sopenharmony_ci	select MEMORY_ISOLATION
94562306a36Sopenharmony_ci	help
94662306a36Sopenharmony_ci	  This enables the Contiguous Memory Allocator which allows other
94762306a36Sopenharmony_ci	  subsystems to allocate big physically-contiguous blocks of memory.
94862306a36Sopenharmony_ci	  CMA reserves a region of memory and allows only movable pages to
94962306a36Sopenharmony_ci	  be allocated from it. This way, the kernel can use the memory for
95062306a36Sopenharmony_ci	  pagecache and when a subsystem requests for contiguous area, the
95162306a36Sopenharmony_ci	  allocated pages are migrated away to serve the contiguous request.
95262306a36Sopenharmony_ci
95362306a36Sopenharmony_ci	  If unsure, say "n".
95462306a36Sopenharmony_ci
95562306a36Sopenharmony_ciconfig CMA_DEBUG
95662306a36Sopenharmony_ci	bool "CMA debug messages (DEVELOPMENT)"
95762306a36Sopenharmony_ci	depends on DEBUG_KERNEL && CMA
95862306a36Sopenharmony_ci	help
95962306a36Sopenharmony_ci	  Turns on debug messages in CMA.  This produces KERN_DEBUG
96062306a36Sopenharmony_ci	  messages for every CMA call as well as various messages while
96162306a36Sopenharmony_ci	  processing calls such as dma_alloc_from_contiguous().
96262306a36Sopenharmony_ci	  This option does not affect warning and error messages.
96362306a36Sopenharmony_ci
96462306a36Sopenharmony_ciconfig CMA_DEBUGFS
96562306a36Sopenharmony_ci	bool "CMA debugfs interface"
96662306a36Sopenharmony_ci	depends on CMA && DEBUG_FS
96762306a36Sopenharmony_ci	help
96862306a36Sopenharmony_ci	  Turns on the DebugFS interface for CMA.
96962306a36Sopenharmony_ci
97062306a36Sopenharmony_ciconfig CMA_SYSFS
97162306a36Sopenharmony_ci	bool "CMA information through sysfs interface"
97262306a36Sopenharmony_ci	depends on CMA && SYSFS
97362306a36Sopenharmony_ci	help
97462306a36Sopenharmony_ci	  This option exposes some sysfs attributes to get information
97562306a36Sopenharmony_ci	  from CMA.
97662306a36Sopenharmony_ci
97762306a36Sopenharmony_ciconfig CMA_AREAS
97862306a36Sopenharmony_ci	int "Maximum count of the CMA areas"
97962306a36Sopenharmony_ci	depends on CMA
98062306a36Sopenharmony_ci	default 19 if NUMA
98162306a36Sopenharmony_ci	default 7
98262306a36Sopenharmony_ci	help
98362306a36Sopenharmony_ci	  CMA allows to create CMA areas for particular purpose, mainly,
98462306a36Sopenharmony_ci	  used as device private area. This parameter sets the maximum
98562306a36Sopenharmony_ci	  number of CMA area in the system.
98662306a36Sopenharmony_ci
98762306a36Sopenharmony_ci	  If unsure, leave the default value "7" in UMA and "19" in NUMA.
98862306a36Sopenharmony_ci
98962306a36Sopenharmony_ciconfig MEM_SOFT_DIRTY
99062306a36Sopenharmony_ci	bool "Track memory changes"
99162306a36Sopenharmony_ci	depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
99262306a36Sopenharmony_ci	select PROC_PAGE_MONITOR
99362306a36Sopenharmony_ci	help
99462306a36Sopenharmony_ci	  This option enables memory changes tracking by introducing a
99562306a36Sopenharmony_ci	  soft-dirty bit on pte-s. This bit it set when someone writes
99662306a36Sopenharmony_ci	  into a page just as regular dirty bit, but unlike the latter
99762306a36Sopenharmony_ci	  it can be cleared by hands.
99862306a36Sopenharmony_ci
99962306a36Sopenharmony_ci	  See Documentation/admin-guide/mm/soft-dirty.rst for more details.
100062306a36Sopenharmony_ci
100162306a36Sopenharmony_ciconfig GENERIC_EARLY_IOREMAP
100262306a36Sopenharmony_ci	bool
100362306a36Sopenharmony_ci
100462306a36Sopenharmony_ciconfig STACK_MAX_DEFAULT_SIZE_MB
100562306a36Sopenharmony_ci	int "Default maximum user stack size for 32-bit processes (MB)"
100662306a36Sopenharmony_ci	default 100
100762306a36Sopenharmony_ci	range 8 2048
100862306a36Sopenharmony_ci	depends on STACK_GROWSUP && (!64BIT || COMPAT)
100962306a36Sopenharmony_ci	help
101062306a36Sopenharmony_ci	  This is the maximum stack size in Megabytes in the VM layout of 32-bit
101162306a36Sopenharmony_ci	  user processes when the stack grows upwards (currently only on parisc
101262306a36Sopenharmony_ci	  arch) when the RLIMIT_STACK hard limit is unlimited.
101362306a36Sopenharmony_ci
101462306a36Sopenharmony_ci	  A sane initial value is 100 MB.
101562306a36Sopenharmony_ci
101662306a36Sopenharmony_ciconfig DEFERRED_STRUCT_PAGE_INIT
101762306a36Sopenharmony_ci	bool "Defer initialisation of struct pages to kthreads"
101862306a36Sopenharmony_ci	depends on SPARSEMEM
101962306a36Sopenharmony_ci	depends on !NEED_PER_CPU_KM
102062306a36Sopenharmony_ci	depends on 64BIT
102162306a36Sopenharmony_ci	select PADATA
102262306a36Sopenharmony_ci	help
102362306a36Sopenharmony_ci	  Ordinarily all struct pages are initialised during early boot in a
102462306a36Sopenharmony_ci	  single thread. On very large machines this can take a considerable
102562306a36Sopenharmony_ci	  amount of time. If this option is set, large machines will bring up
102662306a36Sopenharmony_ci	  a subset of memmap at boot and then initialise the rest in parallel.
102762306a36Sopenharmony_ci	  This has a potential performance impact on tasks running early in the
102862306a36Sopenharmony_ci	  lifetime of the system until these kthreads finish the
102962306a36Sopenharmony_ci	  initialisation.
103062306a36Sopenharmony_ci
103162306a36Sopenharmony_ciconfig PAGE_IDLE_FLAG
103262306a36Sopenharmony_ci	bool
103362306a36Sopenharmony_ci	select PAGE_EXTENSION if !64BIT
103462306a36Sopenharmony_ci	help
103562306a36Sopenharmony_ci	  This adds PG_idle and PG_young flags to 'struct page'.  PTE Accessed
103662306a36Sopenharmony_ci	  bit writers can set the state of the bit in the flags so that PTE
103762306a36Sopenharmony_ci	  Accessed bit readers may avoid disturbance.
103862306a36Sopenharmony_ci
103962306a36Sopenharmony_ciconfig IDLE_PAGE_TRACKING
104062306a36Sopenharmony_ci	bool "Enable idle page tracking"
104162306a36Sopenharmony_ci	depends on SYSFS && MMU
104262306a36Sopenharmony_ci	select PAGE_IDLE_FLAG
104362306a36Sopenharmony_ci	help
104462306a36Sopenharmony_ci	  This feature allows to estimate the amount of user pages that have
104562306a36Sopenharmony_ci	  not been touched during a given period of time. This information can
104662306a36Sopenharmony_ci	  be useful to tune memory cgroup limits and/or for job placement
104762306a36Sopenharmony_ci	  within a compute cluster.
104862306a36Sopenharmony_ci
104962306a36Sopenharmony_ci	  See Documentation/admin-guide/mm/idle_page_tracking.rst for
105062306a36Sopenharmony_ci	  more details.
105162306a36Sopenharmony_ci
105262306a36Sopenharmony_ciconfig ARCH_HAS_CACHE_LINE_SIZE
105362306a36Sopenharmony_ci	bool
105462306a36Sopenharmony_ci
105562306a36Sopenharmony_ciconfig ARCH_HAS_CURRENT_STACK_POINTER
105662306a36Sopenharmony_ci	bool
105762306a36Sopenharmony_ci	help
105862306a36Sopenharmony_ci	  In support of HARDENED_USERCOPY performing stack variable lifetime
105962306a36Sopenharmony_ci	  checking, an architecture-agnostic way to find the stack pointer
106062306a36Sopenharmony_ci	  is needed. Once an architecture defines an unsigned long global
106162306a36Sopenharmony_ci	  register alias named "current_stack_pointer", this config can be
106262306a36Sopenharmony_ci	  selected.
106362306a36Sopenharmony_ci
106462306a36Sopenharmony_ciconfig ARCH_HAS_PTE_DEVMAP
106562306a36Sopenharmony_ci	bool
106662306a36Sopenharmony_ci
106762306a36Sopenharmony_ciconfig ARCH_HAS_ZONE_DMA_SET
106862306a36Sopenharmony_ci	bool
106962306a36Sopenharmony_ci
107062306a36Sopenharmony_ciconfig ZONE_DMA
107162306a36Sopenharmony_ci	bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
107262306a36Sopenharmony_ci	default y if ARM64 || X86
107362306a36Sopenharmony_ci
107462306a36Sopenharmony_ciconfig ZONE_DMA32
107562306a36Sopenharmony_ci	bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
107662306a36Sopenharmony_ci	depends on !X86_32
107762306a36Sopenharmony_ci	default y if ARM64
107862306a36Sopenharmony_ci
107962306a36Sopenharmony_ciconfig ZONE_DEVICE
108062306a36Sopenharmony_ci	bool "Device memory (pmem, HMM, etc...) hotplug support"
108162306a36Sopenharmony_ci	depends on MEMORY_HOTPLUG
108262306a36Sopenharmony_ci	depends on MEMORY_HOTREMOVE
108362306a36Sopenharmony_ci	depends on SPARSEMEM_VMEMMAP
108462306a36Sopenharmony_ci	depends on ARCH_HAS_PTE_DEVMAP
108562306a36Sopenharmony_ci	select XARRAY_MULTI
108662306a36Sopenharmony_ci
108762306a36Sopenharmony_ci	help
108862306a36Sopenharmony_ci	  Device memory hotplug support allows for establishing pmem,
108962306a36Sopenharmony_ci	  or other device driver discovered memory regions, in the
109062306a36Sopenharmony_ci	  memmap. This allows pfn_to_page() lookups of otherwise
109162306a36Sopenharmony_ci	  "device-physical" addresses which is needed for using a DAX
109262306a36Sopenharmony_ci	  mapping in an O_DIRECT operation, among other things.
109362306a36Sopenharmony_ci
109462306a36Sopenharmony_ci	  If FS_DAX is enabled, then say Y.
109562306a36Sopenharmony_ci
109662306a36Sopenharmony_ci#
109762306a36Sopenharmony_ci# Helpers to mirror range of the CPU page tables of a process into device page
109862306a36Sopenharmony_ci# tables.
109962306a36Sopenharmony_ci#
110062306a36Sopenharmony_ciconfig HMM_MIRROR
110162306a36Sopenharmony_ci	bool
110262306a36Sopenharmony_ci	depends on MMU
110362306a36Sopenharmony_ci
110462306a36Sopenharmony_ciconfig GET_FREE_REGION
110562306a36Sopenharmony_ci	depends on SPARSEMEM
110662306a36Sopenharmony_ci	bool
110762306a36Sopenharmony_ci
110862306a36Sopenharmony_ciconfig DEVICE_PRIVATE
110962306a36Sopenharmony_ci	bool "Unaddressable device memory (GPU memory, ...)"
111062306a36Sopenharmony_ci	depends on ZONE_DEVICE
111162306a36Sopenharmony_ci	select GET_FREE_REGION
111262306a36Sopenharmony_ci
111362306a36Sopenharmony_ci	help
111462306a36Sopenharmony_ci	  Allows creation of struct pages to represent unaddressable device
111562306a36Sopenharmony_ci	  memory; i.e., memory that is only accessible from the device (or
111662306a36Sopenharmony_ci	  group of devices). You likely also want to select HMM_MIRROR.
111762306a36Sopenharmony_ci
111862306a36Sopenharmony_ciconfig VMAP_PFN
111962306a36Sopenharmony_ci	bool
112062306a36Sopenharmony_ci
112162306a36Sopenharmony_ciconfig ARCH_USES_HIGH_VMA_FLAGS
112262306a36Sopenharmony_ci	bool
112362306a36Sopenharmony_ciconfig ARCH_HAS_PKEYS
112462306a36Sopenharmony_ci	bool
112562306a36Sopenharmony_ci
112662306a36Sopenharmony_ciconfig ARCH_USES_PG_ARCH_X
112762306a36Sopenharmony_ci	bool
112862306a36Sopenharmony_ci	help
112962306a36Sopenharmony_ci	  Enable the definition of PG_arch_x page flags with x > 1. Only
113062306a36Sopenharmony_ci	  suitable for 64-bit architectures with CONFIG_FLATMEM or
113162306a36Sopenharmony_ci	  CONFIG_SPARSEMEM_VMEMMAP enabled, otherwise there may not be
113262306a36Sopenharmony_ci	  enough room for additional bits in page->flags.
113362306a36Sopenharmony_ci
113462306a36Sopenharmony_ciconfig VM_EVENT_COUNTERS
113562306a36Sopenharmony_ci	default y
113662306a36Sopenharmony_ci	bool "Enable VM event counters for /proc/vmstat" if EXPERT
113762306a36Sopenharmony_ci	help
113862306a36Sopenharmony_ci	  VM event counters are needed for event counts to be shown.
113962306a36Sopenharmony_ci	  This option allows the disabling of the VM event counters
114062306a36Sopenharmony_ci	  on EXPERT systems.  /proc/vmstat will only show page counts
114162306a36Sopenharmony_ci	  if VM event counters are disabled.
114262306a36Sopenharmony_ci
114362306a36Sopenharmony_ciconfig PERCPU_STATS
114462306a36Sopenharmony_ci	bool "Collect percpu memory statistics"
114562306a36Sopenharmony_ci	help
114662306a36Sopenharmony_ci	  This feature collects and exposes statistics via debugfs. The
114762306a36Sopenharmony_ci	  information includes global and per chunk statistics, which can
114862306a36Sopenharmony_ci	  be used to help understand percpu memory usage.
114962306a36Sopenharmony_ci
115062306a36Sopenharmony_ciconfig GUP_TEST
115162306a36Sopenharmony_ci	bool "Enable infrastructure for get_user_pages()-related unit tests"
115262306a36Sopenharmony_ci	depends on DEBUG_FS
115362306a36Sopenharmony_ci	help
115462306a36Sopenharmony_ci	  Provides /sys/kernel/debug/gup_test, which in turn provides a way
115562306a36Sopenharmony_ci	  to make ioctl calls that can launch kernel-based unit tests for
115662306a36Sopenharmony_ci	  the get_user_pages*() and pin_user_pages*() family of API calls.
115762306a36Sopenharmony_ci
115862306a36Sopenharmony_ci	  These tests include benchmark testing of the _fast variants of
115962306a36Sopenharmony_ci	  get_user_pages*() and pin_user_pages*(), as well as smoke tests of
116062306a36Sopenharmony_ci	  the non-_fast variants.
116162306a36Sopenharmony_ci
116262306a36Sopenharmony_ci	  There is also a sub-test that allows running dump_page() on any
116362306a36Sopenharmony_ci	  of up to eight pages (selected by command line args) within the
116462306a36Sopenharmony_ci	  range of user-space addresses. These pages are either pinned via
116562306a36Sopenharmony_ci	  pin_user_pages*(), or pinned via get_user_pages*(), as specified
116662306a36Sopenharmony_ci	  by other command line arguments.
116762306a36Sopenharmony_ci
116862306a36Sopenharmony_ci	  See tools/testing/selftests/mm/gup_test.c
116962306a36Sopenharmony_ci
117062306a36Sopenharmony_cicomment "GUP_TEST needs to have DEBUG_FS enabled"
117162306a36Sopenharmony_ci	depends on !GUP_TEST && !DEBUG_FS
117262306a36Sopenharmony_ci
117362306a36Sopenharmony_ciconfig GUP_GET_PXX_LOW_HIGH
117462306a36Sopenharmony_ci	bool
117562306a36Sopenharmony_ci
117662306a36Sopenharmony_ciconfig DMAPOOL_TEST
117762306a36Sopenharmony_ci	tristate "Enable a module to run time tests on dma_pool"
117862306a36Sopenharmony_ci	depends on HAS_DMA
117962306a36Sopenharmony_ci	help
118062306a36Sopenharmony_ci	  Provides a test module that will allocate and free many blocks of
118162306a36Sopenharmony_ci	  various sizes and report how long it takes. This is intended to
118262306a36Sopenharmony_ci	  provide a consistent way to measure how changes to the
118362306a36Sopenharmony_ci	  dma_pool_alloc/free routines affect performance.
118462306a36Sopenharmony_ci
118562306a36Sopenharmony_ciconfig ARCH_HAS_PTE_SPECIAL
118662306a36Sopenharmony_ci	bool
118762306a36Sopenharmony_ci
118862306a36Sopenharmony_ci#
118962306a36Sopenharmony_ci# Some architectures require a special hugepage directory format that is
119062306a36Sopenharmony_ci# required to support multiple hugepage sizes. For example a4fe3ce76
119162306a36Sopenharmony_ci# "powerpc/mm: Allow more flexible layouts for hugepage pagetables"
119262306a36Sopenharmony_ci# introduced it on powerpc.  This allows for a more flexible hugepage
119362306a36Sopenharmony_ci# pagetable layouts.
119462306a36Sopenharmony_ci#
119562306a36Sopenharmony_ciconfig ARCH_HAS_HUGEPD
119662306a36Sopenharmony_ci	bool
119762306a36Sopenharmony_ci
119862306a36Sopenharmony_ciconfig MAPPING_DIRTY_HELPERS
119962306a36Sopenharmony_ci        bool
120062306a36Sopenharmony_ci
120162306a36Sopenharmony_ciconfig KMAP_LOCAL
120262306a36Sopenharmony_ci	bool
120362306a36Sopenharmony_ci
120462306a36Sopenharmony_ciconfig KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
120562306a36Sopenharmony_ci	bool
120662306a36Sopenharmony_ci
120762306a36Sopenharmony_ci# struct io_mapping based helper.  Selected by drivers that need them
120862306a36Sopenharmony_ciconfig IO_MAPPING
120962306a36Sopenharmony_ci	bool
121062306a36Sopenharmony_ci
121162306a36Sopenharmony_ciconfig MEMFD_CREATE
121262306a36Sopenharmony_ci	bool "Enable memfd_create() system call" if EXPERT
121362306a36Sopenharmony_ci
121462306a36Sopenharmony_ciconfig SECRETMEM
121562306a36Sopenharmony_ci	default y
121662306a36Sopenharmony_ci	bool "Enable memfd_secret() system call" if EXPERT
121762306a36Sopenharmony_ci	depends on ARCH_HAS_SET_DIRECT_MAP
121862306a36Sopenharmony_ci	help
121962306a36Sopenharmony_ci	  Enable the memfd_secret() system call with the ability to create
122062306a36Sopenharmony_ci	  memory areas visible only in the context of the owning process and
122162306a36Sopenharmony_ci	  not mapped to other processes and other kernel page tables.
122262306a36Sopenharmony_ci
122362306a36Sopenharmony_ciconfig ANON_VMA_NAME
122462306a36Sopenharmony_ci	bool "Anonymous VMA name support"
122562306a36Sopenharmony_ci	depends on PROC_FS && ADVISE_SYSCALLS && MMU
122662306a36Sopenharmony_ci
122762306a36Sopenharmony_ci	help
122862306a36Sopenharmony_ci	  Allow naming anonymous virtual memory areas.
122962306a36Sopenharmony_ci
123062306a36Sopenharmony_ci	  This feature allows assigning names to virtual memory areas. Assigned
123162306a36Sopenharmony_ci	  names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
123262306a36Sopenharmony_ci	  and help identifying individual anonymous memory areas.
123362306a36Sopenharmony_ci	  Assigning a name to anonymous virtual memory area might prevent that
123462306a36Sopenharmony_ci	  area from being merged with adjacent virtual memory areas due to the
123562306a36Sopenharmony_ci	  difference in their name.
123662306a36Sopenharmony_ci
123762306a36Sopenharmony_ciconfig USERFAULTFD
123862306a36Sopenharmony_ci	bool "Enable userfaultfd() system call"
123962306a36Sopenharmony_ci	depends on MMU
124062306a36Sopenharmony_ci	help
124162306a36Sopenharmony_ci	  Enable the userfaultfd() system call that allows to intercept and
124262306a36Sopenharmony_ci	  handle page faults in userland.
124362306a36Sopenharmony_ci
124462306a36Sopenharmony_ciconfig HAVE_ARCH_USERFAULTFD_WP
124562306a36Sopenharmony_ci	bool
124662306a36Sopenharmony_ci	help
124762306a36Sopenharmony_ci	  Arch has userfaultfd write protection support
124862306a36Sopenharmony_ci
124962306a36Sopenharmony_ciconfig HAVE_ARCH_USERFAULTFD_MINOR
125062306a36Sopenharmony_ci	bool
125162306a36Sopenharmony_ci	help
125262306a36Sopenharmony_ci	  Arch has userfaultfd minor fault support
125362306a36Sopenharmony_ci
125462306a36Sopenharmony_ciconfig PTE_MARKER_UFFD_WP
125562306a36Sopenharmony_ci	bool "Userfaultfd write protection support for shmem/hugetlbfs"
125662306a36Sopenharmony_ci	default y
125762306a36Sopenharmony_ci	depends on HAVE_ARCH_USERFAULTFD_WP
125862306a36Sopenharmony_ci
125962306a36Sopenharmony_ci	help
126062306a36Sopenharmony_ci	  Allows to create marker PTEs for userfaultfd write protection
126162306a36Sopenharmony_ci	  purposes.  It is required to enable userfaultfd write protection on
126262306a36Sopenharmony_ci	  file-backed memory types like shmem and hugetlbfs.
126362306a36Sopenharmony_ci
126462306a36Sopenharmony_ci# multi-gen LRU {
126562306a36Sopenharmony_ciconfig LRU_GEN
126662306a36Sopenharmony_ci	bool "Multi-Gen LRU"
126762306a36Sopenharmony_ci	depends on MMU
126862306a36Sopenharmony_ci	# make sure folio->flags has enough spare bits
126962306a36Sopenharmony_ci	depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
127062306a36Sopenharmony_ci	help
127162306a36Sopenharmony_ci	  A high performance LRU implementation to overcommit memory. See
127262306a36Sopenharmony_ci	  Documentation/admin-guide/mm/multigen_lru.rst for details.
127362306a36Sopenharmony_ci
127462306a36Sopenharmony_ciconfig LRU_GEN_ENABLED
127562306a36Sopenharmony_ci	bool "Enable by default"
127662306a36Sopenharmony_ci	depends on LRU_GEN
127762306a36Sopenharmony_ci	help
127862306a36Sopenharmony_ci	  This option enables the multi-gen LRU by default.
127962306a36Sopenharmony_ci
128062306a36Sopenharmony_ciconfig LRU_GEN_STATS
128162306a36Sopenharmony_ci	bool "Full stats for debugging"
128262306a36Sopenharmony_ci	depends on LRU_GEN
128362306a36Sopenharmony_ci	help
128462306a36Sopenharmony_ci	  Do not enable this option unless you plan to look at historical stats
128562306a36Sopenharmony_ci	  from evicted generations for debugging purpose.
128662306a36Sopenharmony_ci
128762306a36Sopenharmony_ci	  This option has a per-memcg and per-node memory overhead.
128862306a36Sopenharmony_ci# }
128962306a36Sopenharmony_ci
129062306a36Sopenharmony_ciconfig ARCH_SUPPORTS_PER_VMA_LOCK
129162306a36Sopenharmony_ci       def_bool n
129262306a36Sopenharmony_ci
129362306a36Sopenharmony_ciconfig PER_VMA_LOCK
129462306a36Sopenharmony_ci	def_bool y
129562306a36Sopenharmony_ci	depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP
129662306a36Sopenharmony_ci	help
129762306a36Sopenharmony_ci	  Allow per-vma locking during page fault handling.
129862306a36Sopenharmony_ci
129962306a36Sopenharmony_ci	  This feature allows locking each virtual memory area separately when
130062306a36Sopenharmony_ci	  handling page faults instead of taking mmap_lock.
130162306a36Sopenharmony_ci
130262306a36Sopenharmony_ciconfig LOCK_MM_AND_FIND_VMA
130362306a36Sopenharmony_ci	bool
130462306a36Sopenharmony_ci	depends on !STACK_GROWSUP
130562306a36Sopenharmony_ci
130662306a36Sopenharmony_ci
130762306a36Sopenharmony_ciconfig MEM_PURGEABLE
130862306a36Sopenharmony_ci	bool "Purgeable memory feature"
130962306a36Sopenharmony_ci	default n
131062306a36Sopenharmony_ci	depends on 64BIT
131162306a36Sopenharmony_ci	select ARCH_USES_HIGH_VMA_FLAGS
131262306a36Sopenharmony_ci	help
131362306a36Sopenharmony_ci	  Support purgeable pages for process
131462306a36Sopenharmony_ci
131562306a36Sopenharmony_ciconfig MEM_PURGEABLE_DEBUG
131662306a36Sopenharmony_ci	bool "Purgeable memory debug"
131762306a36Sopenharmony_ci	default n
131862306a36Sopenharmony_ci	depends on MEM_PURGEABLE
131962306a36Sopenharmony_ci	help
132062306a36Sopenharmony_ci	  Debug info for purgeable memory
132162306a36Sopenharmony_ci
132262306a36Sopenharmony_ciconfig PURGEABLE_ASHMEM
132362306a36Sopenharmony_ci	bool "Purgeable memory feature for ashmem"
132462306a36Sopenharmony_ci	default n
132562306a36Sopenharmony_ci	depends on MEM_PURGEABLE
132662306a36Sopenharmony_ci	help
132762306a36Sopenharmony_ci	  Support purgeable ashmem for process
132862306a36Sopenharmony_ci
132962306a36Sopenharmony_cisource "mm/damon/Kconfig"
133062306a36Sopenharmony_ci
133162306a36Sopenharmony_ciendmenu
1332