xref: /linux/mm/Kconfig (revision 9bdac914240759457175ac0d6529a37d2820bc4d)
1e1785e85SDave Hansenconfig SELECT_MEMORY_MODEL
2e1785e85SDave Hansen	def_bool y
3e1785e85SDave Hansen	depends on EXPERIMENTAL || ARCH_SELECT_MEMORY_MODEL
4e1785e85SDave Hansen
53a9da765SDave Hansenchoice
63a9da765SDave Hansen	prompt "Memory model"
7e1785e85SDave Hansen	depends on SELECT_MEMORY_MODEL
8e1785e85SDave Hansen	default DISCONTIGMEM_MANUAL if ARCH_DISCONTIGMEM_DEFAULT
9d41dee36SAndy Whitcroft	default SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT
10e1785e85SDave Hansen	default FLATMEM_MANUAL
113a9da765SDave Hansen
12e1785e85SDave Hansenconfig FLATMEM_MANUAL
133a9da765SDave Hansen	bool "Flat Memory"
14c898ec16SAnton Blanchard	depends on !(ARCH_DISCONTIGMEM_ENABLE || ARCH_SPARSEMEM_ENABLE) || ARCH_FLATMEM_ENABLE
153a9da765SDave Hansen	help
163a9da765SDave Hansen	  This option allows you to change some of the ways that
173a9da765SDave Hansen	  Linux manages its memory internally.  Most users will
183a9da765SDave Hansen	  only have one option here: FLATMEM.  This is normal
193a9da765SDave Hansen	  and a correct option.
203a9da765SDave Hansen
21d41dee36SAndy Whitcroft	  Some users of more advanced features like NUMA and
22d41dee36SAndy Whitcroft	  memory hotplug may have different options here.
23d41dee36SAndy Whitcroft	  DISCONTIGMEM is an more mature, better tested system,
24d41dee36SAndy Whitcroft	  but is incompatible with memory hotplug and may suffer
25d41dee36SAndy Whitcroft	  decreased performance over SPARSEMEM.  If unsure between
26d41dee36SAndy Whitcroft	  "Sparse Memory" and "Discontiguous Memory", choose
27d41dee36SAndy Whitcroft	  "Discontiguous Memory".
28d41dee36SAndy Whitcroft
29d41dee36SAndy Whitcroft	  If unsure, choose this option (Flat Memory) over any other.
303a9da765SDave Hansen
31e1785e85SDave Hansenconfig DISCONTIGMEM_MANUAL
32f3519f91SDave Hansen	bool "Discontiguous Memory"
333a9da765SDave Hansen	depends on ARCH_DISCONTIGMEM_ENABLE
343a9da765SDave Hansen	help
35785dcd44SDave Hansen	  This option provides enhanced support for discontiguous
36785dcd44SDave Hansen	  memory systems, over FLATMEM.  These systems have holes
37785dcd44SDave Hansen	  in their physical address spaces, and this option provides
38785dcd44SDave Hansen	  more efficient handling of these holes.  However, the vast
39785dcd44SDave Hansen	  majority of hardware has quite flat address spaces, and
40ad3d0a38SPhilipp Marek	  can have degraded performance from the extra overhead that
41785dcd44SDave Hansen	  this option imposes.
42785dcd44SDave Hansen
43785dcd44SDave Hansen	  Many NUMA configurations will have this as the only option.
44785dcd44SDave Hansen
453a9da765SDave Hansen	  If unsure, choose "Flat Memory" over this option.
463a9da765SDave Hansen
47d41dee36SAndy Whitcroftconfig SPARSEMEM_MANUAL
48d41dee36SAndy Whitcroft	bool "Sparse Memory"
49d41dee36SAndy Whitcroft	depends on ARCH_SPARSEMEM_ENABLE
50d41dee36SAndy Whitcroft	help
51d41dee36SAndy Whitcroft	  This will be the only option for some systems, including
52d41dee36SAndy Whitcroft	  memory hotplug systems.  This is normal.
53d41dee36SAndy Whitcroft
54d41dee36SAndy Whitcroft	  For many other systems, this will be an alternative to
55f3519f91SDave Hansen	  "Discontiguous Memory".  This option provides some potential
56d41dee36SAndy Whitcroft	  performance benefits, along with decreased code complexity,
57d41dee36SAndy Whitcroft	  but it is newer, and more experimental.
58d41dee36SAndy Whitcroft
59d41dee36SAndy Whitcroft	  If unsure, choose "Discontiguous Memory" or "Flat Memory"
60d41dee36SAndy Whitcroft	  over this option.
61d41dee36SAndy Whitcroft
623a9da765SDave Hansenendchoice
633a9da765SDave Hansen
64e1785e85SDave Hansenconfig DISCONTIGMEM
65e1785e85SDave Hansen	def_bool y
66e1785e85SDave Hansen	depends on (!SELECT_MEMORY_MODEL && ARCH_DISCONTIGMEM_ENABLE) || DISCONTIGMEM_MANUAL
67e1785e85SDave Hansen
68d41dee36SAndy Whitcroftconfig SPARSEMEM
69d41dee36SAndy Whitcroft	def_bool y
701a83e175SRussell King	depends on (!SELECT_MEMORY_MODEL && ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL
71d41dee36SAndy Whitcroft
72e1785e85SDave Hansenconfig FLATMEM
73e1785e85SDave Hansen	def_bool y
74d41dee36SAndy Whitcroft	depends on (!DISCONTIGMEM && !SPARSEMEM) || FLATMEM_MANUAL
75d41dee36SAndy Whitcroft
76d41dee36SAndy Whitcroftconfig FLAT_NODE_MEM_MAP
77d41dee36SAndy Whitcroft	def_bool y
78d41dee36SAndy Whitcroft	depends on !SPARSEMEM
79e1785e85SDave Hansen
8093b7504eSDave Hansen#
8193b7504eSDave Hansen# Both the NUMA code and DISCONTIGMEM use arrays of pg_data_t's
8293b7504eSDave Hansen# to represent different areas of memory.  This variable allows
8393b7504eSDave Hansen# those dependencies to exist individually.
8493b7504eSDave Hansen#
8593b7504eSDave Hansenconfig NEED_MULTIPLE_NODES
8693b7504eSDave Hansen	def_bool y
8793b7504eSDave Hansen	depends on DISCONTIGMEM || NUMA
88af705362SAndy Whitcroft
89af705362SAndy Whitcroftconfig HAVE_MEMORY_PRESENT
90af705362SAndy Whitcroft	def_bool y
91d41dee36SAndy Whitcroft	depends on ARCH_HAVE_MEMORY_PRESENT || SPARSEMEM
92802f192eSBob Picco
93802f192eSBob Picco#
943e347261SBob Picco# SPARSEMEM_EXTREME (which is the default) does some bootmem
953e347261SBob Picco# allocations when memory_present() is called.  If this cannot
963e347261SBob Picco# be done on your architecture, select this option.  However,
973e347261SBob Picco# statically allocating the mem_section[] array can potentially
983e347261SBob Picco# consume vast quantities of .bss, so be careful.
993e347261SBob Picco#
1003e347261SBob Picco# This option will also potentially produce smaller runtime code
1013e347261SBob Picco# with gcc 3.4 and later.
1023e347261SBob Picco#
1033e347261SBob Piccoconfig SPARSEMEM_STATIC
1049ba16087SJan Beulich	bool
1053e347261SBob Picco
1063e347261SBob Picco#
10744c09201SMatt LaPlante# Architecture platforms which require a two level mem_section in SPARSEMEM
108802f192eSBob Picco# must select this option. This is usually for architecture platforms with
109802f192eSBob Picco# an extremely sparse physical address space.
110802f192eSBob Picco#
1113e347261SBob Piccoconfig SPARSEMEM_EXTREME
1123e347261SBob Picco	def_bool y
1133e347261SBob Picco	depends on SPARSEMEM && !SPARSEMEM_STATIC
1144c21e2f2SHugh Dickins
11529c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP_ENABLE
1169ba16087SJan Beulich	bool
11729c71111SAndy Whitcroft
118*9bdac914SYinghai Luconfig SPARSEMEM_ALLOC_MEM_MAP_TOGETHER
119*9bdac914SYinghai Lu	def_bool y
120*9bdac914SYinghai Lu	depends on SPARSEMEM && X86_64
121*9bdac914SYinghai Lu
12229c71111SAndy Whitcroftconfig SPARSEMEM_VMEMMAP
123a5ee6daaSGeoff Levand	bool "Sparse Memory virtual memmap"
124a5ee6daaSGeoff Levand	depends on SPARSEMEM && SPARSEMEM_VMEMMAP_ENABLE
125a5ee6daaSGeoff Levand	default y
126a5ee6daaSGeoff Levand	help
127a5ee6daaSGeoff Levand	 SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
128a5ee6daaSGeoff Levand	 pfn_to_page and page_to_pfn operations.  This is the most
129a5ee6daaSGeoff Levand	 efficient option when sufficient kernel resources are available.
13029c71111SAndy Whitcroft
1313947be19SDave Hansen# eventually, we can have this option just 'select SPARSEMEM'
1323947be19SDave Hansenconfig MEMORY_HOTPLUG
1333947be19SDave Hansen	bool "Allow for memory hot-add"
134ec69acbbSKeith Mannthey	depends on SPARSEMEM || X86_64_ACPI_NUMA
1356ad696d2SAndi Kleen	depends on HOTPLUG && ARCH_ENABLE_MEMORY_HOTPLUG
136ed84a07aSKumar Gala	depends on (IA64 || X86 || PPC_BOOK3S_64 || SUPERH || S390)
1373947be19SDave Hansen
138ec69acbbSKeith Manntheyconfig MEMORY_HOTPLUG_SPARSE
139ec69acbbSKeith Mannthey	def_bool y
140ec69acbbSKeith Mannthey	depends on SPARSEMEM && MEMORY_HOTPLUG
141ec69acbbSKeith Mannthey
1420c0e6195SKAMEZAWA Hiroyukiconfig MEMORY_HOTREMOVE
1430c0e6195SKAMEZAWA Hiroyuki	bool "Allow for memory hot remove"
1440c0e6195SKAMEZAWA Hiroyuki	depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
1450c0e6195SKAMEZAWA Hiroyuki	depends on MIGRATION
1460c0e6195SKAMEZAWA Hiroyuki
147e20b8ccaSChristoph Lameter#
148e20b8ccaSChristoph Lameter# If we have space for more page flags then we can enable additional
149e20b8ccaSChristoph Lameter# optimizations and functionality.
150e20b8ccaSChristoph Lameter#
151e20b8ccaSChristoph Lameter# Regular Sparsemem takes page flag bits for the sectionid if it does not
152e20b8ccaSChristoph Lameter# use a virtual memmap. Disable extended page flags for 32 bit platforms
153e20b8ccaSChristoph Lameter# that require the use of a sectionid in the page flags.
154e20b8ccaSChristoph Lameter#
155e20b8ccaSChristoph Lameterconfig PAGEFLAGS_EXTENDED
156e20b8ccaSChristoph Lameter	def_bool y
157a269cca9SH. Peter Anvin	depends on 64BIT || SPARSEMEM_VMEMMAP || !SPARSEMEM
158e20b8ccaSChristoph Lameter
1594c21e2f2SHugh Dickins# Heavily threaded applications may benefit from splitting the mm-wide
1604c21e2f2SHugh Dickins# page_table_lock, so that faults on different parts of the user address
1614c21e2f2SHugh Dickins# space can be handled with less contention: split it at this NR_CPUS.
1624c21e2f2SHugh Dickins# Default to 4 for wider testing, though 8 might be more appropriate.
1634c21e2f2SHugh Dickins# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.
1647b6ac9dfSHugh Dickins# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.
165a70caa8bSHugh Dickins# DEBUG_SPINLOCK and DEBUG_LOCK_ALLOC spinlock_t also enlarge struct page.
1664c21e2f2SHugh Dickins#
1674c21e2f2SHugh Dickinsconfig SPLIT_PTLOCK_CPUS
1684c21e2f2SHugh Dickins	int
169a70caa8bSHugh Dickins	default "999999" if ARM && !CPU_CACHE_VIPT
170a70caa8bSHugh Dickins	default "999999" if PARISC && !PA20
171a70caa8bSHugh Dickins	default "999999" if DEBUG_SPINLOCK || DEBUG_LOCK_ALLOC
1724c21e2f2SHugh Dickins	default "4"
1737cbe34cfSChristoph Lameter
1747cbe34cfSChristoph Lameter#
1757cbe34cfSChristoph Lameter# support for page migration
1767cbe34cfSChristoph Lameter#
1777cbe34cfSChristoph Lameterconfig MIGRATION
178b20a3503SChristoph Lameter	bool "Page migration"
1796c5240aeSChristoph Lameter	def_bool y
18083d1674aSGerald Schaefer	depends on NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE
181b20a3503SChristoph Lameter	help
182b20a3503SChristoph Lameter	  Allows the migration of the physical location of pages of processes
183b20a3503SChristoph Lameter	  while the virtual addresses are not changed. This is useful for
184b20a3503SChristoph Lameter	  example on NUMA systems to put pages nearer to the processors accessing
185b20a3503SChristoph Lameter	  the page.
1866550e07fSGreg Kroah-Hartman
187600715dcSJeremy Fitzhardingeconfig PHYS_ADDR_T_64BIT
188600715dcSJeremy Fitzhardinge	def_bool 64BIT || ARCH_PHYS_ADDR_T_64BIT
189600715dcSJeremy Fitzhardinge
1904b51d669SChristoph Lameterconfig ZONE_DMA_FLAG
1914b51d669SChristoph Lameter	int
1924b51d669SChristoph Lameter	default "0" if !ZONE_DMA
1934b51d669SChristoph Lameter	default "1"
1944b51d669SChristoph Lameter
1952a7326b5SChristoph Lameterconfig BOUNCE
1962a7326b5SChristoph Lameter	def_bool y
1972a7326b5SChristoph Lameter	depends on BLOCK && MMU && (ZONE_DMA || HIGHMEM)
1982a7326b5SChristoph Lameter
1996225e937SChristoph Lameterconfig NR_QUICK
2006225e937SChristoph Lameter	int
2016225e937SChristoph Lameter	depends on QUICKLIST
20238510754SHaavard Skinnemoen	default "2" if SUPERH || AVR32
2036225e937SChristoph Lameter	default "1"
204f057eac0SStephen Rothwell
205f057eac0SStephen Rothwellconfig VIRT_TO_BUS
206f057eac0SStephen Rothwell	def_bool y
207f057eac0SStephen Rothwell	depends on !ARCH_NO_VIRT_TO_BUS
208cddb8a5cSAndrea Arcangeli
209cddb8a5cSAndrea Arcangeliconfig MMU_NOTIFIER
210cddb8a5cSAndrea Arcangeli	bool
211fc4d5c29SDavid Howells
212f8af4da3SHugh Dickinsconfig KSM
213f8af4da3SHugh Dickins	bool "Enable KSM for page merging"
214f8af4da3SHugh Dickins	depends on MMU
215f8af4da3SHugh Dickins	help
216f8af4da3SHugh Dickins	  Enable Kernel Samepage Merging: KSM periodically scans those areas
217f8af4da3SHugh Dickins	  of an application's address space that an app has advised may be
218f8af4da3SHugh Dickins	  mergeable.  When it finds pages of identical content, it replaces
219d0f209f6SHugh Dickins	  the many instances by a single page with that content, so
220f8af4da3SHugh Dickins	  saving memory until one or another app needs to modify the content.
221f8af4da3SHugh Dickins	  Recommended for use with KVM, or with other duplicative applications.
222c73602adSHugh Dickins	  See Documentation/vm/ksm.txt for more information: KSM is inactive
223c73602adSHugh Dickins	  until a program has madvised that an area is MADV_MERGEABLE, and
224c73602adSHugh Dickins	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
225f8af4da3SHugh Dickins
226e0a94c2aSChristoph Lameterconfig DEFAULT_MMAP_MIN_ADDR
227e0a94c2aSChristoph Lameter        int "Low address space to protect from user allocation"
2286e141546SDavid Howells	depends on MMU
229e0a94c2aSChristoph Lameter        default 4096
230e0a94c2aSChristoph Lameter        help
231e0a94c2aSChristoph Lameter	  This is the portion of low virtual memory which should be protected
232e0a94c2aSChristoph Lameter	  from userspace allocation.  Keeping a user from writing to low pages
233e0a94c2aSChristoph Lameter	  can help reduce the impact of kernel NULL pointer bugs.
234e0a94c2aSChristoph Lameter
235e0a94c2aSChristoph Lameter	  For most ia64, ppc64 and x86 users with lots of address space
236e0a94c2aSChristoph Lameter	  a value of 65536 is reasonable and should cause no problems.
237e0a94c2aSChristoph Lameter	  On arm and other archs it should not be higher than 32768.
238788084abSEric Paris	  Programs which use vm86 functionality or have some need to map
239788084abSEric Paris	  this low address space will need CAP_SYS_RAWIO or disable this
240788084abSEric Paris	  protection by setting the value to 0.
241e0a94c2aSChristoph Lameter
242e0a94c2aSChristoph Lameter	  This value can be changed after boot using the
243e0a94c2aSChristoph Lameter	  /proc/sys/vm/mmap_min_addr tunable.
244e0a94c2aSChristoph Lameter
245d949f36fSLinus Torvaldsconfig ARCH_SUPPORTS_MEMORY_FAILURE
246d949f36fSLinus Torvalds	bool
247e0a94c2aSChristoph Lameter
2486a46079cSAndi Kleenconfig MEMORY_FAILURE
2496a46079cSAndi Kleen	depends on MMU
250d949f36fSLinus Torvalds	depends on ARCH_SUPPORTS_MEMORY_FAILURE
2516a46079cSAndi Kleen	bool "Enable recovery from hardware memory errors"
2526a46079cSAndi Kleen	help
2536a46079cSAndi Kleen	  Enables code to recover from some memory failures on systems
2546a46079cSAndi Kleen	  with MCA recovery. This allows a system to continue running
2556a46079cSAndi Kleen	  even when some of its memory has uncorrected errors. This requires
2566a46079cSAndi Kleen	  special hardware support and typically ECC memory.
2576a46079cSAndi Kleen
258cae681fcSAndi Kleenconfig HWPOISON_INJECT
259413f9efbSAndi Kleen	tristate "HWPoison pages injector"
26027df5068SAndi Kleen	depends on MEMORY_FAILURE && DEBUG_KERNEL && PROC_FS
261478c5ffcSWu Fengguang	select PROC_PAGE_MONITOR
262cae681fcSAndi Kleen
263fc4d5c29SDavid Howellsconfig NOMMU_INITIAL_TRIM_EXCESS
264fc4d5c29SDavid Howells	int "Turn on mmap() excess space trimming before booting"
265fc4d5c29SDavid Howells	depends on !MMU
266fc4d5c29SDavid Howells	default 1
267fc4d5c29SDavid Howells	help
268fc4d5c29SDavid Howells	  The NOMMU mmap() frequently needs to allocate large contiguous chunks
269fc4d5c29SDavid Howells	  of memory on which to store mappings, but it can only ask the system
270fc4d5c29SDavid Howells	  allocator for chunks in 2^N*PAGE_SIZE amounts - which is frequently
271fc4d5c29SDavid Howells	  more than it requires.  To deal with this, mmap() is able to trim off
272fc4d5c29SDavid Howells	  the excess and return it to the allocator.
273fc4d5c29SDavid Howells
274fc4d5c29SDavid Howells	  If trimming is enabled, the excess is trimmed off and returned to the
275fc4d5c29SDavid Howells	  system allocator, which can cause extra fragmentation, particularly
276fc4d5c29SDavid Howells	  if there are a lot of transient processes.
277fc4d5c29SDavid Howells
278fc4d5c29SDavid Howells	  If trimming is disabled, the excess is kept, but not used, which for
279fc4d5c29SDavid Howells	  long-term mappings means that the space is wasted.
280fc4d5c29SDavid Howells
281fc4d5c29SDavid Howells	  Trimming can be dynamically controlled through a sysctl option
282fc4d5c29SDavid Howells	  (/proc/sys/vm/nr_trim_pages) which specifies the minimum number of
283fc4d5c29SDavid Howells	  excess pages there must be before trimming should occur, or zero if
284fc4d5c29SDavid Howells	  no trimming is to occur.
285fc4d5c29SDavid Howells
286fc4d5c29SDavid Howells	  This option specifies the initial value of this option.  The default
287fc4d5c29SDavid Howells	  of 1 says that all excess pages should be trimmed.
288fc4d5c29SDavid Howells
289fc4d5c29SDavid Howells	  See Documentation/nommu-mmap.txt for more information.
290