* [PATCH mm-new] mm/zblock: add debugfs
@ 2025-04-27 20:19 Vitaly Wool
2025-04-28 1:32 ` kernel test robot
2025-04-28 4:48 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Vitaly Wool @ 2025-04-27 20:19 UTC (permalink / raw)
To: linux-kernel, linux-mm
Cc: akpm, hannes, minchan, nphamcs, senozhatsky, shakeel.butt,
yosry.ahmed, Igor Belousov, Vitaly Wool
From: Igor Belousov <igor.b@beldev.am>
Add debugfs entry to monitor number of blocks allocated for different
block sizes.
Signed-off-by: Igor Belousov <igor.b@beldev.am>
Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.se>
---
mm/zblock.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/mm/zblock.c b/mm/zblock.c
index 6afe6986260d..7182b1ac85ad 100644
--- a/mm/zblock.c
+++ b/mm/zblock.c
@@ -17,6 +17,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/atomic.h>
+#include <linux/debugfs.h>
#include <linux/list.h>
#include <linux/mm.h>
#include <linux/module.h>
@@ -27,6 +28,7 @@
#include "zblock.h"
static struct rb_root block_desc_tree = RB_ROOT;
+static struct dentry *zblock_debugfs_root;
/* Encode handle of a particular slot in the pool using metadata */
static inline unsigned long metadata_to_handle(struct zblock_block *block,
@@ -111,6 +113,22 @@ static struct zblock_block *alloc_block(struct zblock_pool *pool,
return block;
}
+static int zblock_blocks_show(struct seq_file *s, void *v)
+{
+ struct zblock_pool *pool = s->private;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(block_desc); i++) {
+ struct block_list *block_list = &pool->block_lists[i];
+
+ seq_printf(s, "%d: %ld blocks of %d pages (total %ld pages)\n",
+ i, block_list->block_count, block_desc[i].num_pages,
+ block_list->block_count * block_desc[i].num_pages);
+ }
+ return 0;
+}
+DEFINE_SHOW_ATTRIBUTE(zblock_blocks);
+
/*****************
* API Functions
*****************/
@@ -140,6 +158,9 @@ static struct zblock_pool *zblock_create_pool(gfp_t gfp)
INIT_LIST_HEAD(&block_list->active_list);
block_list->block_count = 0;
}
+
+ debugfs_create_file("blocks", S_IFREG | 0444, zblock_debugfs_root,
+ pool, &zblock_blocks_fops);
return pool;
}
@@ -426,12 +447,15 @@ static int __init init_zblock(void)
return ret;
zpool_register_driver(&zblock_zpool_driver);
+
+ zblock_debugfs_root = debugfs_create_dir("zblock", NULL);
return 0;
}
static void __exit exit_zblock(void)
{
zpool_unregister_driver(&zblock_zpool_driver);
+ debugfs_remove_recursive(zblock_debugfs_root);
delete_rbtree();
}
--
2.49.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH mm-new] mm/zblock: add debugfs
2025-04-27 20:19 [PATCH mm-new] mm/zblock: add debugfs Vitaly Wool
@ 2025-04-28 1:32 ` kernel test robot
2025-04-28 4:48 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-04-28 1:32 UTC (permalink / raw)
To: Vitaly Wool, linux-kernel, linux-mm
Cc: llvm, oe-kbuild-all, akpm, hannes, minchan, nphamcs, senozhatsky,
shakeel.butt, yosry.ahmed, Igor Belousov, Vitaly Wool
Hi Vitaly,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Vitaly-Wool/mm-zblock-add-debugfs/20250428-042209
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20250427201958.491806-1-vitaly.wool%40konsulko.se
patch subject: [PATCH mm-new] mm/zblock: add debugfs
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250428/202504280934.X1Gqvqj1-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250428/202504280934.X1Gqvqj1-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504280934.X1Gqvqj1-lkp@intel.com/
All errors (new ones prefixed by >>):
>> mm/zblock.c:125:46: error: no member named 'num_pages' in 'struct block_desc'
125 | i, block_list->block_count, block_desc[i].num_pages,
| ~~~~~~~~~~~~~ ^
mm/zblock.c:126:44: error: no member named 'num_pages' in 'struct block_desc'
126 | block_list->block_count * block_desc[i].num_pages);
| ~~~~~~~~~~~~~ ^
2 errors generated.
vim +125 mm/zblock.c
115
116 static int zblock_blocks_show(struct seq_file *s, void *v)
117 {
118 struct zblock_pool *pool = s->private;
119 int i;
120
121 for (i = 0; i < ARRAY_SIZE(block_desc); i++) {
122 struct block_list *block_list = &pool->block_lists[i];
123
124 seq_printf(s, "%d: %ld blocks of %d pages (total %ld pages)\n",
> 125 i, block_list->block_count, block_desc[i].num_pages,
126 block_list->block_count * block_desc[i].num_pages);
127 }
128 return 0;
129 }
130 DEFINE_SHOW_ATTRIBUTE(zblock_blocks);
131
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH mm-new] mm/zblock: add debugfs
2025-04-27 20:19 [PATCH mm-new] mm/zblock: add debugfs Vitaly Wool
2025-04-28 1:32 ` kernel test robot
@ 2025-04-28 4:48 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-04-28 4:48 UTC (permalink / raw)
To: Vitaly Wool, linux-kernel, linux-mm
Cc: oe-kbuild-all, akpm, hannes, minchan, nphamcs, senozhatsky,
shakeel.butt, yosry.ahmed, Igor Belousov, Vitaly Wool
Hi Vitaly,
kernel test robot noticed the following build errors:
[auto build test ERROR on akpm-mm/mm-everything]
url: https://github.com/intel-lab-lkp/linux/commits/Vitaly-Wool/mm-zblock-add-debugfs/20250428-042209
base: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-everything
patch link: https://lore.kernel.org/r/20250427201958.491806-1-vitaly.wool%40konsulko.se
patch subject: [PATCH mm-new] mm/zblock: add debugfs
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20250428/202504281254.YFJgfUac-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250428/202504281254.YFJgfUac-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504281254.YFJgfUac-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from mm/zblock.c:28:
mm/zblock.h:24:2: error: #error Unsupported PAGE_SIZE
24 | #error Unsupported PAGE_SIZE
| ^~~~~
In file included from include/vdso/const.h:5,
from include/linux/const.h:4,
from include/linux/bits.h:5,
from include/linux/ratelimit_types.h:5,
from include/linux/printk.h:9,
from include/asm-generic/bug.h:22,
from arch/alpha/include/asm/bug.h:23,
from include/linux/bug.h:5,
from include/linux/vfsdebug.h:5,
from include/linux/fs.h:5,
from include/linux/debugfs.h:15,
from mm/zblock.c:20:
mm/zblock.h:44:40: error: 'SLOT_BITS' undeclared here (not in a function); did you mean 'SLOT_SIZE'?
44 | DECLARE_BITMAP(slot_info, 1 << SLOT_BITS);
| ^~~~~~~~~
include/uapi/linux/const.h:51:40: note: in definition of macro '__KERNEL_DIV_ROUND_UP'
51 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
| ^
include/linux/types.h:11:28: note: in expansion of macro 'BITS_TO_LONGS'
11 | unsigned long name[BITS_TO_LONGS(bits)]
| ^~~~~~~~~~~~~
mm/zblock.h:44:9: note: in expansion of macro 'DECLARE_BITMAP'
44 | DECLARE_BITMAP(slot_info, 1 << SLOT_BITS);
| ^~~~~~~~~~~~~~
mm/zblock.c: In function 'zblock_blocks_show':
>> mm/zblock.c:125:66: error: 'const struct block_desc' has no member named 'num_pages'
125 | i, block_list->block_count, block_desc[i].num_pages,
| ^
mm/zblock.c:126:64: error: 'const struct block_desc' has no member named 'num_pages'
126 | block_list->block_count * block_desc[i].num_pages);
| ^
vim +125 mm/zblock.c
115
116 static int zblock_blocks_show(struct seq_file *s, void *v)
117 {
118 struct zblock_pool *pool = s->private;
119 int i;
120
121 for (i = 0; i < ARRAY_SIZE(block_desc); i++) {
122 struct block_list *block_list = &pool->block_lists[i];
123
124 seq_printf(s, "%d: %ld blocks of %d pages (total %ld pages)\n",
> 125 i, block_list->block_count, block_desc[i].num_pages,
126 block_list->block_count * block_desc[i].num_pages);
127 }
128 return 0;
129 }
130 DEFINE_SHOW_ATTRIBUTE(zblock_blocks);
131
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-04-28 4:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-27 20:19 [PATCH mm-new] mm/zblock: add debugfs Vitaly Wool
2025-04-28 1:32 ` kernel test robot
2025-04-28 4:48 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox