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.