linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: David Sterba <dsterba@suse.com>, Christoph Lameter <cl@linux.com>,
	David Rientjes <rientjes@google.com>,
	Pekka Enberg <penberg@kernel.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Roman Gushchin <roman.gushchin@linux.dev>
Subject: Re: [PATCH] mm/slab: add new flag SLAB_NO_MERGE to avoid merging per slab
Date: Thu, 25 May 2023 13:59:20 +0200	[thread overview]
Message-ID: <20230525115920.GG30909@suse.cz> (raw)
In-Reply-To: <ZG4JYr14RpNQb8li@debian-BULLSEYE-live-builder-AMD64>

On Wed, May 24, 2023 at 09:56:02PM +0900, Hyeonggon Yoo wrote:
> On Wed, May 24, 2023 at 12:17:48PM +0200, David Sterba wrote:
> > Add a flag that allows to disable merging per slab. This can be used for
> > more fine grained control over the caches or for debugging builds where
> > separate slabs can verify that no objects leak.
> > The slab_nomerge boot option is too coarse and would need to be enabled
> > on all testing hosts. 
> 
> There is no users nor interface to set this flag, I guess you're going
> to use it by modifying source code, when debugging?

An example usage

--- a/fs/btrfs/fs.h
+++ b/fs/btrfs/fs.h
@@ -12,6 +12,12 @@
 #include "async-thread.h"
 #include "block-rsv.h"
 
+#ifdef CONFIG_BTRFS_DEBUG
+#define SLAB_DEBUG_NO_MERGE            0
+#else
+#define SLAB_DEBUG_NO_MERGE            SLAB_NO_MERGE
+#endif
+
 #define BTRFS_MAX_EXTENT_SIZE SZ_128M
 
 #define BTRFS_OLDEST_GENERATION        0ULL
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -5049,7 +5049,7 @@ int __init btrfs_ctree_init(void)
 {
        btrfs_path_cachep = kmem_cache_create("btrfs_path",
                        sizeof(struct btrfs_path), 0,
-                       SLAB_MEM_SPREAD, NULL);
+                       SLAB_MEM_SPREAD | SLAB_DEBUG_NO_MERGE, NULL);
        if (!btrfs_path_cachep)
                return -ENOMEM;
        return 0;
---

and this will be a permanent change, not added as needed.

> Does introducing new slub_debug option (i.e. slub_debug=N,pid_namespace)
> work for your use case? (there are some boot-time slub_debug options described in
> Documentation/mm/slub.rst)

I'd like to keep boot parameters unchanged, the testing setups are
different, physical, local VM, hosted. For the same reason the config
option CONFIG_SLUB_DEBUG_ON=y is very convenient.


      parent reply	other threads:[~2023-05-25 12:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-24 10:17 [PATCH] mm/slab: add new flag SLAB_NO_MERGE to avoid merging per slab David Sterba
2023-05-24 12:56 ` Hyeonggon Yoo
2023-05-24 13:53   ` Vlastimil Babka
2023-05-25 12:05     ` David Sterba
2023-05-25 11:59   ` David Sterba [this message]

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=20230525115920.GG30909@suse.cz \
    --to=dsterba@suse.cz \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dsterba@suse.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@suse.cz \
    /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;
as well as URLs for NNTP newsgroup(s).