From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@linux.com>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Pekka Enberg <penberg@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Matthew Wilcox <willy@infradead.org>,
patches@lists.linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 02/12] mm, slub: add CONFIG_SLUB_TINY
Date: Thu, 24 Nov 2022 20:33:12 +0900 [thread overview]
Message-ID: <Y39WeEpboF4u7pP6@hyeyoo> (raw)
In-Reply-To: <20221121171202.22080-3-vbabka@suse.cz>
On Mon, Nov 21, 2022 at 06:11:52PM +0100, Vlastimil Babka wrote:
> For tiny systems that have used SLOB until now, SLUB might be
> impractical due to its higher memory usage. To help with that, introduce
> an option CONFIG_SLUB_TINY that modifies SLUB to use less memory.
> This is done by sacrificing scalability, security and debugging
> features, therefore not recommended for any system with more than 16MB
> RAM.
>
> This commit introduces the option and uses it to set other related
> options in a way that reduces memory usage.
>
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/Kconfig | 21 +++++++++++++++++----
> mm/Kconfig.debug | 2 +-
> 2 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 57e1d8c5b505..5941cb34e30d 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -230,6 +230,19 @@ config SLOB
>
> endchoice
>
> +config SLUB_TINY
> + bool "Configure SLUB for minimal memory footprint"
> + depends on SLUB && EXPERT
> + select SLAB_MERGE_DEFAULT
> + help
> + Configures the SLUB allocator in a way to achieve minimal memory
> + footprint, sacrificing scalability, debugging and other features.
> + This is intended only for the smallest system that had used the
> + SLOB allocator and is not recommended for systems with more than
> + 16MB RAM.
> +
> + If unsure, say N.
> +
> config SLAB_MERGE_DEFAULT
> bool "Allow slab caches to be merged"
> default y
> @@ -247,7 +260,7 @@ config SLAB_MERGE_DEFAULT
>
> config SLAB_FREELIST_RANDOM
> bool "Randomize slab freelist"
> - depends on SLAB || SLUB
> + depends on SLAB || SLUB && !SLUB_TINY
> help
> Randomizes the freelist order used on creating new pages. This
> security feature reduces the predictability of the kernel slab
> @@ -255,7 +268,7 @@ config SLAB_FREELIST_RANDOM
>
> config SLAB_FREELIST_HARDENED
> bool "Harden slab freelist metadata"
> - depends on SLAB || SLUB
> + depends on SLAB || SLUB && !SLUB_TINY
> help
> Many kernel heap attacks try to target slab cache metadata and
> other infrastructure. This options makes minor performance
> @@ -267,7 +280,7 @@ config SLAB_FREELIST_HARDENED
> config SLUB_STATS
> default n
> bool "Enable SLUB performance statistics"
> - depends on SLUB && SYSFS
> + depends on SLUB && SYSFS && !SLUB_TINY
> help
> SLUB statistics are useful to debug SLUBs allocation behavior in
> order find ways to optimize the allocator. This should never be
> @@ -279,7 +292,7 @@ config SLUB_STATS
>
> config SLUB_CPU_PARTIAL
> default y
> - depends on SLUB && SMP
> + depends on SLUB && SMP && !SLUB_TINY
> bool "SLUB per cpu partial cache"
> help
> Per cpu partial caches accelerate objects allocation and freeing
> diff --git a/mm/Kconfig.debug b/mm/Kconfig.debug
> index ce8dded36de9..fca699ad1fb0 100644
> --- a/mm/Kconfig.debug
> +++ b/mm/Kconfig.debug
> @@ -56,7 +56,7 @@ config DEBUG_SLAB
> config SLUB_DEBUG
> default y
> bool "Enable SLUB debugging support" if EXPERT
> - depends on SLUB && SYSFS
> + depends on SLUB && SYSFS && !SLUB_TINY
> select STACKDEPOT if STACKTRACE_SUPPORT
> help
> SLUB has extensive debug support features. Disabling these can
> --
> 2.38.1
Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
small comment:
SLAB || (SLUB && !SLUB_TINY) would be easier to interpret than
SLAB || SLUB && !SLUB_TINY
--
Thanks,
Hyeonggon
next prev parent reply other threads:[~2022-11-24 11:33 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 17:11 [PATCH 00/12] Introduce CONFIG_SLUB_TINY and deprecate SLOB Vlastimil Babka
2022-11-21 17:11 ` [PATCH 01/12] mm, slab: ignore hardened usercopy parameters when disabled Vlastimil Babka
2022-11-21 21:35 ` Kees Cook
2022-11-23 14:23 ` Vlastimil Babka
2022-11-24 11:16 ` Hyeonggon Yoo
2022-11-24 11:26 ` Vlastimil Babka
2022-11-24 12:33 ` Hyeonggon Yoo
2022-11-21 17:11 ` [PATCH 02/12] mm, slub: add CONFIG_SLUB_TINY Vlastimil Babka
2022-11-24 1:08 ` Roman Gushchin
2022-11-24 11:33 ` Hyeonggon Yoo [this message]
2022-11-25 7:55 ` Vlastimil Babka
2022-11-21 17:11 ` [PATCH 03/12] mm, slub: disable SYSFS support with CONFIG_SLUB_TINY Vlastimil Babka
2022-11-24 1:12 ` Roman Gushchin
2022-11-24 9:00 ` Vlastimil Babka
2022-11-21 17:11 ` [PATCH 04/12] mm, slub: retain no free slabs on partial list " Vlastimil Babka
2022-11-24 1:12 ` Roman Gushchin
2022-11-24 11:38 ` Hyeonggon Yoo
2022-11-21 17:11 ` [PATCH 05/12] mm, slub: lower the default slub_max_order " Vlastimil Babka
2022-11-24 1:16 ` Roman Gushchin
2022-11-24 11:40 ` Hyeonggon Yoo
2022-11-21 17:11 ` [PATCH 06/12] mm, slub: don't create kmalloc-rcl caches " Vlastimil Babka
2022-11-23 13:53 ` Vlastimil Babka
2022-11-24 12:06 ` Hyeonggon Yoo
2022-11-24 12:12 ` Vlastimil Babka
2022-11-24 12:55 ` Hyeonggon Yoo
2022-11-24 13:23 ` Hyeonggon Yoo
2022-11-24 14:25 ` Hyeonggon Yoo
2022-11-21 17:11 ` [PATCH 07/12] mm, slab: ignore SLAB_RECLAIM_ACCOUNT " Vlastimil Babka
2022-11-24 1:20 ` Roman Gushchin
2022-11-24 9:09 ` Vlastimil Babka
2022-11-24 9:21 ` Christoph Lameter
2022-11-27 23:11 ` Vlastimil Babka
2022-11-21 17:11 ` [PATCH 08/12] mm, slub: refactor free debug processing Vlastimil Babka
2022-11-27 10:18 ` Hyeonggon Yoo
2022-11-21 17:11 ` [PATCH 09/12] mm, slub: split out allocations from pre/post hooks Vlastimil Babka
2022-11-27 10:54 ` Hyeonggon Yoo
2022-11-27 23:01 ` Vlastimil Babka
2022-11-28 13:06 ` Hyeonggon Yoo
2022-11-21 17:12 ` [PATCH 10/12] mm, slub: remove percpu slabs with CONFIG_SLUB_TINY Vlastimil Babka
2022-11-27 11:05 ` Hyeonggon Yoo
2022-12-12 10:54 ` Vlastimil Babka
2022-12-12 13:11 ` Dennis Zhou
2022-12-13 3:04 ` Baoquan He
2022-12-13 14:02 ` Hyeonggon Yoo
2022-12-18 10:16 ` Hyeonggon Yoo
2022-11-21 17:12 ` [PATCH 11/12] mm, slub: don't aggressively inline " Vlastimil Babka
2022-11-28 13:19 ` Hyeonggon Yoo
2022-11-21 17:12 ` [PATCH 12/12] mm, slob: rename CONFIG_SLOB to CONFIG_SLOB_DEPRECATED Vlastimil Babka
2022-11-21 18:41 ` Aaro Koskinen
2022-11-21 19:42 ` Vlastimil Babka
2022-11-22 6:47 ` Damien Le Moal
2022-11-22 16:08 ` Arnd Bergmann
2022-11-24 1:21 ` Roman Gushchin
2022-12-02 17:59 ` Palmer Dabbelt
2022-12-05 12:25 ` Damien Le Moal
2022-12-13 13:41 ` Hyeonggon Yoo
2022-11-22 16:33 ` [PATCH 00/12] Introduce CONFIG_SLUB_TINY and deprecate SLOB Arnd Bergmann
2022-11-22 16:59 ` Vlastimil Babka
2022-11-22 17:15 ` Arnd Bergmann
2022-11-24 20:30 ` Mike Rapoport
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y39WeEpboF4u7pP6@hyeyoo \
--to=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=patches@lists.linux.dev \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=torvalds@linux-foundation.org \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox