[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230322102006.780624-2-liushixin2@huawei.com>
Date: Wed, 22 Mar 2023 18:20:05 +0800
From: Liu Shixin <liushixin2@...wei.com>
To: Seth Jennings <sjenning@...hat.com>,
Dan Streetman <ddstreet@...e.org>,
Vitaly Wool <vitaly.wool@...sulko.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Nathan Chancellor <nathan@...nel.org>,
Christoph Hellwig <hch@....de>
CC: <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
Liu Shixin <liushixin2@...wei.com>
Subject: [PATCH -next v6 1/2] mm/zswap: skip invalid or unchanged parameter
If parameter is invalid or no change required, return directly. This can
reduces unnecessary printing.
Signed-off-by: Liu Shixin <liushixin2@...wei.com>
---
mm/zswap.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/zswap.c b/mm/zswap.c
index 2f0ebd8bc620..09fa956920fa 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -875,6 +875,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 (zswap_init_failed) {
pr_err("can't enable, initialization failed\n");
return -ENODEV;
--
2.25.1
Powered by blists - more mailing lists