]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/zswap: skip confusing print info
authorLiu Shixin <liushixin2@huawei.com>
Thu, 25 Aug 2022 14:20:37 +0000 (22:20 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 26 Aug 2022 05:03:31 +0000 (22:03 -0700)
It's confusing when we disable zswap while zswap is init failed or has no
pool.  If no change required, just return directly.

Link: https://lkml.kernel.org/r/20220825142037.3214152-4-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com>
Cc: Dan Streetman <ddstreet@ieee.org>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Vitaly Wool <vitaly.wool@konsulko.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/zswap.c

index 4c476c4630355b59af55b2863ad6dc9464e6e71f..ef7463550e494ee4556bfb1be591e72a72918cbf 100644 (file)
@@ -886,6 +886,15 @@ static int zswap_zpool_param_set(const char *val,
 static int zswap_enabled_param_set(const char *val,
                                   const struct kernel_param *kp)
 {
+       bool res;
+
+       if (kstrtobool(val, &res))
+               return -EINVAL;
+
+       /* no change required */
+       if (res == *(bool *)kp->arg)
+               return 0;
+
        if (system_state == SYSTEM_RUNNING) {
                mutex_lock(&zswap_init_lock);
                if (zswap_setup()) {