mm/zsmalloc: remove CONFIG_ZSMALLOC_STAT
Subsystems (10)
PATCH v4 1/1 mm/zsmalloc: remove CONFIG_ZSMALLOC_STAT
CONFIG_ZSMALLOC_STAT only controls the debugfs interface. The class counters are updated regardless of this option.
Remove the CONFIG_ZSMALLOC_STAT guards and rely on the debugfs API stubs when CONFIG_DEBUG_FS=n. Skip statistics setup silently when debugfs is unavailable.
Remove the Kconfig entry and drop CONFIG_ZSMALLOC_STAT from both s390 defconfigs. Replace it with CONFIG_DEBUG_FS=y in the DRM CI configs. Update the English and Chinese documentation to match and use <pool-name> in the debugfs path.
---
Changes in v4:
- Drop CONFIG_DEBUG_FS=y from the s390 defconfigs (Alexander).
- Add Reviewed-by and Acked-by tags.
- Link to v3: https://patch.msgid.link/[email protected]
Changes in v3:
- Squash the three patches into one (Nhat, Sergey).
- Add Nhat's Reviewed-by.
- Update the documentation wording.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Drop CONFIG_ZSMALLOC_STAT instead of making the counters conditional.
- Update configuration files and documentation.
- Link to v1: https://patch.msgid.link/[email protected]
--- Documentation/mm/zsmalloc.rst | 4 +-- Documentation/translations/zh_CN/mm/zsmalloc.rst | 2 +- arch/s390/configs/debug_defconfig | 1 - arch/s390/configs/defconfig | 1 - drivers/gpu/drm/ci/arm.config | 2 +- drivers/gpu/drm/ci/arm64.config | 2 +- drivers/gpu/drm/ci/x86_64.config | 2 +- mm/Kconfig | 9 ------- mm/zsmalloc.c | 33 ++---------------------- 9 files changed, 8 insertions(+), 48 deletions(-)
Documentation/mm/zsmalloc.rst +2 -2
@@ -33,8 +33,8 @@ proper handle-based APIs. stat ==== -With CONFIG_ZSMALLOC_STAT, we could see zsmalloc internal information via -``/sys/kernel/debug/zsmalloc/<user name>``. Here is a sample of stat output:: +With CONFIG_DEBUG_FS, we could see zsmalloc internal information via +``/sys/kernel/debug/zsmalloc/<pool-name>``. Here is a sample of stat output:: # cat /sys/kernel/debug/zsmalloc/zram0/classes
Documentation/translations/zh_CN/mm/zsmalloc.rst +1 -1
@@ -32,7 +32,7 @@ zs_unmap_object()解除映射。 stat ==== -通过CONFIG_ZSMALLOC_STAT,我们可以通过 ``/sys/kernel/debug/zsmalloc/<user name>`` +启用CONFIG_DEBUG_FS,我们可以通过 ``/sys/kernel/debug/zsmalloc/<pool-name>`` 看到zsmalloc内部信息。下面是一个统计输出的例子。:: # cat /sys/kernel/debug/zsmalloc/zram0/classes
arch/s390/configs/debug_defconfig +0 -1
@@ -100,7 +100,6 @@ CONFIG_UNIXWARE_DISKLABEL=y CONFIG_IOSCHED_BFQ=y CONFIG_BINFMT_MISC=m CONFIG_ZSWAP=y -CONFIG_ZSMALLOC_STAT=y CONFIG_SLAB_BUCKETS=y CONFIG_SLUB_STATS=y # CONFIG_COMPAT_BRK is not set
arch/s390/configs/defconfig +0 -1
@@ -94,7 +94,6 @@ CONFIG_UNIXWARE_DISKLABEL=y CONFIG_IOSCHED_BFQ=y CONFIG_BINFMT_MISC=m CONFIG_ZSWAP=y -CONFIG_ZSMALLOC_STAT=y CONFIG_SLAB_BUCKETS=y # CONFIG_COMPAT_BRK is not set CONFIG_MEMORY_HOTPLUG=y
drivers/gpu/drm/ci/arm.config +1 -1
@@ -5,7 +5,7 @@ CONFIG_CRYPTO_ZSTD=y CONFIG_ZRAM_MEMORY_TRACKING=y CONFIG_ZRAM_WRITEBACK=y CONFIG_ZRAM=y -CONFIG_ZSMALLOC_STAT=y +CONFIG_DEBUG_FS=y # abootimg with a 'dummy' rootfs fails with root=/dev/nfs CONFIG_BLK_DEV_INITRD=n
drivers/gpu/drm/ci/arm64.config +1 -1
@@ -5,7 +5,7 @@ CONFIG_CRYPTO_ZSTD=y CONFIG_ZRAM_MEMORY_TRACKING=y CONFIG_ZRAM_WRITEBACK=y CONFIG_ZRAM=y -CONFIG_ZSMALLOC_STAT=y +CONFIG_DEBUG_FS=y # abootimg with a 'dummy' rootfs fails with root=/dev/nfs CONFIG_BLK_DEV_INITRD=n
drivers/gpu/drm/ci/x86_64.config +1 -1
@@ -5,7 +5,7 @@ CONFIG_CRYPTO_ZSTD=y CONFIG_ZRAM_MEMORY_TRACKING=y CONFIG_ZRAM_WRITEBACK=y CONFIG_ZRAM=y -CONFIG_ZSMALLOC_STAT=y +CONFIG_DEBUG_FS=y CONFIG_PWM=y CONFIG_PM_DEVFREQ=y
mm/Kconfig +0 -9
@@ -130,15 +130,6 @@ menu "Zsmalloc allocator options" comment "Zsmalloc is a common backend allocator for zswap & zram" -config ZSMALLOC_STAT - bool "Export zsmalloc statistics" - select DEBUG_FS - help - This option enables code in the zsmalloc to collect various - statistics about what's happening in zsmalloc and exports that - information to userspace via debugfs. - If unsure, say N. - config ZSMALLOC_CHAIN_SIZE int "Maximum number of physical pages per-zspage" default 8
mm/zsmalloc.c +2 -31
@@ -222,9 +222,7 @@ struct zs_size_stat {unsigned long objs[NR_CLASS_STAT_TYPES ]; }; -#ifdef CONFIG_ZSMALLOC_STAT static struct dentry *zs_stat_root; -#endif static size_t huge_class_size;
@@ -279,9 +277,7 @@ struct zs_pool {/* Compact classes */ struct shrinker *shrinker; -#ifdef CONFIG_ZSMALLOC_STAT struct dentry *stat_dentry; -#endif #ifdef CONFIG_COMPACTION struct work_struct free_work;#endif
@@ -565,14 +561,10 @@ static inline unsigned long class_stat_read(struct size_class *class, int type)return class->stats.objs[type]; } -#ifdef CONFIG_ZSMALLOC_STAT -static void __init zs_stat_init (void ) { -if (!debugfs_initialized ()) { -pr_warn ("debugfs not available, stat dir not created\n" ); +if (!debugfs_initialized ())return ; - } zs_stat_root =debugfs_create_dir ("zsmalloc" ,NULL ); }
@@ -650,10 +642,8 @@ DEFINE_SHOW_ATTRIBUTE(zs_stats_size);static void zs_pool_stat_create (struct zs_pool *pool,const char *name) { -if (!zs_stat_root) { -pr_warn ("no root stat dir, not creating <%s> stat dir\n" , name); +if (IS_ERR_OR_NULL (zs_stat_root))return ; - } pool->stat_dentry =debugfs_create_dir (name, zs_stat_root);
@@ -666,25 +656,6 @@ static void zs_pool_stat_destroy(struct zs_pool *pool)debugfs_remove_recursive (pool->stat_dentry); } -#else /* CONFIG_ZSMALLOC_STAT */ -static void __init zs_stat_init (void ) -{ -} - -static void __exit zs_stat_exit(void) -{ -} - -static inline void zs_pool_stat_create (struct zs_pool *pool,const char *name) -{ -} - -static inline void zs_pool_stat_destroy (struct zs_pool *pool) -{ -} -#endif - -/* * For each size class, zspages are divided into different groups * depending on their usage ratio. This function returns fullness
---
base-commit: fa4ad798f6f681031775266044ba1b0cf3c670bd
Signature · 2 lines
Best regards, Xueyuan
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 12 lines
CONFIG_ZSMALLOC_STATonly controls the debugfs interface. The class counters are updated regardless of this option.Remove the
CONFIG_ZSMALLOC_STATguards and rely on the debugfs API stubs whenCONFIG_DEBUG_FS=n. Skip statistics setup silently when debugfs is unavailable.Remove the
Kconfigentry and dropCONFIG_ZSMALLOC_STATfrom both s390 defconfigs. Replace it withCONFIG_DEBUG_FS=yin the DRM CI configs. Update the English and Chinese documentation to match and use <pool-name> in the debugfs path.
Quoted 6 lines
Suggested-by Nhat Pham <[email protected]>Reviewed-by Nhat Pham <[email protected]>Reviewed-by Randy Dunlap <[email protected]>Reviewed-by Sergey Senozhatsky <[email protected]>Signed-off-by Xueyuan Chen <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1