aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2016-05-26 18:16:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-26 18:35:44 -0400
commit4abaac9b733ea44fcf0d561ec1813e0394e61c9d (patch)
tree0d5a861f7e19ea7ad7ca686bb57e2dd022cf5335 /mm
parent3017cd63f26fc655d56875aaf497153ba60e9edf (diff)
update "mm/zsmalloc: don't fail if can't create debugfs info"
Some updates to commit d34f615720d1 ("mm/zsmalloc: don't fail if can't create debugfs info"): - add pr_warn to all stat failure cases - do not prevent module loading on stat failure Link: http://lkml.kernel.org/r/1463671123-5479-1-git-send-email-ddstreet@ieee.org Signed-off-by: Dan Streetman <ddstreet@ieee.org> Reviewed-by: Ganesh Mahendran <opensource.ganesh@gmail.com> Acked-by: Minchan Kim <minchan@kernel.org> Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Cc: Dan Streetman <dan.streetman@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/zsmalloc.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 72698db958e7..b6d4f258cb53 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -45,6 +45,8 @@
45 * 45 *
46 */ 46 */
47 47
48#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
49
48#include <linux/module.h> 50#include <linux/module.h>
49#include <linux/kernel.h> 51#include <linux/kernel.h>
50#include <linux/sched.h> 52#include <linux/sched.h>
@@ -483,16 +485,16 @@ static inline unsigned long zs_stat_get(struct size_class *class,
483 485
484#ifdef CONFIG_ZSMALLOC_STAT 486#ifdef CONFIG_ZSMALLOC_STAT
485 487
486static int __init zs_stat_init(void) 488static void __init zs_stat_init(void)
487{ 489{
488 if (!debugfs_initialized()) 490 if (!debugfs_initialized()) {
489 return -ENODEV; 491 pr_warn("debugfs not available, stat dir not created\n");
492 return;
493 }
490 494
491 zs_stat_root = debugfs_create_dir("zsmalloc", NULL); 495 zs_stat_root = debugfs_create_dir("zsmalloc", NULL);
492 if (!zs_stat_root) 496 if (!zs_stat_root)
493 return -ENOMEM; 497 pr_warn("debugfs 'zsmalloc' stat dir creation failed\n");
494
495 return 0;
496} 498}
497 499
498static void __exit zs_stat_exit(void) 500static void __exit zs_stat_exit(void)
@@ -577,8 +579,10 @@ static void zs_pool_stat_create(struct zs_pool *pool, const char *name)
577{ 579{
578 struct dentry *entry; 580 struct dentry *entry;
579 581
580 if (!zs_stat_root) 582 if (!zs_stat_root) {
583 pr_warn("no root stat dir, not creating <%s> stat dir\n", name);
581 return; 584 return;
585 }
582 586
583 entry = debugfs_create_dir(name, zs_stat_root); 587 entry = debugfs_create_dir(name, zs_stat_root);
584 if (!entry) { 588 if (!entry) {
@@ -592,7 +596,8 @@ static void zs_pool_stat_create(struct zs_pool *pool, const char *name)
592 if (!entry) { 596 if (!entry) {
593 pr_warn("%s: debugfs file entry <%s> creation failed\n", 597 pr_warn("%s: debugfs file entry <%s> creation failed\n",
594 name, "classes"); 598 name, "classes");
595 return; 599 debugfs_remove_recursive(pool->stat_dentry);
600 pool->stat_dentry = NULL;
596 } 601 }
597} 602}
598 603
@@ -602,9 +607,8 @@ static void zs_pool_stat_destroy(struct zs_pool *pool)
602} 607}
603 608
604#else /* CONFIG_ZSMALLOC_STAT */ 609#else /* CONFIG_ZSMALLOC_STAT */
605static int __init zs_stat_init(void) 610static void __init zs_stat_init(void)
606{ 611{
607 return 0;
608} 612}
609 613
610static void __exit zs_stat_exit(void) 614static void __exit zs_stat_exit(void)
@@ -2011,17 +2015,10 @@ static int __init zs_init(void)
2011 zpool_register_driver(&zs_zpool_driver); 2015 zpool_register_driver(&zs_zpool_driver);
2012#endif 2016#endif
2013 2017
2014 ret = zs_stat_init(); 2018 zs_stat_init();
2015 if (ret) { 2019
2016 pr_err("zs stat initialization failed\n");
2017 goto stat_fail;
2018 }
2019 return 0; 2020 return 0;
2020 2021
2021stat_fail:
2022#ifdef CONFIG_ZPOOL
2023 zpool_unregister_driver(&zs_zpool_driver);
2024#endif
2025notifier_fail: 2022notifier_fail:
2026 zs_unregister_cpu_notifier(); 2023 zs_unregister_cpu_notifier();
2027 2024