diff mbox series

[v5,5/5] mm/zswap: skip confusing print info

Message ID 20220915035003.3347466-6-liushixin2@huawei.com (mailing list archive)
State New
Headers show
Series Delay the initializaton of zswap | expand

Commit Message

Liu Shixin Sept. 15, 2022, 3:50 a.m. UTC
It's confusing when we disable zswap while zswap is init failed or has no
pool. If no change required, just return directly.

Signed-off-by: Liu Shixin <liushixin2@huawei.com>
---
 mm/zswap.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

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()) {