xref: /linux/mm/Kconfig (revision 7a5f1cd22d47f8ca4b760b6334378ae42c1bd24b)
1# SPDX-License-Identifier: GPL-2.0-only
2
3menu "Memory Management options"
4
5#
6# For some reason microblaze and nios2 hard code SWAP=n.  Hopefully we can
7# add proper SWAP support to them, in which case this can be remove.
8#
9config ARCH_NO_SWAP
10	bool
11
12menuconfig SWAP
13	bool "Support for paging of anonymous memory (swap)"
14	depends on MMU && BLOCK && !ARCH_NO_SWAP
15	default y
16	help
17	  This option allows you to choose whether you want to have support
18	  for so called swap devices or swap files in your kernel that are
19	  used to provide more virtual memory than the actual RAM present
20	  in your computer.  If unsure say Y.
21
22config ZSWAP
23	bool "Compressed cache for swap pages"
24	depends on SWAP
25	select CRYPTO
26	select ZSMALLOC
27	help
28	  A lightweight compressed cache for swap pages.  It takes
29	  pages that are in the process of being swapped out and attempts to
30	  compress them into a dynamically allocated RAM-based memory pool.
31	  This can result in a significant I/O reduction on swap device and,
32	  in the case where decompressing from RAM is faster than swap device
33	  reads, can also improve workload performance.
34
35config ZSWAP_DEFAULT_ON
36	bool "Enable the compressed cache for swap pages by default"
37	depends on ZSWAP
38	help
39	  If selected, the compressed cache for swap pages will be enabled
40	  at boot, otherwise it will be disabled.
41
42	  The selection made here can be overridden by using the kernel
43	  command line 'zswap.enabled=' option.
44
45config ZSWAP_SHRINKER_DEFAULT_ON
46	bool "Shrink the zswap pool on memory pressure"
47	depends on ZSWAP
48	default n
49	help
50	  If selected, the zswap shrinker will be enabled, and the pages
51	  stored in the zswap pool will become available for reclaim (i.e
52	  written back to the backing swap device) on memory pressure.
53
54	  This means that zswap writeback could happen even if the pool is
55	  not yet full, or the cgroup zswap limit has not been reached,
56	  reducing the chance that cold pages will reside in the zswap pool
57	  and consume memory indefinitely.
58
59choice
60	prompt "Default compressor"
61	depends on ZSWAP
62	default ZSWAP_COMPRESSOR_DEFAULT_LZO
63	help
64	  Selects the default compression algorithm for the compressed cache
65	  for swap pages.
66
67	  For an overview what kind of performance can be expected from
68	  a particular compression algorithm please refer to the benchmarks
69	  available at the following LWN page:
70	  https://lwn.net/Articles/751795/
71
72	  If in doubt, select 'LZO'.
73
74	  The selection made here can be overridden by using the kernel
75	  command line 'zswap.compressor=' option.
76
77config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
78	bool "Deflate"
79	select CRYPTO_DEFLATE
80	help
81	  Use the Deflate algorithm as the default compression algorithm.
82
83config ZSWAP_COMPRESSOR_DEFAULT_LZO
84	bool "LZO"
85	select CRYPTO_LZO
86	help
87	  Use the LZO algorithm as the default compression algorithm.
88
89config ZSWAP_COMPRESSOR_DEFAULT_842
90	bool "842"
91	select CRYPTO_842
92	help
93	  Use the 842 algorithm as the default compression algorithm.
94
95config ZSWAP_COMPRESSOR_DEFAULT_LZ4
96	bool "LZ4"
97	select CRYPTO_LZ4
98	help
99	  Use the LZ4 algorithm as the default compression algorithm.
100
101config ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
102	bool "LZ4HC"
103	select CRYPTO_LZ4HC
104	help
105	  Use the LZ4HC algorithm as the default compression algorithm.
106
107config ZSWAP_COMPRESSOR_DEFAULT_ZSTD
108	bool "zstd"
109	select CRYPTO_ZSTD
110	help
111	  Use the zstd algorithm as the default compression algorithm.
112endchoice
113
114config ZSWAP_COMPRESSOR_DEFAULT
115       string
116       depends on ZSWAP
117       default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
118       default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
119       default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
120       default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
121       default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
122       default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
123       default ""
124
125config ZSMALLOC
126	tristate
127
128if ZSMALLOC
129
130menu "Zsmalloc allocator options"
131	depends on ZSMALLOC
132
133comment "Zsmalloc is a common backend allocator for zswap & zram"
134
135config ZSMALLOC_STAT
136	bool "Export zsmalloc statistics"
137	select DEBUG_FS
138	help
139	  This option enables code in the zsmalloc to collect various
140	  statistics about what's happening in zsmalloc and exports that
141	  information to userspace via debugfs.
142	  If unsure, say N.
143
144config ZSMALLOC_CHAIN_SIZE
145	int "Maximum number of physical pages per-zspage"
146	default 8
147	range 4 16
148	help
149	  This option sets the upper limit on the number of physical pages
150	  that a zmalloc page (zspage) can consist of. The optimal zspage
151	  chain size is calculated for each size class during the
152	  initialization of the pool.
153
154	  Changing this option can alter the characteristics of size classes,
155	  such as the number of pages per zspage and the number of objects
156	  per zspage. This can also result in different configurations of
157	  the pool, as zsmalloc merges size classes with similar
158	  characteristics.
159
160	  For more information, see zsmalloc documentation.
161
162endmenu
163
164endif
165
166menu "Slab allocator options"
167
168config SLUB
169	def_bool y
170	select IRQ_WORK
171
172config KVFREE_RCU_BATCHED
173	def_bool y
174	depends on !SLUB_TINY && !TINY_RCU
175	depends on !RCU_STRICT_GRACE_PERIOD
176
177config SLUB_TINY
178	bool "Configure for minimal memory footprint"
179	depends on EXPERT && !COMPILE_TEST
180	select SLAB_MERGE_DEFAULT
181	help
182	   Configures the slab allocator in a way to achieve minimal memory
183	   footprint, sacrificing scalability, debugging and other features.
184	   This is intended only for the smallest system that had used the
185	   SLOB allocator and is not recommended for systems with more than
186	   16MB RAM.
187
188	   If unsure, say N.
189
190config SLAB_MERGE_DEFAULT
191	bool "Allow slab caches to be merged"
192	default y
193	help
194	  For reduced kernel memory fragmentation, slab caches can be
195	  merged when they share the same size and other characteristics.
196	  This carries a risk of kernel heap overflows being able to
197	  overwrite objects from merged caches (and more easily control
198	  cache layout), which makes such heap attacks easier to exploit
199	  by attackers. By keeping caches unmerged, these kinds of exploits
200	  can usually only damage objects in the same cache. To disable
201	  merging at runtime, "slab_nomerge" can be passed on the kernel
202	  command line.
203
204config SLAB_FREELIST_RANDOM
205	bool "Randomize slab freelist"
206	depends on !SLUB_TINY
207	help
208	  Randomizes the freelist order used on creating new pages. This
209	  security feature reduces the predictability of the kernel slab
210	  allocator against heap overflows.
211
212config SLAB_FREELIST_HARDENED
213	bool "Harden slab freelist metadata"
214	depends on !SLUB_TINY
215	help
216	  Many kernel heap attacks try to target slab cache metadata and
217	  other infrastructure. This options makes minor performance
218	  sacrifices to harden the kernel slab allocator against common
219	  freelist exploit methods.
220
221config SLAB_BUCKETS
222	bool "Support allocation from separate kmalloc buckets"
223	depends on !SLUB_TINY
224	default SLAB_FREELIST_HARDENED
225	help
226	  Kernel heap attacks frequently depend on being able to create
227	  specifically-sized allocations with user-controlled contents
228	  that will be allocated into the same kmalloc bucket as a
229	  target object. To avoid sharing these allocation buckets,
230	  provide an explicitly separated set of buckets to be used for
231	  user-controlled allocations. This may very slightly increase
232	  memory fragmentation, though in practice it's only a handful
233	  of extra pages since the bulk of user-controlled allocations
234	  are relatively long-lived.
235
236	  If unsure, say Y.
237
238config SLUB_STATS
239	default n
240	bool "Enable performance statistics"
241	depends on SYSFS && !SLUB_TINY
242	help
243	  The statistics are useful to debug slab allocation behavior in
244	  order find ways to optimize the allocator. This should never be
245	  enabled for production use since keeping statistics slows down
246	  the allocator by a few percentage points. The slabinfo command
247	  supports the determination of the most active slabs to figure
248	  out which slabs are relevant to a particular load.
249	  Try running: slabinfo -DA
250
251config RANDOM_KMALLOC_CACHES
252	default n
253	depends on !SLUB_TINY
254	bool "Randomize slab caches for normal kmalloc"
255	help
256	  A hardening feature that creates multiple copies of slab caches for
257	  normal kmalloc allocation and makes kmalloc randomly pick one based
258	  on code address, which makes the attackers more difficult to spray
259	  vulnerable memory objects on the heap for the purpose of exploiting
260	  memory vulnerabilities.
261
262	  Currently the number of copies is set to 16, a reasonably large value
263	  that effectively diverges the memory objects allocated for different
264	  subsystems or modules into different caches, at the expense of a
265	  limited degree of memory and CPU overhead that relates to hardware and
266	  system workload.
267
268endmenu # Slab allocator options
269
270config SHUFFLE_PAGE_ALLOCATOR
271	bool "Page allocator randomization"
272	default SLAB_FREELIST_RANDOM && ACPI_NUMA
273	help
274	  Randomization of the page allocator improves the average
275	  utilization of a direct-mapped memory-side-cache. See section
276	  5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI
277	  6.2a specification for an example of how a platform advertises
278	  the presence of a memory-side-cache. There are also incidental
279	  security benefits as it reduces the predictability of page
280	  allocations to compliment SLAB_FREELIST_RANDOM, but the
281	  default granularity of shuffling on the MAX_PAGE_ORDER i.e, 10th
282	  order of pages is selected based on cache utilization benefits
283	  on x86.
284
285	  While the randomization improves cache utilization it may
286	  negatively impact workloads on platforms without a cache. For
287	  this reason, by default, the randomization is not enabled even
288	  if SHUFFLE_PAGE_ALLOCATOR=y. The randomization may be force enabled
289	  with the 'page_alloc.shuffle' kernel command line parameter.
290
291	  Say Y if unsure.
292
293config COMPAT_BRK
294	bool "Disable heap randomization"
295	default y
296	help
297	  Randomizing heap placement makes heap exploits harder, but it
298	  also breaks ancient binaries (including anything libc5 based).
299	  This option changes the bootup default to heap randomization
300	  disabled, and can be overridden at runtime by setting
301	  /proc/sys/kernel/randomize_va_space to 2.
302
303	  On non-ancient distros (post-2000 ones) N is usually a safe choice.
304
305config MMAP_ALLOW_UNINITIALIZED
306	bool "Allow mmapped anonymous memory to be uninitialized"
307	depends on EXPERT && !MMU
308	default n
309	help
310	  Normally, and according to the Linux spec, anonymous memory obtained
311	  from mmap() has its contents cleared before it is passed to
312	  userspace.  Enabling this config option allows you to request that
313	  mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
314	  providing a huge performance boost.  If this option is not enabled,
315	  then the flag will be ignored.
316
317	  This is taken advantage of by uClibc's malloc(), and also by
318	  ELF-FDPIC binfmt's brk and stack allocator.
319
320	  Because of the obvious security issues, this option should only be
321	  enabled on embedded devices where you control what is run in
322	  userspace.  Since that isn't generally a problem on no-MMU systems,
323	  it is normally safe to say Y here.
324
325	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
326
327config SELECT_MEMORY_MODEL
328	def_bool y
329	depends on ARCH_SELECT_MEMORY_MODEL
330
331choice
332	prompt "Memory model"
333	depends on SELECT_MEMORY_MODEL
334	default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
335	default FLATMEM_MANUAL
336	help
337	  This option allows you to change some of the ways that
338	  Linux manages its memory internally. Most users will
339	  only have one option here selected by the architecture
340	  configuration. This is normal.
341
342config FLATMEM_MANUAL
343	bool "Flat Memory"
344	depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
345	help
346	  This option is best suited for non-NUMA systems with
347	  flat address space. The FLATMEM is the most efficient
348	  system in terms of performance and resource consumption
349	  and it is the best option for smaller systems.
350
351	  For systems that have holes in their physical address
352	  spaces and for features like NUMA and memory hotplug,
353	  choose "Sparse Memory".
354
355	  If unsure, choose this option (Flat Memory) over any other.
356
357config SPARSEMEM_MANUAL
358	bool "Sparse Memory"
359	depends on ARCH_SPARSEMEM_ENABLE
360	help
361	  This will be the only option for some systems, including
362	  memory hot-plug systems.  This is normal.
363
364	  This option provides efficient support for systems with
365	  holes is their physical address space and allows memory
366	  hot-plug and hot-remove.
367
368	  If unsure, choose "Flat Memory" over this option.
369
370endchoice
371
372config SPARSEMEM
373	def_bool y
374	depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
375
376config FLATMEM
377	def_bool y
378	depends on !SPARSEMEM || FLATMEM_MANUAL
379
380#
381# SPARSEMEM_EXTREME (which is the default) does some bootmem
382# allocations when sparse_init() is called.  If this cannot
383# be done on your architecture, select this option.  However,
384# statically allocating the mem_section[] array can potentially
385# consume vast quantities of .bss, so be careful.
386#
387# This option will also potentially produce smaller runtime code
388# with gcc 3.4 and later.
389#
390config SPARSEMEM_STATIC
391	bool
392
393#
394# Architecture platforms which require a two level mem_section in SPARSEMEM
395# must select this option. This is usually for architecture platforms with
396# an extremely sparse physical address space.
397#
398config SPARSEMEM_EXTREME
399	def_bool y
400	depends on SPARSEMEM && !SPARSEMEM_STATIC
401
402config SPARSEMEM_VMEMMAP_ENABLE
403	bool
404
405config SPARSEMEM_VMEMMAP
406	def_bool y
407	depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
408	help
409	  SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
410	  pfn_to_page and page_to_pfn operations.  This is the most
411	  efficient option when sufficient kernel resources are available.
412
413config SPARSEMEM_VMEMMAP_PREINIT
414	bool
415#
416# Select this config option from the architecture Kconfig, if it is preferred
417# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
418#
419config ARCH_WANT_OPTIMIZE_DAX_VMEMMAP
420	bool
421
422config ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
423	bool
424
425config ARCH_WANT_HUGETLB_VMEMMAP_PREINIT
426	bool
427
428config HAVE_MEMBLOCK_PHYS_MAP
429	bool
430
431config HAVE_GUP_FAST
432	depends on MMU
433	bool
434
435# Enable memblock support for scratch memory which is needed for kexec handover
436config MEMBLOCK_KHO_SCRATCH
437	bool
438
439# Don't discard allocated memory used to track "memory" and "reserved" memblocks
440# after early boot, so it can still be used to test for validity of memory.
441# Also, memblocks are updated with memory hot(un)plug.
442config ARCH_KEEP_MEMBLOCK
443	bool
444
445# Keep arch NUMA mapping infrastructure post-init.
446config NUMA_KEEP_MEMINFO
447	bool
448
449config MEMORY_ISOLATION
450	bool
451
452# IORESOURCE_SYSTEM_RAM regions in the kernel resource tree that are marked
453# IORESOURCE_EXCLUSIVE cannot be mapped to user space, for example, via
454# /dev/mem.
455config EXCLUSIVE_SYSTEM_RAM
456	def_bool y
457	depends on !DEVMEM || STRICT_DEVMEM
458
459#
460# Only be set on architectures that have completely implemented memory hotplug
461# feature. If you are not sure, don't touch it.
462#
463config HAVE_BOOTMEM_INFO_NODE
464	def_bool n
465
466config ARCH_ENABLE_MEMORY_HOTPLUG
467	bool
468
469# eventually, we can have this option just 'select SPARSEMEM'
470menuconfig MEMORY_HOTPLUG
471	bool "Memory hotplug"
472	select MEMORY_ISOLATION
473	depends on SPARSEMEM_VMEMMAP
474	depends on ARCH_ENABLE_MEMORY_HOTPLUG
475	depends on 64BIT
476	select NUMA_KEEP_MEMINFO if NUMA
477
478if MEMORY_HOTPLUG
479
480choice
481	prompt "Memory Hotplug Default Online Type"
482	default MHP_DEFAULT_ONLINE_TYPE_OFFLINE
483	help
484	  Default memory type for hotplugged memory.
485
486	  This option sets the default policy setting for memory hotplug
487	  onlining policy (/sys/devices/system/memory/auto_online_blocks) which
488	  determines what happens to newly added memory regions. Policy setting
489	  can always be changed at runtime.
490
491	  The default is 'offline'.
492
493	  Select offline to defer onlining to drivers and user policy.
494	  Select auto to let the kernel choose what zones to utilize.
495	  Select online_kernel to generally allow kernel usage of this memory.
496	  Select online_movable to generally disallow kernel usage of this memory.
497
498	  Example kernel usage would be page structs and page tables.
499
500	  See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
501
502config MHP_DEFAULT_ONLINE_TYPE_OFFLINE
503	bool "offline"
504	help
505	  Hotplugged memory will not be onlined by default.
506	  Choose this for systems with drivers and user policy that
507	  handle onlining of hotplug memory policy.
508
509config MHP_DEFAULT_ONLINE_TYPE_ONLINE_AUTO
510	bool "auto"
511	help
512	  Select this if you want the kernel to automatically online
513	  hotplugged memory into the zone it thinks is reasonable.
514	  This memory may be utilized for kernel data.
515
516config MHP_DEFAULT_ONLINE_TYPE_ONLINE_KERNEL
517	bool "kernel"
518	help
519	  Select this if you want the kernel to automatically online
520	  hotplugged memory into a zone capable of being used for kernel
521	  data. This typically means ZONE_NORMAL.
522
523config MHP_DEFAULT_ONLINE_TYPE_ONLINE_MOVABLE
524	bool "movable"
525	help
526	  Select this if you want the kernel to automatically online
527	  hotplug memory into ZONE_MOVABLE. This memory will generally
528	  not be utilized for kernel data.
529
530	  This should only be used when the admin knows sufficient
531	  ZONE_NORMAL memory is available to describe hotplug memory,
532	  otherwise hotplug memory may fail to online. For example,
533	  sufficient kernel-capable memory (ZONE_NORMAL) must be
534	  available to allocate page structs to describe ZONE_MOVABLE.
535
536endchoice
537
538config MEMORY_HOTREMOVE
539	bool "Allow for memory hot remove"
540	select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
541	depends on MEMORY_HOTPLUG
542	select MIGRATION
543
544config MHP_MEMMAP_ON_MEMORY
545	def_bool y
546	depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
547	depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
548
549endif # MEMORY_HOTPLUG
550
551config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
552       bool
553
554# Heavily threaded applications may benefit from splitting the mm-wide
555# page_table_lock, so that faults on different parts of the user address
556# space can be handled with less contention: split it at this NR_CPUS.
557# Default to 4 for wider testing, though 8 might be more appropriate.
558# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
559# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
560# SPARC32 allocates multiple pte tables within a single page, and therefore
561# a per-page lock leads to problems when multiple tables need to be locked
562# at the same time (e.g. copy_page_range()).
563# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
564#
565config SPLIT_PTE_PTLOCKS
566	def_bool y
567	depends on MMU
568	depends on SMP
569	depends on NR_CPUS >= 4
570	depends on !ARM || CPU_CACHE_VIPT
571	depends on !PARISC || PA20
572	depends on !SPARC32
573	depends on !UML
574
575config ARCH_ENABLE_SPLIT_PMD_PTLOCK
576	bool
577
578config SPLIT_PMD_PTLOCKS
579	def_bool y
580	depends on SPLIT_PTE_PTLOCKS && ARCH_ENABLE_SPLIT_PMD_PTLOCK
581
582#
583# support for memory balloon
584config BALLOON
585	bool
586
587#
588# support for memory balloon page migration
589config BALLOON_MIGRATION
590	bool "Allow for balloon memory migration"
591	default y
592	depends on MIGRATION && BALLOON
593	help
594	  Allow for migration of pages inflated in a memory balloon such that
595	  they can be allocated from memory areas only available for movable
596	  allocations (e.g., ZONE_MOVABLE, CMA) and such that they can be
597	  migrated for memory defragmentation purposes by memory compaction.
598
599#
600# support for memory compaction
601config COMPACTION
602	bool "Allow for memory compaction"
603	default y
604	select MIGRATION
605	depends on MMU
606	help
607	  Compaction is the only memory management component to form
608	  high order (larger physically contiguous) memory blocks
609	  reliably. The page allocator relies on compaction heavily and
610	  the lack of the feature can lead to unexpected OOM killer
611	  invocations for high order memory requests. You shouldn't
612	  disable this option unless there really is a strong reason for
613	  it and then we would be really interested to hear about that at
614	  linux-mm@kvack.org.
615
616config COMPACT_UNEVICTABLE_DEFAULT
617	int
618	depends on COMPACTION
619	default 0 if PREEMPT_RT
620	default 1
621
622#
623# support for free page reporting
624config PAGE_REPORTING
625	bool "Free page reporting"
626	help
627	  Free page reporting allows for the incremental acquisition of
628	  free pages from the buddy allocator for the purpose of reporting
629	  those pages to another entity, such as a hypervisor, so that the
630	  memory can be freed within the host for other uses.
631
632config NUMA_MIGRATION
633	bool "NUMA page migration"
634	default y
635	depends on NUMA && MMU
636	select MIGRATION
637	help
638	  Support the migration of pages to other NUMA nodes, available to
639	  user space through interfaces like migrate_pages(), move_pages(),
640	  and mbind(). Selecting this option also enables support for page
641	  demotion for memory tiering.
642
643config MIGRATION
644	bool
645	depends on MMU
646
647config DEVICE_MIGRATION
648	def_bool MIGRATION && ZONE_DEVICE
649
650config ARCH_ENABLE_HUGEPAGE_MIGRATION
651	bool
652
653config ARCH_ENABLE_THP_MIGRATION
654	bool
655
656config HUGETLB_PAGE_SIZE_VARIABLE
657	def_bool n
658	help
659	  Allows the pageblock_order value to be dynamic instead of just standard
660	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
661	  on a platform.
662
663	  Note that the pageblock_order cannot exceed MAX_PAGE_ORDER and will be
664	  clamped down to MAX_PAGE_ORDER.
665
666config CONTIG_ALLOC
667	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
668
669config PCP_BATCH_SCALE_MAX
670	int "Maximum scale factor of PCP (Per-CPU pageset) batch allocate/free"
671	default 5
672	range 0 6
673	help
674	  In page allocator, PCP (Per-CPU pageset) is refilled and drained in
675	  batches.  The batch number is scaled automatically to improve page
676	  allocation/free throughput.  But too large scale factor may hurt
677	  latency.  This option sets the upper limit of scale factor to limit
678	  the maximum latency.
679
680config PHYS_ADDR_T_64BIT
681	def_bool 64BIT
682
683config MMU_NOTIFIER
684	bool
685	select INTERVAL_TREE
686
687config KSM
688	bool "Enable KSM for page merging"
689	depends on MMU
690	select XXHASH
691	help
692	  Enable Kernel Samepage Merging: KSM periodically scans those areas
693	  of an application's address space that an app has advised may be
694	  mergeable.  When it finds pages of identical content, it replaces
695	  the many instances by a single page with that content, so
696	  saving memory until one or another app needs to modify the content.
697	  Recommended for use with KVM, or with other duplicative applications.
698	  See Documentation/mm/ksm.rst for more information: KSM is inactive
699	  until a program has madvised that an area is MADV_MERGEABLE, and
700	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
701
702config DEFAULT_MMAP_MIN_ADDR
703	int "Low address space to protect from user allocation"
704	depends on MMU
705	default 4096
706	help
707	  This is the portion of low virtual memory which should be protected
708	  from userspace allocation.  Keeping a user from writing to low pages
709	  can help reduce the impact of kernel NULL pointer bugs.
710
711	  For most arm64, ppc64 and x86 users with lots of address space
712	  a value of 65536 is reasonable and should cause no problems.
713	  On arm and other archs it should not be higher than 32768.
714	  Programs which use vm86 functionality or have some need to map
715	  this low address space will need CAP_SYS_RAWIO or disable this
716	  protection by setting the value to 0.
717
718	  This value can be changed after boot using the
719	  /proc/sys/vm/mmap_min_addr tunable.
720
721config ARCH_SUPPORTS_MEMORY_FAILURE
722	bool
723
724config MEMORY_FAILURE
725	depends on MMU
726	depends on ARCH_SUPPORTS_MEMORY_FAILURE
727	bool "Enable recovery from hardware memory errors"
728	select INTERVAL_TREE
729	help
730	  Enables code to recover from some memory failures on systems
731	  with MCA recovery. This allows a system to continue running
732	  even when some of its memory has uncorrected errors. This requires
733	  special hardware support and typically ECC memory.
734
735config HWPOISON_INJECT
736	tristate "HWPoison pages injector"
737	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
738	select PROC_PAGE_MONITOR
739
740config NOMMU_INITIAL_TRIM_EXCESS
741	int "Turn on mmap() excess space trimming before booting"
742	depends on !MMU
743	default 1
744	help
745	  The NOMMU mmap() frequently needs to allocate large contiguous chunks
746	  of memory on which to store mappings, but it can only ask the system
747	  allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
748	  more than it requires.  To deal with this, mmap() is able to trim off
749	  the excess and return it to the allocator.
750
751	  If trimming is enabled, the excess is trimmed off and returned to the
752	  system allocator, which can cause extra fragmentation, particularly
753	  if there are a lot of transient processes.
754
755	  If trimming is disabled, the excess is kept, but not used, which for
756	  long-term mappings means that the space is wasted.
757
758	  Trimming can be dynamically controlled through a sysctl option
759	  (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
760	  excess pages there must be before trimming should occur, or zero if
761	  no trimming is to occur.
762
763	  This option specifies the initial value of this option.  The default
764	  of 1 says that all excess pages should be trimmed.
765
766	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
767
768config ARCH_WANT_GENERAL_HUGETLB
769	bool
770
771config ARCH_WANTS_THP_SWAP
772	def_bool n
773
774config PERSISTENT_HUGE_ZERO_FOLIO
775	bool "Allocate a PMD sized folio for zeroing"
776	depends on TRANSPARENT_HUGEPAGE
777	help
778	  Enable this option to reduce the runtime refcounting overhead
779	  of the huge zero folio and expand the places in the kernel
780	  that can use huge zero folios. For instance, block I/O benefits
781	  from access to large folios for zeroing memory.
782
783	  With this option enabled, the huge zero folio is allocated
784	  once and never freed. One full huge page's worth of memory shall
785	  be used.
786
787	  Say Y if your system has lots of memory. Say N if you are
788	  memory constrained.
789
790config MM_ID
791	def_bool n
792
793menuconfig TRANSPARENT_HUGEPAGE
794	bool "Transparent Hugepage Support"
795	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE && !PREEMPT_RT
796	select COMPACTION
797	select XARRAY_MULTI
798	select MM_ID
799	help
800	  Transparent Hugepages allows the kernel to use huge pages and
801	  huge tlb transparently to the applications whenever possible.
802	  This feature can improve computing performance to certain
803	  applications by speeding up page faults during memory
804	  allocation, by reducing the number of tlb misses and by speeding
805	  up the pagetable walking.
806
807	  If memory constrained on embedded, you may want to say N.
808
809if TRANSPARENT_HUGEPAGE
810
811choice
812	prompt "Transparent Hugepage Support sysfs defaults"
813	depends on TRANSPARENT_HUGEPAGE
814	default TRANSPARENT_HUGEPAGE_ALWAYS
815	help
816	  Selects the sysfs defaults for Transparent Hugepage Support.
817
818	config TRANSPARENT_HUGEPAGE_ALWAYS
819		bool "always"
820	help
821	  Enabling Transparent Hugepage always, can increase the
822	  memory footprint of applications without a guaranteed
823	  benefit but it will work automatically for all applications.
824
825	config TRANSPARENT_HUGEPAGE_MADVISE
826		bool "madvise"
827	help
828	  Enabling Transparent Hugepage madvise, will only provide a
829	  performance improvement benefit to the applications using
830	  madvise(MADV_HUGEPAGE) but it won't risk to increase the
831	  memory footprint of applications without a guaranteed
832	  benefit.
833
834	config TRANSPARENT_HUGEPAGE_NEVER
835		bool "never"
836	help
837	  Disable Transparent Hugepage by default. It can still be
838	  enabled at runtime via sysfs.
839endchoice
840
841choice
842	prompt "Shmem hugepage allocation defaults"
843	depends on TRANSPARENT_HUGEPAGE
844	default TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER
845	help
846	  Selects the hugepage allocation policy defaults for
847	  the internal shmem mount.
848
849	  The selection made here can be overridden by using the kernel
850	  command line 'transparent_hugepage_shmem=' option.
851
852	config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER
853		bool "never"
854	help
855	  Disable hugepage allocation for shmem mount by default. It can
856	  still be enabled with the kernel command line
857	  'transparent_hugepage_shmem=' option or at runtime via sysfs
858	  knob. Note that madvise(MADV_COLLAPSE) can still cause
859	  transparent huge pages to be obtained even if this mode is
860	  specified.
861
862	config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ALWAYS
863		bool "always"
864	help
865	  Always attempt to allocate hugepage for shmem mount, can
866	  increase the memory footprint of applications without a
867	  guaranteed benefit but it will work automatically for all
868	  applications.
869
870	config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_WITHIN_SIZE
871		bool "within_size"
872	help
873	  Enable hugepage allocation for shmem mount if the allocation
874	  will be fully within the i_size. This configuration also takes
875	  into account any madvise(MADV_HUGEPAGE) hints that may be
876	  provided by the applications.
877
878	config TRANSPARENT_HUGEPAGE_SHMEM_HUGE_ADVISE
879		bool "advise"
880	help
881	  Enable hugepage allocation for the shmem mount exclusively when
882	  applications supply the madvise(MADV_HUGEPAGE) hint.
883	  This ensures that hugepages are used only in response to explicit
884	  requests from applications.
885endchoice
886
887choice
888	prompt "Tmpfs hugepage allocation defaults"
889	depends on TRANSPARENT_HUGEPAGE
890	default TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER
891	help
892	  Selects the hugepage allocation policy defaults for
893	  the tmpfs mount.
894
895	  The selection made here can be overridden by using the kernel
896	  command line 'transparent_hugepage_tmpfs=' option.
897
898	config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER
899		bool "never"
900	help
901	  Disable hugepage allocation for tmpfs mount by default. It can
902	  still be enabled with the kernel command line
903	  'transparent_hugepage_tmpfs=' option. Note that
904	  madvise(MADV_COLLAPSE) can still cause transparent huge pages
905	  to be obtained even if this mode is specified.
906
907	config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ALWAYS
908		bool "always"
909	help
910	  Always attempt to allocate hugepage for tmpfs mount, can
911	  increase the memory footprint of applications without a
912	  guaranteed benefit but it will work automatically for all
913	  applications.
914
915	config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_WITHIN_SIZE
916		bool "within_size"
917	help
918	  Enable hugepage allocation for tmpfs mount if the allocation
919	  will be fully within the i_size. This configuration also takes
920	  into account any madvise(MADV_HUGEPAGE) hints that may be
921	  provided by the applications.
922
923	config TRANSPARENT_HUGEPAGE_TMPFS_HUGE_ADVISE
924		bool "advise"
925	help
926	  Enable hugepage allocation for the tmpfs mount exclusively when
927	  applications supply the madvise(MADV_HUGEPAGE) hint.
928	  This ensures that hugepages are used only in response to explicit
929	  requests from applications.
930endchoice
931
932config THP_SWAP
933	def_bool y
934	depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT
935	help
936	  Swap transparent huge pages in one piece, without splitting.
937	  XXX: For now, swap cluster backing transparent huge page
938	  will be split after swapout.
939
940	  For selection by architectures with reasonable THP sizes.
941
942config READ_ONLY_THP_FOR_FS
943	bool "Read-only THP for filesystems (EXPERIMENTAL)"
944	depends on TRANSPARENT_HUGEPAGE
945
946	help
947	  Allow khugepaged to put read-only file-backed pages in THP.
948
949	  This is marked experimental because it is a new feature. Write
950	  support of file THPs will be developed in the next few release
951	  cycles.
952
953config NO_PAGE_MAPCOUNT
954	bool "No per-page mapcount (EXPERIMENTAL)"
955	help
956	  Do not maintain per-page mapcounts for pages part of larger
957	  allocations, such as transparent huge pages.
958
959	  When this config option is enabled, some interfaces that relied on
960	  this information will rely on less-precise per-allocation information
961	  instead: for example, using the average per-page mapcount in such
962	  a large allocation instead of the per-page mapcount.
963
964	  EXPERIMENTAL because the impact of some changes is still unclear.
965
966endif # TRANSPARENT_HUGEPAGE
967
968# simple helper to make the code a bit easier to read
969config PAGE_MAPCOUNT
970	def_bool !NO_PAGE_MAPCOUNT
971
972#
973# The architecture supports pgtable leaves that is larger than PAGE_SIZE
974#
975config PGTABLE_HAS_HUGE_LEAVES
976	def_bool TRANSPARENT_HUGEPAGE || HUGETLB_PAGE
977
978#
979# We can end up creating gigantic folio.
980#
981config HAVE_GIGANTIC_FOLIOS
982	def_bool (HUGETLB_PAGE && ARCH_HAS_GIGANTIC_PAGE) || \
983		 (ZONE_DEVICE && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD)
984
985config ASYNC_KERNEL_PGTABLE_FREE
986	def_bool n
987
988# TODO: Allow to be enabled without THP
989config ARCH_SUPPORTS_HUGE_PFNMAP
990	def_bool n
991	depends on TRANSPARENT_HUGEPAGE
992
993config ARCH_SUPPORTS_PMD_PFNMAP
994	def_bool y
995	depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE
996
997config ARCH_SUPPORTS_PUD_PFNMAP
998	def_bool y
999	depends on ARCH_SUPPORTS_HUGE_PFNMAP && HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
1000
1001#
1002# Architectures that always use weak definitions for percpu
1003# variables in modules should set this.
1004#
1005config ARCH_MODULE_NEEDS_WEAK_PER_CPU
1006       bool
1007
1008#
1009# UP and nommu archs use km based percpu allocator
1010#
1011config NEED_PER_CPU_KM
1012	depends on !SMP || !MMU
1013	bool
1014	default y
1015
1016config NEED_PER_CPU_EMBED_FIRST_CHUNK
1017	bool
1018
1019config NEED_PER_CPU_PAGE_FIRST_CHUNK
1020	bool
1021
1022config USE_PERCPU_NUMA_NODE_ID
1023	bool
1024
1025config HAVE_SETUP_PER_CPU_AREA
1026	bool
1027
1028config CMA
1029	bool "Contiguous Memory Allocator"
1030	depends on MMU
1031	select MIGRATION
1032	select MEMORY_ISOLATION
1033	help
1034	  This enables the Contiguous Memory Allocator which allows other
1035	  subsystems to allocate big physically-contiguous blocks of memory.
1036	  CMA reserves a region of memory and allows only movable pages to
1037	  be allocated from it. This way, the kernel can use the memory for
1038	  pagecache and when a subsystem requests for contiguous area, the
1039	  allocated pages are migrated away to serve the contiguous request.
1040
1041	  If unsure, say "n".
1042
1043config CMA_DEBUGFS
1044	bool "CMA debugfs interface"
1045	depends on CMA && DEBUG_FS
1046	help
1047	  Turns on the DebugFS interface for CMA.
1048
1049config CMA_SYSFS
1050	bool "CMA information through sysfs interface"
1051	depends on CMA && SYSFS
1052	help
1053	  This option exposes some sysfs attributes to get information
1054	  from CMA.
1055
1056config CMA_AREAS
1057	int "Maximum count of the CMA areas"
1058	depends on CMA
1059	default 20 if NUMA
1060	default 8
1061	help
1062	  CMA allows to create CMA areas for particular purpose, mainly,
1063	  used as device private area. This parameter sets the maximum
1064	  number of CMA area in the system.
1065
1066	  If unsure, leave the default value "8" in UMA and "20" in NUMA.
1067
1068#
1069# Select this config option from the architecture Kconfig, if available, to set
1070# the max page order for physically contiguous allocations.
1071#
1072config ARCH_FORCE_MAX_ORDER
1073	int
1074
1075#
1076# When ARCH_FORCE_MAX_ORDER is not defined,
1077# the default page block order is MAX_PAGE_ORDER (10) as per
1078# include/linux/mmzone.h.
1079#
1080config PAGE_BLOCK_MAX_ORDER
1081	int "Page Block Order Upper Limit"
1082	range 1 10 if ARCH_FORCE_MAX_ORDER = 0
1083	default 10 if ARCH_FORCE_MAX_ORDER = 0
1084	range 1 ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0
1085	default ARCH_FORCE_MAX_ORDER if ARCH_FORCE_MAX_ORDER != 0
1086	help
1087	  The page block order refers to the power of two number of pages that
1088	  are physically contiguous and can have a migrate type associated to
1089	  them. The maximum size of the page block order is at least limited by
1090	  ARCH_FORCE_MAX_ORDER/MAX_PAGE_ORDER.
1091
1092	  This config adds a new upper limit of default page block
1093	  order when the page block order is required to be smaller than
1094	  ARCH_FORCE_MAX_ORDER/MAX_PAGE_ORDER or other limits
1095	  (see include/linux/pageblock-flags.h for details).
1096
1097	  Reducing pageblock order can negatively impact THP generation
1098	  success rate. If your workloads use THP heavily, please use this
1099	  option with caution.
1100
1101	  Don't change if unsure.
1102
1103config MEM_SOFT_DIRTY
1104	bool "Track memory changes"
1105	depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
1106	select PROC_PAGE_MONITOR
1107	help
1108	  This option enables memory changes tracking by introducing a
1109	  soft-dirty bit on pte-s. This bit it set when someone writes
1110	  into a page just as regular dirty bit, but unlike the latter
1111	  it can be cleared by hands.
1112
1113	  See Documentation/admin-guide/mm/soft-dirty.rst for more details.
1114
1115config GENERIC_EARLY_IOREMAP
1116	bool
1117
1118config STACK_MAX_DEFAULT_SIZE_MB
1119	int "Default maximum user stack size for 32-bit processes (MB)"
1120	default 100
1121	range 8 2048
1122	depends on STACK_GROWSUP && (!64BIT || COMPAT)
1123	help
1124	  This is the maximum stack size in Megabytes in the VM layout of 32-bit
1125	  user processes when the stack grows upwards (currently only on parisc
1126	  arch) when the RLIMIT_STACK hard limit is unlimited.
1127
1128	  A sane initial value is 100 MB.
1129
1130config DEFERRED_STRUCT_PAGE_INIT
1131	bool "Defer initialisation of struct pages to kthreads"
1132	depends on SPARSEMEM
1133	depends on !NEED_PER_CPU_KM
1134	depends on 64BIT
1135	depends on !KMSAN
1136	select PADATA
1137	help
1138	  Ordinarily all struct pages are initialised during early boot in a
1139	  single thread. On very large machines this can take a considerable
1140	  amount of time. If this option is set, large machines will bring up
1141	  a subset of memmap at boot and then initialise the rest in parallel.
1142	  This has a potential performance impact on tasks running early in the
1143	  lifetime of the system until these kthreads finish the
1144	  initialisation.
1145
1146config PAGE_IDLE_FLAG
1147	bool
1148	select PAGE_EXTENSION if !64BIT
1149	help
1150	  This adds PG_idle and PG_young flags to 'struct page'.  PTE Accessed
1151	  bit writers can set the state of the bit in the flags so that PTE
1152	  Accessed bit readers may avoid disturbance.
1153
1154config IDLE_PAGE_TRACKING
1155	bool "Enable idle page tracking"
1156	depends on SYSFS && MMU
1157	select PAGE_IDLE_FLAG
1158	help
1159	  This feature allows to estimate the amount of user pages that have
1160	  not been touched during a given period of time. This information can
1161	  be useful to tune memory cgroup limits and/or for job placement
1162	  within a compute cluster.
1163
1164	  See Documentation/admin-guide/mm/idle_page_tracking.rst for
1165	  more details.
1166
1167# Architectures which implement cpu_dcache_is_aliasing() to query
1168# whether the data caches are aliased (VIVT or VIPT with dcache
1169# aliasing) need to select this.
1170config ARCH_HAS_CPU_CACHE_ALIASING
1171	bool
1172
1173config ARCH_HAS_CACHE_LINE_SIZE
1174	bool
1175
1176config ARCH_HAS_CURRENT_STACK_POINTER
1177	bool
1178	help
1179	  In support of HARDENED_USERCOPY performing stack variable lifetime
1180	  checking, an architecture-agnostic way to find the stack pointer
1181	  is needed. Once an architecture defines an unsigned long global
1182	  register alias named "current_stack_pointer", this config can be
1183	  selected.
1184
1185config ARCH_HAS_ZONE_DMA_SET
1186	bool
1187
1188config ZONE_DMA
1189	bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
1190	default y if ARM64 || X86
1191
1192config ZONE_DMA32
1193	bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
1194	depends on !X86_32
1195	default y if ARM64
1196
1197config ZONE_DEVICE
1198	bool "Device memory (pmem, HMM, etc...) hotplug support"
1199	depends on MEMORY_HOTPLUG
1200	depends on MEMORY_HOTREMOVE
1201	depends on SPARSEMEM_VMEMMAP
1202	select XARRAY_MULTI
1203
1204	help
1205	  Device memory hotplug support allows for establishing pmem,
1206	  or other device driver discovered memory regions, in the
1207	  memmap. This allows pfn_to_page() lookups of otherwise
1208	  "device-physical" addresses which is needed for DAX, PCI_P2PDMA, and
1209	  DEVICE_PRIVATE features among others.
1210
1211	  Enabling this option will reduce the entropy of x86 KASLR memory
1212	  regions. For example - on a 46 bit system, the entropy goes down
1213	  from 16 bits to 15 bits. The actual reduction in entropy depends
1214	  on the physical address bits, on processor features, kernel config
1215	  (5 level page table) and physical memory present on the system.
1216
1217#
1218# Helpers to mirror range of the CPU page tables of a process into device page
1219# tables.
1220#
1221config HMM_MIRROR
1222	bool
1223	depends on MMU
1224
1225config GET_FREE_REGION
1226	bool
1227
1228config DEVICE_PRIVATE
1229	bool "Unaddressable device memory (GPU memory, ...)"
1230	depends on ZONE_DEVICE
1231	select GET_FREE_REGION
1232
1233	help
1234	  Allows creation of struct pages to represent unaddressable device
1235	  memory; i.e., memory that is only accessible from the device (or
1236	  group of devices). You likely also want to select HMM_MIRROR.
1237
1238config VMAP_PFN
1239	bool
1240
1241config ARCH_USES_HIGH_VMA_FLAGS
1242	bool
1243config ARCH_HAS_PKEYS
1244	bool
1245
1246config ARCH_USES_PG_ARCH_2
1247	bool
1248config ARCH_USES_PG_ARCH_3
1249	bool
1250
1251config VM_EVENT_COUNTERS
1252	default y
1253	bool "Enable VM event counters for /proc/vmstat" if EXPERT
1254	help
1255	  VM event counters are needed for event counts to be shown.
1256	  This option allows the disabling of the VM event counters
1257	  on EXPERT systems.  /proc/vmstat will only show page counts
1258	  if VM event counters are disabled.
1259
1260config PERCPU_STATS
1261	bool "Collect percpu memory statistics"
1262	help
1263	  This feature collects and exposes statistics via debugfs. The
1264	  information includes global and per chunk statistics, which can
1265	  be used to help understand percpu memory usage.
1266
1267config GUP_TEST
1268	bool "Enable infrastructure for get_user_pages()-related unit tests"
1269	depends on DEBUG_FS
1270	help
1271	  Provides /sys/kernel/debug/gup_test, which in turn provides a way
1272	  to make ioctl calls that can launch kernel-based unit tests for
1273	  the get_user_pages*() and pin_user_pages*() family of API calls.
1274
1275	  These tests include benchmark testing of the _fast variants of
1276	  get_user_pages*() and pin_user_pages*(), as well as smoke tests of
1277	  the non-_fast variants.
1278
1279	  There is also a sub-test that allows running dump_page() on any
1280	  of up to eight pages (selected by command line args) within the
1281	  range of user-space addresses. These pages are either pinned via
1282	  pin_user_pages*(), or pinned via get_user_pages*(), as specified
1283	  by other command line arguments.
1284
1285	  See tools/testing/selftests/mm/gup_test.c
1286
1287comment "GUP_TEST needs to have DEBUG_FS enabled"
1288	depends on !GUP_TEST && !DEBUG_FS
1289
1290config GUP_GET_PXX_LOW_HIGH
1291	bool
1292
1293config DMAPOOL_TEST
1294	tristate "Enable a module to run time tests on dma_pool"
1295	depends on HAS_DMA
1296	help
1297	  Provides a test module that will allocate and free many blocks of
1298	  various sizes and report how long it takes. This is intended to
1299	  provide a consistent way to measure how changes to the
1300	  dma_pool_alloc/free routines affect performance.
1301
1302config ARCH_HAS_PTE_SPECIAL
1303	bool
1304
1305config MAPPING_DIRTY_HELPERS
1306        bool
1307
1308config KMAP_LOCAL
1309	bool
1310
1311config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
1312	bool
1313
1314config MEMFD_CREATE
1315	bool "Enable memfd_create() system call" if EXPERT
1316
1317config SECRETMEM
1318	default y
1319	bool "Enable memfd_secret() system call" if EXPERT
1320	depends on ARCH_HAS_SET_DIRECT_MAP
1321	help
1322	  Enable the memfd_secret() system call with the ability to create
1323	  memory areas visible only in the context of the owning process and
1324	  not mapped to other processes and other kernel page tables.
1325
1326config ANON_VMA_NAME
1327	bool "Anonymous VMA name support"
1328	depends on PROC_FS && ADVISE_SYSCALLS && MMU
1329
1330	help
1331	  Allow naming anonymous virtual memory areas.
1332
1333	  This feature allows assigning names to virtual memory areas. Assigned
1334	  names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
1335	  and help identifying individual anonymous memory areas.
1336	  Assigning a name to anonymous virtual memory area might prevent that
1337	  area from being merged with adjacent virtual memory areas due to the
1338	  difference in their name.
1339
1340config HAVE_ARCH_USERFAULTFD_WP
1341	bool
1342	help
1343	  Arch has userfaultfd write protection support
1344
1345config HAVE_ARCH_USERFAULTFD_MINOR
1346	bool
1347	help
1348	  Arch has userfaultfd minor fault support
1349
1350menuconfig USERFAULTFD
1351	bool "Enable userfaultfd() system call"
1352	depends on MMU
1353	help
1354	  Enable the userfaultfd() system call that allows to intercept and
1355	  handle page faults in userland.
1356
1357if USERFAULTFD
1358config PTE_MARKER_UFFD_WP
1359	bool "Userfaultfd write protection support for shmem/hugetlbfs"
1360	default y
1361	depends on HAVE_ARCH_USERFAULTFD_WP
1362
1363	help
1364	  Allows to create marker PTEs for userfaultfd write protection
1365	  purposes.  It is required to enable userfaultfd write protection on
1366	  file-backed memory types like shmem and hugetlbfs.
1367endif # USERFAULTFD
1368
1369# multi-gen LRU {
1370config LRU_GEN
1371	bool "Multi-Gen LRU"
1372	depends on MMU
1373	# make sure folio->flags has enough spare bits
1374	depends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP
1375	help
1376	  A high performance LRU implementation to overcommit memory. See
1377	  Documentation/admin-guide/mm/multigen_lru.rst for details.
1378
1379config LRU_GEN_ENABLED
1380	bool "Enable by default"
1381	depends on LRU_GEN
1382	help
1383	  This option enables the multi-gen LRU by default.
1384
1385config LRU_GEN_STATS
1386	bool "Full stats for debugging"
1387	depends on LRU_GEN
1388	help
1389	  Do not enable this option unless you plan to look at historical stats
1390	  from evicted generations for debugging purpose.
1391
1392	  This option has a per-memcg and per-node memory overhead.
1393
1394config LRU_GEN_WALKS_MMU
1395	def_bool y
1396	depends on LRU_GEN && ARCH_HAS_HW_PTE_YOUNG
1397# }
1398
1399config ARCH_SUPPORTS_PER_VMA_LOCK
1400       def_bool n
1401
1402config PER_VMA_LOCK
1403	def_bool y
1404	depends on ARCH_SUPPORTS_PER_VMA_LOCK && MMU && SMP
1405	help
1406	  Allow per-vma locking during page fault handling.
1407
1408	  This feature allows locking each virtual memory area separately when
1409	  handling page faults instead of taking mmap_lock.
1410
1411config LOCK_MM_AND_FIND_VMA
1412	bool
1413	depends on !STACK_GROWSUP
1414
1415config IOMMU_MM_DATA
1416	bool
1417
1418config EXECMEM
1419	bool
1420
1421config NUMA_MEMBLKS
1422	bool
1423
1424config NUMA_EMU
1425	bool "NUMA emulation"
1426	depends on NUMA_MEMBLKS
1427	depends on X86 || GENERIC_ARCH_NUMA
1428	help
1429	  Enable NUMA emulation. A flat machine will be split
1430	  into virtual nodes when booted with "numa=fake=N", where N is the
1431	  number of nodes. This is only useful for debugging.
1432
1433config ARCH_HAS_USER_SHADOW_STACK
1434	bool
1435	help
1436	  The architecture has hardware support for userspace shadow call
1437          stacks (eg, x86 CET, arm64 GCS or RISC-V Zicfiss).
1438
1439config HAVE_ARCH_TLB_REMOVE_TABLE
1440	def_bool n
1441
1442config PT_RECLAIM
1443	def_bool y
1444	depends on MMU_GATHER_RCU_TABLE_FREE && !HAVE_ARCH_TLB_REMOVE_TABLE
1445	help
1446	  Try to reclaim empty user page table pages in paths other than munmap
1447	  and exit_mmap path.
1448
1449	  Note: now only empty user PTE page table pages will be reclaimed.
1450
1451config FIND_NORMAL_PAGE
1452	def_bool n
1453
1454config ARCH_HAS_LAZY_MMU_MODE
1455	bool
1456	help
1457	  The architecture uses the lazy MMU mode. This allows changes to
1458	  MMU-related architectural state to be deferred until the mode is
1459	  exited. See <linux/pgtable.h> for details.
1460
1461config LAZY_MMU_MODE_KUNIT_TEST
1462	tristate "KUnit tests for the lazy MMU mode" if !KUNIT_ALL_TESTS
1463	depends on ARCH_HAS_LAZY_MMU_MODE
1464	depends on KUNIT
1465	default KUNIT_ALL_TESTS
1466	help
1467	  Enable this option to check that the lazy MMU mode interface behaves
1468	  as expected. Only tests for the generic interface are included (not
1469	  architecture-specific behaviours).
1470
1471	  If unsure, say N.
1472
1473source "mm/damon/Kconfig"
1474
1475endmenu
1476