• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SPDX-License-Identifier: GPL-2.0-only
2
3menu "Memory Management options"
4
5config SELECT_MEMORY_MODEL
6	def_bool y
7	depends on ARCH_SELECT_MEMORY_MODEL
8
9choice
10	prompt "Memory model"
11	depends on SELECT_MEMORY_MODEL
12	default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
13	default FLATMEM_MANUAL
14	help
15	  This option allows you to change some of the ways that
16	  Linux manages its memory internally. Most users will
17	  only have one option here selected by the architecture
18	  configuration. This is normal.
19
20config FLATMEM_MANUAL
21	bool "Flat Memory"
22	depends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE
23	help
24	  This option is best suited for non-NUMA systems with
25	  flat address space. The FLATMEM is the most efficient
26	  system in terms of performance and resource consumption
27	  and it is the best option for smaller systems.
28
29	  For systems that have holes in their physical address
30	  spaces and for features like NUMA and memory hotplug,
31	  choose "Sparse Memory".
32
33	  If unsure, choose this option (Flat Memory) over any other.
34
35config SPARSEMEM_MANUAL
36	bool "Sparse Memory"
37	depends on ARCH_SPARSEMEM_ENABLE
38	help
39	  This will be the only option for some systems, including
40	  memory hot-plug systems.  This is normal.
41
42	  This option provides efficient support for systems with
43	  holes is their physical address space and allows memory
44	  hot-plug and hot-remove.
45
46	  If unsure, choose "Flat Memory" over this option.
47
48endchoice
49
50config SPARSEMEM
51	def_bool y
52	depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
53
54config FLATMEM
55	def_bool y
56	depends on !SPARSEMEM || FLATMEM_MANUAL
57
58#
59# SPARSEMEM_EXTREME (which is the default) does some bootmem
60# allocations when sparse_init() is called.  If this cannot
61# be done on your architecture, select this option.  However,
62# statically allocating the mem_section[] array can potentially
63# consume vast quantities of .bss, so be careful.
64#
65# This option will also potentially produce smaller runtime code
66# with gcc 3.4 and later.
67#
68config SPARSEMEM_STATIC
69	bool
70
71#
72# Architecture platforms which require a two level mem_section in SPARSEMEM
73# must select this option. This is usually for architecture platforms with
74# an extremely sparse physical address space.
75#
76config SPARSEMEM_EXTREME
77	def_bool y
78	depends on SPARSEMEM && !SPARSEMEM_STATIC
79
80config SPARSEMEM_VMEMMAP_ENABLE
81	bool
82
83config SPARSEMEM_VMEMMAP
84	bool "Sparse Memory virtual memmap"
85	depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
86	default y
87	help
88	  SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
89	  pfn_to_page and page_to_pfn operations.  This is the most
90	  efficient option when sufficient kernel resources are available.
91
92config HAVE_MEMBLOCK_PHYS_MAP
93	bool
94
95config HAVE_FAST_GUP
96	depends on MMU
97	bool
98
99# Don't discard allocated memory used to track "memory" and "reserved" memblocks
100# after early boot, so it can still be used to test for validity of memory.
101# Also, memblocks are updated with memory hot(un)plug.
102config ARCH_KEEP_MEMBLOCK
103	bool
104
105# Keep arch NUMA mapping infrastructure post-init.
106config NUMA_KEEP_MEMINFO
107	bool
108
109config MEMORY_ISOLATION
110	bool
111
112#
113# Only be set on architectures that have completely implemented memory hotplug
114# feature. If you are not sure, don't touch it.
115#
116config HAVE_BOOTMEM_INFO_NODE
117	def_bool n
118
119config ARCH_ENABLE_MEMORY_HOTPLUG
120	bool
121
122# eventually, we can have this option just 'select SPARSEMEM'
123config MEMORY_HOTPLUG
124	bool "Allow for memory hot-add"
125	select MEMORY_ISOLATION
126	depends on SPARSEMEM || X86_64_ACPI_NUMA
127	depends on ARCH_ENABLE_MEMORY_HOTPLUG
128	depends on 64BIT || BROKEN
129	select NUMA_KEEP_MEMINFO if NUMA
130
131config MEMORY_HOTPLUG_SPARSE
132	def_bool y
133	depends on SPARSEMEM && MEMORY_HOTPLUG
134
135config MEMORY_HOTPLUG_DEFAULT_ONLINE
136	bool "Online the newly added memory blocks by default"
137	depends on MEMORY_HOTPLUG
138	help
139	  This option sets the default policy setting for memory hotplug
140	  onlining policy (/sys/devices/system/memory/auto_online_blocks) which
141	  determines what happens to newly added memory regions. Policy setting
142	  can always be changed at runtime.
143	  See Documentation/admin-guide/mm/memory-hotplug.rst for more information.
144
145	  Say Y here if you want all hot-plugged memory blocks to appear in
146	  'online' state by default.
147	  Say N here if you want the default policy to keep all hot-plugged
148	  memory blocks in 'offline' state.
149
150config ARCH_ENABLE_MEMORY_HOTREMOVE
151	bool
152
153config MEMORY_HOTREMOVE
154	bool "Allow for memory hot remove"
155	select HAVE_BOOTMEM_INFO_NODE if (X86_64 || PPC64)
156	depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
157	depends on MIGRATION
158
159config MHP_MEMMAP_ON_MEMORY
160	def_bool y
161	depends on MEMORY_HOTPLUG && SPARSEMEM_VMEMMAP
162	depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
163
164# Heavily threaded applications may benefit from splitting the mm-wide
165# page_table_lock, so that faults on different parts of the user address
166# space can be handled with less contention: split it at this NR_CPUS.
167# Default to 4 for wider testing, though 8 might be more appropriate.
168# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
169# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
170# SPARC32 allocates multiple pte tables within a single page, and therefore
171# a per-page lock leads to problems when multiple tables need to be locked
172# at the same time (e.g. copy_page_range()).
173# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
174#
175config SPLIT_PTLOCK_CPUS
176	int
177	default "999999" if !MMU
178	default "999999" if ARM && !CPU_CACHE_VIPT
179	default "999999" if PARISC && !PA20
180	default "999999" if SPARC32
181	default "4"
182
183config ARCH_ENABLE_SPLIT_PMD_PTLOCK
184	bool
185
186#
187# support for memory balloon
188config MEMORY_BALLOON
189	bool
190
191#
192# support for memory relinquish
193config MEMORY_RELINQUISH
194	def_bool y
195	depends on ARCH_HAS_MEM_RELINQUISH
196	depends on MEMORY_BALLOON || PAGE_REPORTING
197
198#
199# support for memory balloon compaction
200config BALLOON_COMPACTION
201	bool "Allow for balloon memory compaction/migration"
202	def_bool y
203	depends on COMPACTION && MEMORY_BALLOON
204	help
205	  Memory fragmentation introduced by ballooning might reduce
206	  significantly the number of 2MB contiguous memory blocks that can be
207	  used within a guest, thus imposing performance penalties associated
208	  with the reduced number of transparent huge pages that could be used
209	  by the guest workload. Allowing the compaction & migration for memory
210	  pages enlisted as being part of memory balloon devices avoids the
211	  scenario aforementioned and helps improving memory defragmentation.
212
213#
214# support for memory compaction
215config COMPACTION
216	bool "Allow for memory compaction"
217	def_bool y
218	select MIGRATION
219	depends on MMU
220	help
221	  Compaction is the only memory management component to form
222	  high order (larger physically contiguous) memory blocks
223	  reliably. The page allocator relies on compaction heavily and
224	  the lack of the feature can lead to unexpected OOM killer
225	  invocations for high order memory requests. You shouldn't
226	  disable this option unless there really is a strong reason for
227	  it and then we would be really interested to hear about that at
228	  linux-mm@kvack.org.
229
230#
231# support for free page reporting
232config PAGE_REPORTING
233	bool "Free page reporting"
234	def_bool n
235	help
236	  Free page reporting allows for the incremental acquisition of
237	  free pages from the buddy allocator for the purpose of reporting
238	  those pages to another entity, such as a hypervisor, so that the
239	  memory can be freed within the host for other uses.
240
241#
242# support for page migration
243#
244config MIGRATION
245	bool "Page migration"
246	def_bool y
247	depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU
248	help
249	  Allows the migration of the physical location of pages of processes
250	  while the virtual addresses are not changed. This is useful in
251	  two situations. The first is on NUMA systems to put pages nearer
252	  to the processors accessing. The second is when allocating huge
253	  pages as migration can relocate pages to satisfy a huge page
254	  allocation instead of reclaiming.
255
256config ARCH_ENABLE_HUGEPAGE_MIGRATION
257	bool
258
259config ARCH_ENABLE_THP_MIGRATION
260	bool
261
262config HUGETLB_PAGE_SIZE_VARIABLE
263	def_bool n
264	help
265	  Allows the pageblock_order value to be dynamic instead of just standard
266	  HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes available
267	  on a platform.
268
269config CONTIG_ALLOC
270	def_bool (MEMORY_ISOLATION && COMPACTION) || CMA
271
272config PHYS_ADDR_T_64BIT
273	def_bool 64BIT
274
275config BOUNCE
276	bool "Enable bounce buffers"
277	default y
278	depends on BLOCK && MMU && HIGHMEM
279	help
280	  Enable bounce buffers for devices that cannot access the full range of
281	  memory available to the CPU. Enabled by default when HIGHMEM is
282	  selected, but you may say n to override this.
283
284config VIRT_TO_BUS
285	bool
286	help
287	  An architecture should select this if it implements the
288	  deprecated interface virt_to_bus().  All new architectures
289	  should probably not select this.
290
291
292config MMU_NOTIFIER
293	bool
294	select SRCU
295	select INTERVAL_TREE
296
297config KSM
298	bool "Enable KSM for page merging"
299	depends on MMU
300	select XXHASH
301	help
302	  Enable Kernel Samepage Merging: KSM periodically scans those areas
303	  of an application's address space that an app has advised may be
304	  mergeable.  When it finds pages of identical content, it replaces
305	  the many instances by a single page with that content, so
306	  saving memory until one or another app needs to modify the content.
307	  Recommended for use with KVM, or with other duplicative applications.
308	  See Documentation/vm/ksm.rst for more information: KSM is inactive
309	  until a program has madvised that an area is MADV_MERGEABLE, and
310	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
311
312config DEFAULT_MMAP_MIN_ADDR
313	int "Low address space to protect from user allocation"
314	depends on MMU
315	default 4096
316	help
317	  This is the portion of low virtual memory which should be protected
318	  from userspace allocation.  Keeping a user from writing to low pages
319	  can help reduce the impact of kernel NULL pointer bugs.
320
321	  For most ia64, ppc64 and x86 users with lots of address space
322	  a value of 65536 is reasonable and should cause no problems.
323	  On arm and other archs it should not be higher than 32768.
324	  Programs which use vm86 functionality or have some need to map
325	  this low address space will need CAP_SYS_RAWIO or disable this
326	  protection by setting the value to 0.
327
328	  This value can be changed after boot using the
329	  /proc/sys/vm/mmap_min_addr tunable.
330
331config ARCH_SUPPORTS_MEMORY_FAILURE
332	bool
333
334config MEMORY_FAILURE
335	depends on MMU
336	depends on ARCH_SUPPORTS_MEMORY_FAILURE
337	bool "Enable recovery from hardware memory errors"
338	select MEMORY_ISOLATION
339	select RAS
340	help
341	  Enables code to recover from some memory failures on systems
342	  with MCA recovery. This allows a system to continue running
343	  even when some of its memory has uncorrected errors. This requires
344	  special hardware support and typically ECC memory.
345
346config HWPOISON_INJECT
347	tristate "HWPoison pages injector"
348	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
349	select PROC_PAGE_MONITOR
350
351config NOMMU_INITIAL_TRIM_EXCESS
352	int "Turn on mmap() excess space trimming before booting"
353	depends on !MMU
354	default 1
355	help
356	  The NOMMU mmap() frequently needs to allocate large contiguous chunks
357	  of memory on which to store mappings, but it can only ask the system
358	  allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
359	  more than it requires.  To deal with this, mmap() is able to trim off
360	  the excess and return it to the allocator.
361
362	  If trimming is enabled, the excess is trimmed off and returned to the
363	  system allocator, which can cause extra fragmentation, particularly
364	  if there are a lot of transient processes.
365
366	  If trimming is disabled, the excess is kept, but not used, which for
367	  long-term mappings means that the space is wasted.
368
369	  Trimming can be dynamically controlled through a sysctl option
370	  (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
371	  excess pages there must be before trimming should occur, or zero if
372	  no trimming is to occur.
373
374	  This option specifies the initial value of this option.  The default
375	  of 1 says that all excess pages should be trimmed.
376
377	  See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
378
379config TRANSPARENT_HUGEPAGE
380	bool "Transparent Hugepage Support"
381	depends on HAVE_ARCH_TRANSPARENT_HUGEPAGE
382	select COMPACTION
383	select XARRAY_MULTI
384	help
385	  Transparent Hugepages allows the kernel to use huge pages and
386	  huge tlb transparently to the applications whenever possible.
387	  This feature can improve computing performance to certain
388	  applications by speeding up page faults during memory
389	  allocation, by reducing the number of tlb misses and by speeding
390	  up the pagetable walking.
391
392	  If memory constrained on embedded, you may want to say N.
393
394choice
395	prompt "Transparent Hugepage Support sysfs defaults"
396	depends on TRANSPARENT_HUGEPAGE
397	default TRANSPARENT_HUGEPAGE_ALWAYS
398	help
399	  Selects the sysfs defaults for Transparent Hugepage Support.
400
401	config TRANSPARENT_HUGEPAGE_ALWAYS
402		bool "always"
403	help
404	  Enabling Transparent Hugepage always, can increase the
405	  memory footprint of applications without a guaranteed
406	  benefit but it will work automatically for all applications.
407
408	config TRANSPARENT_HUGEPAGE_MADVISE
409		bool "madvise"
410	help
411	  Enabling Transparent Hugepage madvise, will only provide a
412	  performance improvement benefit to the applications using
413	  madvise(MADV_HUGEPAGE) but it won't risk to increase the
414	  memory footprint of applications without a guaranteed
415	  benefit.
416endchoice
417
418config ARCH_WANTS_THP_SWAP
419	def_bool n
420
421config THP_SWAP
422	def_bool y
423	depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP
424	help
425	  Swap transparent huge pages in one piece, without splitting.
426	  XXX: For now, swap cluster backing transparent huge page
427	  will be split after swapout.
428
429	  For selection by architectures with reasonable THP sizes.
430
431#
432# UP and nommu archs use km based percpu allocator
433#
434config NEED_PER_CPU_KM
435	depends on !SMP
436	bool
437	default y
438
439config CLEANCACHE
440	bool "Enable cleancache driver to cache clean pages if tmem is present"
441	help
442	  Cleancache can be thought of as a page-granularity victim cache
443	  for clean pages that the kernel's pageframe replacement algorithm
444	  (PFRA) would like to keep around, but can't since there isn't enough
445	  memory.  So when the PFRA "evicts" a page, it first attempts to use
446	  cleancache code to put the data contained in that page into
447	  "transcendent memory", memory that is not directly accessible or
448	  addressable by the kernel and is of unknown and possibly
449	  time-varying size.  And when a cleancache-enabled
450	  filesystem wishes to access a page in a file on disk, it first
451	  checks cleancache to see if it already contains it; if it does,
452	  the page is copied into the kernel and a disk access is avoided.
453	  When a transcendent memory driver is available (such as zcache or
454	  Xen transcendent memory), a significant I/O reduction
455	  may be achieved.  When none is available, all cleancache calls
456	  are reduced to a single pointer-compare-against-NULL resulting
457	  in a negligible performance hit.
458
459	  If unsure, say Y to enable cleancache
460
461config FRONTSWAP
462	bool "Enable frontswap to cache swap pages if tmem is present"
463	depends on SWAP
464	help
465	  Frontswap is so named because it can be thought of as the opposite
466	  of a "backing" store for a swap device.  The data is stored into
467	  "transcendent memory", memory that is not directly accessible or
468	  addressable by the kernel and is of unknown and possibly
469	  time-varying size.  When space in transcendent memory is available,
470	  a significant swap I/O reduction may be achieved.  When none is
471	  available, all frontswap calls are reduced to a single pointer-
472	  compare-against-NULL resulting in a negligible performance hit
473	  and swap data is stored as normal on the matching swap device.
474
475	  If unsure, say Y to enable frontswap.
476
477config CMA
478	bool "Contiguous Memory Allocator"
479	depends on MMU
480	select MIGRATION
481	select MEMORY_ISOLATION
482	help
483	  This enables the Contiguous Memory Allocator which allows other
484	  subsystems to allocate big physically-contiguous blocks of memory.
485	  CMA reserves a region of memory and allows only movable pages to
486	  be allocated from it. This way, the kernel can use the memory for
487	  pagecache and when a subsystem requests for contiguous area, the
488	  allocated pages are migrated away to serve the contiguous request.
489
490	  If unsure, say "n".
491
492config CMA_DEBUG
493	bool "CMA debug messages (DEVELOPMENT)"
494	depends on DEBUG_KERNEL && CMA
495	help
496	  Turns on debug messages in CMA.  This produces KERN_DEBUG
497	  messages for every CMA call as well as various messages while
498	  processing calls such as dma_alloc_from_contiguous().
499	  This option does not affect warning and error messages.
500
501config CMA_DEBUGFS
502	bool "CMA debugfs interface"
503	depends on CMA && DEBUG_FS
504	help
505	  Turns on the DebugFS interface for CMA.
506
507config CMA_SYSFS
508	bool "CMA information through sysfs interface"
509	depends on CMA && SYSFS
510	help
511	  This option exposes some sysfs attributes to get information
512	  from CMA.
513
514config CMA_AREAS
515	int "Maximum count of the CMA areas"
516	depends on CMA
517	default 19 if NUMA
518	default 7
519	help
520	  CMA allows to create CMA areas for particular purpose, mainly,
521	  used as device private area. This parameter sets the maximum
522	  number of CMA area in the system.
523
524	  If unsure, leave the default value "7" in UMA and "19" in NUMA.
525
526config MEM_SOFT_DIRTY
527	bool "Track memory changes"
528	depends on CHECKPOINT_RESTORE && HAVE_ARCH_SOFT_DIRTY && PROC_FS
529	select PROC_PAGE_MONITOR
530	help
531	  This option enables memory changes tracking by introducing a
532	  soft-dirty bit on pte-s. This bit it set when someone writes
533	  into a page just as regular dirty bit, but unlike the latter
534	  it can be cleared by hands.
535
536	  See Documentation/admin-guide/mm/soft-dirty.rst for more details.
537
538config ZSWAP
539	bool "Compressed cache for swap pages (EXPERIMENTAL)"
540	depends on FRONTSWAP && CRYPTO=y
541	select ZPOOL
542	help
543	  A lightweight compressed cache for swap pages.  It takes
544	  pages that are in the process of being swapped out and attempts to
545	  compress them into a dynamically allocated RAM-based memory pool.
546	  This can result in a significant I/O reduction on swap device and,
547	  in the case where decompressing from RAM is faster that swap device
548	  reads, can also improve workload performance.
549
550	  This is marked experimental because it is a new feature (as of
551	  v3.11) that interacts heavily with memory reclaim.  While these
552	  interactions don't cause any known issues on simple memory setups,
553	  they have not be fully explored on the large set of potential
554	  configurations and workloads that exist.
555
556choice
557	prompt "Compressed cache for swap pages default compressor"
558	depends on ZSWAP
559	default ZSWAP_COMPRESSOR_DEFAULT_LZO
560	help
561	  Selects the default compression algorithm for the compressed cache
562	  for swap pages.
563
564	  For an overview what kind of performance can be expected from
565	  a particular compression algorithm please refer to the benchmarks
566	  available at the following LWN page:
567	  https://lwn.net/Articles/751795/
568
569	  If in doubt, select 'LZO'.
570
571	  The selection made here can be overridden by using the kernel
572	  command line 'zswap.compressor=' option.
573
574config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
575	bool "Deflate"
576	select CRYPTO_DEFLATE
577	help
578	  Use the Deflate algorithm as the default compression algorithm.
579
580config ZSWAP_COMPRESSOR_DEFAULT_LZO
581	bool "LZO"
582	select CRYPTO_LZO
583	help
584	  Use the LZO algorithm as the default compression algorithm.
585
586config ZSWAP_COMPRESSOR_DEFAULT_842
587	bool "842"
588	select CRYPTO_842
589	help
590	  Use the 842 algorithm as the default compression algorithm.
591
592config ZSWAP_COMPRESSOR_DEFAULT_LZ4
593	bool "LZ4"
594	select CRYPTO_LZ4
595	help
596	  Use the LZ4 algorithm as the default compression algorithm.
597
598config ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
599	bool "LZ4HC"
600	select CRYPTO_LZ4HC
601	help
602	  Use the LZ4HC algorithm as the default compression algorithm.
603
604config ZSWAP_COMPRESSOR_DEFAULT_ZSTD
605	bool "zstd"
606	select CRYPTO_ZSTD
607	help
608	  Use the zstd algorithm as the default compression algorithm.
609endchoice
610
611config ZSWAP_COMPRESSOR_DEFAULT
612       string
613       depends on ZSWAP
614       default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE
615       default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO
616       default "842" if ZSWAP_COMPRESSOR_DEFAULT_842
617       default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4
618       default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC
619       default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD
620       default ""
621
622choice
623	prompt "Compressed cache for swap pages default allocator"
624	depends on ZSWAP
625	default ZSWAP_ZPOOL_DEFAULT_ZBUD
626	help
627	  Selects the default allocator for the compressed cache for
628	  swap pages.
629	  The default is 'zbud' for compatibility, however please do
630	  read the description of each of the allocators below before
631	  making a right choice.
632
633	  The selection made here can be overridden by using the kernel
634	  command line 'zswap.zpool=' option.
635
636config ZSWAP_ZPOOL_DEFAULT_ZBUD
637	bool "zbud"
638	select ZBUD
639	help
640	  Use the zbud allocator as the default allocator.
641
642config ZSWAP_ZPOOL_DEFAULT_Z3FOLD
643	bool "z3fold"
644	select Z3FOLD
645	help
646	  Use the z3fold allocator as the default allocator.
647
648config ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
649	bool "zsmalloc"
650	select ZSMALLOC
651	help
652	  Use the zsmalloc allocator as the default allocator.
653endchoice
654
655config ZSWAP_ZPOOL_DEFAULT
656       string
657       depends on ZSWAP
658       default "zbud" if ZSWAP_ZPOOL_DEFAULT_ZBUD
659       default "z3fold" if ZSWAP_ZPOOL_DEFAULT_Z3FOLD
660       default "zsmalloc" if ZSWAP_ZPOOL_DEFAULT_ZSMALLOC
661       default ""
662
663config ZSWAP_DEFAULT_ON
664	bool "Enable the compressed cache for swap pages by default"
665	depends on ZSWAP
666	help
667	  If selected, the compressed cache for swap pages will be enabled
668	  at boot, otherwise it will be disabled.
669
670	  The selection made here can be overridden by using the kernel
671	  command line 'zswap.enabled=' option.
672
673config ZPOOL
674	tristate "Common API for compressed memory storage"
675	help
676	  Compressed memory storage API.  This allows using either zbud or
677	  zsmalloc.
678
679config ZBUD
680	tristate "Low (Up to 2x) density storage for compressed pages"
681	depends on ZPOOL
682	help
683	  A special purpose allocator for storing compressed pages.
684	  It is designed to store up to two compressed pages per physical
685	  page.  While this design limits storage density, it has simple and
686	  deterministic reclaim properties that make it preferable to a higher
687	  density approach when reclaim will be used.
688
689config Z3FOLD
690	tristate "Up to 3x density storage for compressed pages"
691	depends on ZPOOL
692	help
693	  A special purpose allocator for storing compressed pages.
694	  It is designed to store up to three compressed pages per physical
695	  page. It is a ZBUD derivative so the simplicity and determinism are
696	  still there.
697
698config ZSMALLOC
699	tristate "Memory allocator for compressed pages"
700	depends on MMU
701	help
702	  zsmalloc is a slab-based memory allocator designed to store
703	  compressed RAM pages.  zsmalloc uses virtual memory mapping
704	  in order to reduce fragmentation.  However, this results in a
705	  non-standard allocator interface where a handle, not a pointer, is
706	  returned by an alloc().  This handle must be mapped in order to
707	  access the allocated space.
708
709config ZSMALLOC_STAT
710	bool "Export zsmalloc statistics"
711	depends on ZSMALLOC
712	select DEBUG_FS
713	help
714	  This option enables code in the zsmalloc to collect various
715	  statistics about what's happening in zsmalloc and exports that
716	  information to userspace via debugfs.
717	  If unsure, say N.
718
719config GENERIC_EARLY_IOREMAP
720	bool
721
722config STACK_MAX_DEFAULT_SIZE_MB
723	int "Default maximum user stack size for 32-bit processes (MB)"
724	default 100
725	range 8 2048
726	depends on STACK_GROWSUP && (!64BIT || COMPAT)
727	help
728	  This is the maximum stack size in Megabytes in the VM layout of 32-bit
729	  user processes when the stack grows upwards (currently only on parisc
730	  arch) when the RLIMIT_STACK hard limit is unlimited.
731
732	  A sane initial value is 100 MB.
733
734config DEFERRED_STRUCT_PAGE_INIT
735	bool "Defer initialisation of struct pages to kthreads"
736	depends on SPARSEMEM
737	depends on !NEED_PER_CPU_KM
738	depends on 64BIT
739	select PADATA
740	help
741	  Ordinarily all struct pages are initialised during early boot in a
742	  single thread. On very large machines this can take a considerable
743	  amount of time. If this option is set, large machines will bring up
744	  a subset of memmap at boot and then initialise the rest in parallel.
745	  This has a potential performance impact on tasks running early in the
746	  lifetime of the system until these kthreads finish the
747	  initialisation.
748
749config PAGE_IDLE_FLAG
750	bool
751	select PAGE_EXTENSION if !64BIT
752	help
753	  This adds PG_idle and PG_young flags to 'struct page'.  PTE Accessed
754	  bit writers can set the state of the bit in the flags so that PTE
755	  Accessed bit readers may avoid disturbance.
756
757config IDLE_PAGE_TRACKING
758	bool "Enable idle page tracking"
759	depends on SYSFS && MMU
760	select PAGE_IDLE_FLAG
761	help
762	  This feature allows to estimate the amount of user pages that have
763	  not been touched during a given period of time. This information can
764	  be useful to tune memory cgroup limits and/or for job placement
765	  within a compute cluster.
766
767	  See Documentation/admin-guide/mm/idle_page_tracking.rst for
768	  more details.
769
770config ARCH_HAS_CACHE_LINE_SIZE
771	bool
772
773config ARCH_HAS_PTE_DEVMAP
774	bool
775
776config ARCH_HAS_ZONE_DMA_SET
777	bool
778
779config ZONE_DMA
780	bool "Support DMA zone" if ARCH_HAS_ZONE_DMA_SET
781	default y if ARM64 || X86
782
783config ZONE_DMA32
784	bool "Support DMA32 zone" if ARCH_HAS_ZONE_DMA_SET
785	depends on !X86_32
786	default y if ARM64
787
788config ZONE_DEVICE
789	bool "Device memory (pmem, HMM, etc...) hotplug support"
790	depends on MEMORY_HOTPLUG
791	depends on MEMORY_HOTREMOVE
792	depends on SPARSEMEM_VMEMMAP
793	depends on ARCH_HAS_PTE_DEVMAP
794	select XARRAY_MULTI
795
796	help
797	  Device memory hotplug support allows for establishing pmem,
798	  or other device driver discovered memory regions, in the
799	  memmap. This allows pfn_to_page() lookups of otherwise
800	  "device-physical" addresses which is needed for using a DAX
801	  mapping in an O_DIRECT operation, among other things.
802
803	  If FS_DAX is enabled, then say Y.
804
805config DEV_PAGEMAP_OPS
806	bool
807
808#
809# Helpers to mirror range of the CPU page tables of a process into device page
810# tables.
811#
812config HMM_MIRROR
813	bool
814	depends on MMU
815
816config DEVICE_PRIVATE
817	bool "Unaddressable device memory (GPU memory, ...)"
818	depends on ZONE_DEVICE
819	select DEV_PAGEMAP_OPS
820
821	help
822	  Allows creation of struct pages to represent unaddressable device
823	  memory; i.e., memory that is only accessible from the device (or
824	  group of devices). You likely also want to select HMM_MIRROR.
825
826config VMAP_PFN
827	bool
828
829config ARCH_USES_HIGH_VMA_FLAGS
830	bool
831config ARCH_HAS_PKEYS
832	bool
833
834config PERCPU_STATS
835	bool "Collect percpu memory statistics"
836	help
837	  This feature collects and exposes statistics via debugfs. The
838	  information includes global and per chunk statistics, which can
839	  be used to help understand percpu memory usage.
840
841config GUP_TEST
842	bool "Enable infrastructure for get_user_pages()-related unit tests"
843	depends on DEBUG_FS
844	help
845	  Provides /sys/kernel/debug/gup_test, which in turn provides a way
846	  to make ioctl calls that can launch kernel-based unit tests for
847	  the get_user_pages*() and pin_user_pages*() family of API calls.
848
849	  These tests include benchmark testing of the _fast variants of
850	  get_user_pages*() and pin_user_pages*(), as well as smoke tests of
851	  the non-_fast variants.
852
853	  There is also a sub-test that allows running dump_page() on any
854	  of up to eight pages (selected by command line args) within the
855	  range of user-space addresses. These pages are either pinned via
856	  pin_user_pages*(), or pinned via get_user_pages*(), as specified
857	  by other command line arguments.
858
859	  See tools/testing/selftests/vm/gup_test.c
860
861comment "GUP_TEST needs to have DEBUG_FS enabled"
862	depends on !GUP_TEST && !DEBUG_FS
863
864config GUP_GET_PTE_LOW_HIGH
865	bool
866
867config READ_ONLY_THP_FOR_FS
868	bool "Read-only THP for filesystems (EXPERIMENTAL)"
869	depends on TRANSPARENT_HUGEPAGE && SHMEM
870
871	help
872	  Allow khugepaged to put read-only file-backed pages in THP.
873
874	  This is marked experimental because it is a new feature. Write
875	  support of file THPs will be developed in the next few release
876	  cycles.
877
878config ARCH_HAS_PTE_SPECIAL
879	bool
880
881#
882# Some architectures require a special hugepage directory format that is
883# required to support multiple hugepage sizes. For example a4fe3ce76
884# "powerpc/mm: Allow more flexible layouts for hugepage pagetables"
885# introduced it on powerpc.  This allows for a more flexible hugepage
886# pagetable layouts.
887#
888config ARCH_HAS_HUGEPD
889	bool
890
891config MAPPING_DIRTY_HELPERS
892        bool
893
894config KMAP_LOCAL
895	bool
896
897config KMAP_LOCAL_NON_LINEAR_PTE_ARRAY
898	bool
899
900# struct io_mapping based helper.  Selected by drivers that need them
901config IO_MAPPING
902	bool
903
904# Some architectures want callbacks for all IO mappings in order to
905# track the physical addresses that get used as devices.
906config ARCH_HAS_IOREMAP_PHYS_HOOKS
907	bool
908
909config SECRETMEM
910	def_bool ARCH_HAS_SET_DIRECT_MAP && !EMBEDDED
911
912config ANON_VMA_NAME
913	bool "Anonymous VMA name support"
914	depends on PROC_FS && ADVISE_SYSCALLS && MMU
915
916	help
917	  Allow naming anonymous virtual memory areas.
918
919	  This feature allows assigning names to virtual memory areas. Assigned
920	  names can be later retrieved from /proc/pid/maps and /proc/pid/smaps
921	  and help identifying individual anonymous memory areas.
922	  Assigning a name to anonymous virtual memory area might prevent that
923	  area from being merged with adjacent virtual memory areas due to the
924	  difference in their name.
925
926# multi-gen LRU {
927config LRU_GEN
928	bool "Multi-Gen LRU"
929	depends on MMU
930	# make sure page->flags has enough spare bits
931	depends on !MAXSMP && (64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP)
932	help
933	  A high performance LRU implementation to overcommit memory. See
934	  Documentation/admin-guide/mm/multigen_lru.rst for details.
935
936config LRU_GEN_ENABLED
937	bool "Enable by default"
938	depends on LRU_GEN
939	help
940	  This option enables the multi-gen LRU by default.
941
942config LRU_GEN_STATS
943	bool "Full stats for debugging"
944	depends on LRU_GEN
945	help
946	  Do not enable this option unless you plan to look at historical stats
947	  from evicted generations for debugging purpose.
948
949	  This option has a per-memcg and per-node memory overhead.
950# }
951
952source "mm/damon/Kconfig"
953
954config ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT
955       def_bool n
956
957config SPECULATIVE_PAGE_FAULT
958	bool "Speculative page faults"
959	default y
960	depends on ARCH_SUPPORTS_SPECULATIVE_PAGE_FAULT && MMU && SMP && !NUMA
961	help
962	  Try to handle user space page faults without holding the mmap lock.
963
964	  Instead of blocking writers through the use of mmap lock,
965	  the page fault handler merely verifies, at the end of the page
966	  fault, that no writers have been running concurrently with it.
967
968	  In high concurrency situations, the speculative fault handler
969	  gains a throughput advantage by avoiding having to update the
970	  mmap lock reader count.
971
972	  If the check fails due to a concurrent writer, or due to hitting
973	  an unsupported case, the fault handler falls back to classical
974	  processing using the mmap read lock.
975
976endmenu
977