From 2a0b4a45cea8d3c17ada4d24f3753e6efff1f4ef Mon Sep 17 00:00:00 2001 From: Liu Shixin Date: Thu, 25 Aug 2022 22:20:37 +0800 Subject: [PATCH] mm/zswap: skip confusing print info 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 Cc: Dan Streetman Cc: Seth Jennings Cc: Vitaly Wool Signed-off-by: Andrew Morton --- mm/zswap.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/zswap.c b/mm/zswap.c index 4c476c463035..ef7463550e49 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -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()) { -- 2.50.1