diff mbox series

[03/12] mm, slub: disable SYSFS support with CONFIG_SLUB_TINY

Message ID 20221121171202.22080-4-vbabka@suse.cz (mailing list archive)
State New
Headers show
Series Introduce CONFIG_SLUB_TINY and deprecate SLOB | expand

Commit Message

Vlastimil Babka Nov. 21, 2022, 5:11 p.m. UTC
Currently SLUB enables its sysfs support depending unconditionally on
the general CONFIG_SYSFS setting. To reduce the configuration
combination space, make CONFIG_SLUB_TINY disable SLUB's sysfs support by
reusing the existing SLAB_SUPPORTS_SYSFS define. It is unlikely that
real tiny systems would combine CONFIG_SLUB_TINY with CONFIG_SYSFS, but
a randconfig might.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
 include/linux/slub_def.h |  2 +-
 mm/slub.c                | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Roman Gushchin Nov. 24, 2022, 1:12 a.m. UTC | #1
On Mon, Nov 21, 2022 at 06:11:53PM +0100, Vlastimil Babka wrote:
> Currently SLUB enables its sysfs support depending unconditionally on
> the general CONFIG_SYSFS setting. To reduce the configuration
> combination space, make CONFIG_SLUB_TINY disable SLUB's sysfs support by
> reusing the existing SLAB_SUPPORTS_SYSFS define. It is unlikely that
> real tiny systems would combine CONFIG_SLUB_TINY with CONFIG_SYSFS, but
> a randconfig might.

Hm, don't we want to introduce CONFIG_SLAB_SYSFS instead?
I believe many users don't really need it, even if they don't
need CONFIG_SLUB_TINY and they do have CONFIG_SYSFS.

Thanks!
Vlastimil Babka Nov. 24, 2022, 9 a.m. UTC | #2
On 11/24/22 02:12, Roman Gushchin wrote:
> On Mon, Nov 21, 2022 at 06:11:53PM +0100, Vlastimil Babka wrote:
>> Currently SLUB enables its sysfs support depending unconditionally on
>> the general CONFIG_SYSFS setting. To reduce the configuration
>> combination space, make CONFIG_SLUB_TINY disable SLUB's sysfs support by
>> reusing the existing SLAB_SUPPORTS_SYSFS define. It is unlikely that
>> real tiny systems would combine CONFIG_SLUB_TINY with CONFIG_SYSFS, but
>> a randconfig might.
> 
> Hm, don't we want to introduce CONFIG_SLAB_SYSFS instead?
> I believe many users don't really need it, even if they don't
> need CONFIG_SLUB_TINY and they do have CONFIG_SYSFS.

Dunno, adding more and more config options is generally frowned upon. Also
tools might be using it to get more details than /proc/slabinfo does - i.e.
tools/vm/slabinfo.c

> Thanks!
diff mbox series

Patch

diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h
index f9c68a9dac04..c186f25c8148 100644
--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -142,7 +142,7 @@  struct kmem_cache {
 	struct kmem_cache_node *node[MAX_NUMNODES];
 };
 
-#ifdef CONFIG_SYSFS
+#if defined(CONFIG_SYSFS) && !defined(CONFIG_SLUB_TINY)
 #define SLAB_SUPPORTS_SYSFS
 void sysfs_slab_unlink(struct kmem_cache *);
 void sysfs_slab_release(struct kmem_cache *);
diff --git a/mm/slub.c b/mm/slub.c
index 157527d7101b..ab085aa2f1f0 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -298,7 +298,7 @@  struct track {
 
 enum track_item { TRACK_ALLOC, TRACK_FREE };
 
-#ifdef CONFIG_SYSFS
+#ifdef SLAB_SUPPORTS_SYSFS
 static int sysfs_slab_add(struct kmem_cache *);
 static int sysfs_slab_alias(struct kmem_cache *, const char *);
 #else
@@ -2935,7 +2935,7 @@  static noinline void free_debug_processing(
 }
 #endif /* CONFIG_SLUB_DEBUG */
 
-#if defined(CONFIG_SLUB_DEBUG) || defined(CONFIG_SYSFS)
+#if defined(CONFIG_SLUB_DEBUG) || defined(SLAB_SUPPORTS_SYSFS)
 static unsigned long count_partial(struct kmem_cache_node *n,
 					int (*get_count)(struct slab *))
 {
@@ -2949,7 +2949,7 @@  static unsigned long count_partial(struct kmem_cache_node *n,
 	spin_unlock_irqrestore(&n->list_lock, flags);
 	return x;
 }
-#endif /* CONFIG_SLUB_DEBUG || CONFIG_SYSFS */
+#endif /* CONFIG_SLUB_DEBUG || SLAB_SUPPORTS_SYSFS */
 
 static noinline void
 slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
@@ -4924,7 +4924,7 @@  int __kmem_cache_create(struct kmem_cache *s, slab_flags_t flags)
 	return 0;
 }
 
-#ifdef CONFIG_SYSFS
+#ifdef SLAB_SUPPORTS_SYSFS
 static int count_inuse(struct slab *slab)
 {
 	return slab->inuse;
@@ -5182,7 +5182,7 @@  static void process_slab(struct loc_track *t, struct kmem_cache *s,
 #endif  /* CONFIG_DEBUG_FS   */
 #endif	/* CONFIG_SLUB_DEBUG */
 
-#ifdef CONFIG_SYSFS
+#ifdef SLAB_SUPPORTS_SYSFS
 enum slab_stat_type {
 	SL_ALL,			/* All slabs */
 	SL_PARTIAL,		/* Only partially allocated slabs */
@@ -6056,7 +6056,7 @@  static int __init slab_sysfs_init(void)
 }
 
 __initcall(slab_sysfs_init);
-#endif /* CONFIG_SYSFS */
+#endif /* SLAB_SUPPORTS_SYSFS */
 
 #if defined(CONFIG_SLUB_DEBUG) && defined(CONFIG_DEBUG_FS)
 static int slab_debugfs_show(struct seq_file *seq, void *v)