Skip to content

Commit 0710d01

Browse files
tehcasterakpm00
authored andcommitted
mm: Kconfig: reorganize misplaced mm options
After commits 7b42f10 ("mm: Kconfig: move swap and slab config options to the MM section") and 519bcb7 ("mm: Kconfig: group swap, slab, hotplug and thp options into submenus") we now have nicely organized mm related config options. I have noticed some that were still misplaced, so this moves them from various places into the new structure: VM_EVENT_COUNTERS, COMPAT_BRK, MMAP_ALLOW_UNINITIALIZED to mm/Kconfig and general MM section. SLUB_STATS to mm/Kconfig and the slab submenu. DEBUG_SLAB, SLUB_DEBUG, SLUB_DEBUG_ON to mm/Kconfig.debug and the Kernel hacking / Memory Debugging submenu. Link: https://lkml.kernel.org/r/20220525112559.1139-1-vbabka@suse.cz Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent fbf4df0 commit 0710d01

4 files changed

Lines changed: 87 additions & 87 deletions

File tree

init/Kconfig

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,59 +1828,6 @@ config DEBUG_PERF_USE_VMALLOC
18281828

18291829
endmenu
18301830

1831-
config VM_EVENT_COUNTERS
1832-
default y
1833-
bool "Enable VM event counters for /proc/vmstat" if EXPERT
1834-
help
1835-
VM event counters are needed for event counts to be shown.
1836-
This option allows the disabling of the VM event counters
1837-
on EXPERT systems. /proc/vmstat will only show page counts
1838-
if VM event counters are disabled.
1839-
1840-
config SLUB_DEBUG
1841-
default y
1842-
bool "Enable SLUB debugging support" if EXPERT
1843-
depends on SLUB && SYSFS
1844-
help
1845-
SLUB has extensive debug support features. Disabling these can
1846-
result in significant savings in code size. This also disables
1847-
SLUB sysfs support. /sys/slab will not exist and there will be
1848-
no support for cache validation etc.
1849-
1850-
config COMPAT_BRK
1851-
bool "Disable heap randomization"
1852-
default y
1853-
help
1854-
Randomizing heap placement makes heap exploits harder, but it
1855-
also breaks ancient binaries (including anything libc5 based).
1856-
This option changes the bootup default to heap randomization
1857-
disabled, and can be overridden at runtime by setting
1858-
/proc/sys/kernel/randomize_va_space to 2.
1859-
1860-
On non-ancient distros (post-2000 ones) N is usually a safe choice.
1861-
1862-
config MMAP_ALLOW_UNINITIALIZED
1863-
bool "Allow mmapped anonymous memory to be uninitialized"
1864-
depends on EXPERT && !MMU
1865-
default n
1866-
help
1867-
Normally, and according to the Linux spec, anonymous memory obtained
1868-
from mmap() has its contents cleared before it is passed to
1869-
userspace. Enabling this config option allows you to request that
1870-
mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
1871-
providing a huge performance boost. If this option is not enabled,
1872-
then the flag will be ignored.
1873-
1874-
This is taken advantage of by uClibc's malloc(), and also by
1875-
ELF-FDPIC binfmt's brk and stack allocator.
1876-
1877-
Because of the obvious security issues, this option should only be
1878-
enabled on embedded devices where you control what is run in
1879-
userspace. Since that isn't generally a problem on no-MMU systems,
1880-
it is normally safe to say Y here.
1881-
1882-
See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
1883-
18841831
config SYSTEM_DATA_VERIFICATION
18851832
def_bool n
18861833
select SYSTEM_TRUSTED_KEYRING

lib/Kconfig.debug

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -698,40 +698,6 @@ config DEBUG_OBJECTS_ENABLE_DEFAULT
698698
help
699699
Debug objects boot parameter default value
700700

701-
config DEBUG_SLAB
702-
bool "Debug slab memory allocations"
703-
depends on DEBUG_KERNEL && SLAB
704-
help
705-
Say Y here to have the kernel do limited verification on memory
706-
allocation as well as poisoning memory on free to catch use of freed
707-
memory. This can make kmalloc/kfree-intensive workloads much slower.
708-
709-
config SLUB_DEBUG_ON
710-
bool "SLUB debugging on by default"
711-
depends on SLUB && SLUB_DEBUG
712-
default n
713-
help
714-
Boot with debugging on by default. SLUB boots by default with
715-
the runtime debug capabilities switched off. Enabling this is
716-
equivalent to specifying the "slub_debug" parameter on boot.
717-
There is no support for more fine grained debug control like
718-
possible with slub_debug=xxx. SLUB debugging may be switched
719-
off in a kernel built with CONFIG_SLUB_DEBUG_ON by specifying
720-
"slub_debug=-".
721-
722-
config SLUB_STATS
723-
default n
724-
bool "Enable SLUB performance statistics"
725-
depends on SLUB && SYSFS
726-
help
727-
SLUB statistics are useful to debug SLUBs allocation behavior in
728-
order find ways to optimize the allocator. This should never be
729-
enabled for production use since keeping statistics slows down
730-
the allocator by a few percentage points. The slabinfo command
731-
supports the determination of the most active slabs to figure
732-
out which slabs are relevant to a particular load.
733-
Try running: slabinfo -DA
734-
735701
config HAVE_DEBUG_KMEMLEAK
736702
bool
737703

mm/Kconfig

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,19 @@ config SLAB_FREELIST_HARDENED
270270
sanity-checking than others. This option is most effective with
271271
CONFIG_SLUB.
272272

273+
config SLUB_STATS
274+
default n
275+
bool "Enable SLUB performance statistics"
276+
depends on SLUB && SYSFS
277+
help
278+
SLUB statistics are useful to debug SLUBs allocation behavior in
279+
order find ways to optimize the allocator. This should never be
280+
enabled for production use since keeping statistics slows down
281+
the allocator by a few percentage points. The slabinfo command
282+
supports the determination of the most active slabs to figure
283+
out which slabs are relevant to a particular load.
284+
Try running: slabinfo -DA
285+
273286
config SLUB_CPU_PARTIAL
274287
default y
275288
depends on SLUB && SMP
@@ -307,6 +320,40 @@ config SHUFFLE_PAGE_ALLOCATOR
307320

308321
Say Y if unsure.
309322

323+
config COMPAT_BRK
324+
bool "Disable heap randomization"
325+
default y
326+
help
327+
Randomizing heap placement makes heap exploits harder, but it
328+
also breaks ancient binaries (including anything libc5 based).
329+
This option changes the bootup default to heap randomization
330+
disabled, and can be overridden at runtime by setting
331+
/proc/sys/kernel/randomize_va_space to 2.
332+
333+
On non-ancient distros (post-2000 ones) N is usually a safe choice.
334+
335+
config MMAP_ALLOW_UNINITIALIZED
336+
bool "Allow mmapped anonymous memory to be uninitialized"
337+
depends on EXPERT && !MMU
338+
default n
339+
help
340+
Normally, and according to the Linux spec, anonymous memory obtained
341+
from mmap() has its contents cleared before it is passed to
342+
userspace. Enabling this config option allows you to request that
343+
mmap() skip that if it is given an MAP_UNINITIALIZED flag, thus
344+
providing a huge performance boost. If this option is not enabled,
345+
then the flag will be ignored.
346+
347+
This is taken advantage of by uClibc's malloc(), and also by
348+
ELF-FDPIC binfmt's brk and stack allocator.
349+
350+
Because of the obvious security issues, this option should only be
351+
enabled on embedded devices where you control what is run in
352+
userspace. Since that isn't generally a problem on no-MMU systems,
353+
it is normally safe to say Y here.
354+
355+
See Documentation/admin-guide/mm/nommu-mmap.rst for more information.
356+
310357
config SELECT_MEMORY_MODEL
311358
def_bool y
312359
depends on ARCH_SELECT_MEMORY_MODEL
@@ -964,6 +1011,15 @@ config ARCH_USES_HIGH_VMA_FLAGS
9641011
config ARCH_HAS_PKEYS
9651012
bool
9661013

1014+
config VM_EVENT_COUNTERS
1015+
default y
1016+
bool "Enable VM event counters for /proc/vmstat" if EXPERT
1017+
help
1018+
VM event counters are needed for event counts to be shown.
1019+
This option allows the disabling of the VM event counters
1020+
on EXPERT systems. /proc/vmstat will only show page counts
1021+
if VM event counters are disabled.
1022+
9671023
config PERCPU_STATS
9681024
bool "Collect percpu memory statistics"
9691025
help

mm/Kconfig.debug

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,37 @@ config DEBUG_PAGEALLOC_ENABLE_DEFAULT
4545
Enable debug page memory allocations by default? This value
4646
can be overridden by debug_pagealloc=off|on.
4747

48+
config DEBUG_SLAB
49+
bool "Debug slab memory allocations"
50+
depends on DEBUG_KERNEL && SLAB
51+
help
52+
Say Y here to have the kernel do limited verification on memory
53+
allocation as well as poisoning memory on free to catch use of freed
54+
memory. This can make kmalloc/kfree-intensive workloads much slower.
55+
56+
config SLUB_DEBUG
57+
default y
58+
bool "Enable SLUB debugging support" if EXPERT
59+
depends on SLUB && SYSFS
60+
help
61+
SLUB has extensive debug support features. Disabling these can
62+
result in significant savings in code size. This also disables
63+
SLUB sysfs support. /sys/slab will not exist and there will be
64+
no support for cache validation etc.
65+
66+
config SLUB_DEBUG_ON
67+
bool "SLUB debugging on by default"
68+
depends on SLUB && SLUB_DEBUG
69+
default n
70+
help
71+
Boot with debugging on by default. SLUB boots by default with
72+
the runtime debug capabilities switched off. Enabling this is
73+
equivalent to specifying the "slub_debug" parameter on boot.
74+
There is no support for more fine grained debug control like
75+
possible with slub_debug=xxx. SLUB debugging may be switched
76+
off in a kernel built with CONFIG_SLUB_DEBUG_ON by specifying
77+
"slub_debug=-".
78+
4879
config PAGE_OWNER
4980
bool "Track page owner"
5081
depends on DEBUG_KERNEL && STACKTRACE_SUPPORT

0 commit comments

Comments
 (0)