From: Liu Shixin <liushixin2@huawei.com>
To: Seth Jennings <sjenning@redhat.com>,
Dan Streetman <ddstreet@ieee.org>,
Vitaly Wool <vitaly.wool@konsulko.com>,
Andrew Morton <akpm@linux-foundation.org>,
Nathan Chancellor <nathan@kernel.org>,
Christoph Hellwig <hch@lst.de>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
Liu Shixin <liushixin2@huawei.com>
Subject: [PATCH -next v6 1/2] mm/zswap: skip invalid or unchanged parameter
Date: Wed, 22 Mar 2023 18:20:05 +0800 [thread overview]
Message-ID: <20230322102006.780624-2-liushixin2@huawei.com> (raw)
In-Reply-To: <20230322102006.780624-1-liushixin2@huawei.com>
If parameter is invalid or no change required, return directly. This can
reduces unnecessary printing.
Signed-off-by: Liu Shixin <liushixin2@huawei.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
next prev parent reply other threads:[~2023-03-22 9:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 10:20 [PATCH -next v6 0/2] Delay the initialization of zswap Liu Shixin
2023-03-22 10:20 ` Liu Shixin [this message]
2023-03-22 10:20 ` [PATCH -next v6 2/2] mm/zswap: delay the initializaton " Liu Shixin
2023-03-22 17:17 ` Vitaly Wool
2023-03-23 7:59 ` Christoph Hellwig
2023-03-27 6:19 ` Vitaly Wool
2023-03-23 8:04 ` Christoph Hellwig
2023-03-24 9:03 ` Liu Shixin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230322102006.780624-2-liushixin2@huawei.com \
--to=liushixin2@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=ddstreet@ieee.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nathan@kernel.org \
--cc=sjenning@redhat.com \
--cc=vitaly.wool@konsulko.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox