From patchwork Wed Mar 22 10:20:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 13183737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D92ACC7619A for ; Wed, 22 Mar 2023 09:29:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6EC946B0078; Wed, 22 Mar 2023 05:29:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 64D746B007B; Wed, 22 Mar 2023 05:29:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C75D6B007D; Wed, 22 Mar 2023 05:29:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3E5FD6B0078 for ; Wed, 22 Mar 2023 05:29:32 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 18657A035E for ; Wed, 22 Mar 2023 09:29:32 +0000 (UTC) X-FDA: 80596011384.10.1987E7A Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf13.hostedemail.com (Postfix) with ESMTP id 1C08020005 for ; Wed, 22 Mar 2023 09:29:28 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1679477370; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+jQ40/ALsZiRO+MzGTC8pgT58GtrxWOUy6birRfLIo8=; b=lwowOtlAXvBleh+j7G5sF58sRkEDTPZ0OG6psmNtm/Ebv3zqN5kOsqzJXAgvWIfR3nyw5b FRERS7KIkSD4CFFFjBKrRCGn6jTQO1YiO3lQ6CQKn9Cm65D/BL+s+0vlmkQ37ca9ufW5wr soZYUZiQKwTiZ9ZyzQHoMj/hLI6NghI= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1679477370; a=rsa-sha256; cv=none; b=D40u2sjXGu59A7bkC8bJgHsR3omDAySMTkDf7w3aDxI2IdQzLjSbI112G7HLqe1IdFkknL xiI331Ilw28SrAsTeKyAYfyB1m9SZhMFhAxfywzM7/gUR41OpdPu6LHB8+Skjmcvw8HqLO OpDn7zTmKZgiR2nCink4WHukGG6ShQY= Received: from dggpemm100009.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PhNR00M10zKt3f; Wed, 22 Mar 2023 17:27:08 +0800 (CST) Received: from huawei.com (10.175.113.32) by dggpemm100009.china.huawei.com (7.185.36.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Wed, 22 Mar 2023 17:29:24 +0800 From: Liu Shixin To: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , Christoph Hellwig CC: , , Liu Shixin Subject: [PATCH -next v6 1/2] mm/zswap: skip invalid or unchanged parameter Date: Wed, 22 Mar 2023 18:20:05 +0800 Message-ID: <20230322102006.780624-2-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230322102006.780624-1-liushixin2@huawei.com> References: <20230322102006.780624-1-liushixin2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 1C08020005 X-Stat-Signature: 9mhnjuhughjckzomrckamj7hy69gfd7c X-HE-Tag: 1679477368-697467 X-HE-Meta: U2FsdGVkX19lMd90B1yTjBDazwWdcsz+cnQcgh7LIlHFndxX+4IjyRFHksV/qFmipG3zAU4ve4MtWGFWpmwz31hTXSjQ/10LxxmeC97ic10H/AmCH/l92Y+ad0BZLm/xMJyP426Dof4B+lF0VpsUoZZp167P5GtxAvHc6cqTjoQjXVb8ZbC81SFI9E23nWyGKv/6KrR/w4vlZBjZ+mIhbHQl3osK5LnDQFK2S1ZFYCmP2IN4FHV1zAXhUqBuMbel9KTSon4vUJf31f3JKbd116j+1QOYsu8eW6AknCtPfT68BejUpJV4JaEaU6Yc4AXuVtR2Sy7y7l8d6+szr5YhBXaSAycrSz7ewGx7d8Td6oHcHaDDMlK3k3MPMmECeIs9AQTS08leDcnKm8zxAjuItUpFawzUaAFtKeuq+EBuWjU7yWv05D6Ykef4ZfCJJRIewB0ta5QR4YfukfmHK3cnM1YkBD1gidYXZyN9lW6Wknv3oeJnxde+b9xn4ImJrccbyxNW2/TZbCAsJfCWEvgCBssSREK0IO3kgW2mirE03v+c0/1ObpFYNwiwZJ6qmH8vKQ0gVwdHsnhhduN/QpkHb6U9DnWRDmppJqIBxiP3xsNa3iKKd1HkaWL4/WjrVZUDvHLLonIljGEL+k6Wfm7a58WkGl7bDhLZ70ksGTApVVvbgHh3WjS+UpuNjUPNxLwzim4VJn++QIKjHofGxx68CmWtz7jCNQSz1WdxhngArF5ndoEtfFUNw1Gtlcxq2jF4nrX1kMSYJgS03QJ1nlngsUavv/zQzzghVXv1kLa1KNOMXhSvPJGZ6C90DYZX6SKPn3NeVXVoBvAMwhX9D3Dy5PUtal7E9EKc/ECHkErhd0W+mryoQYfKeKulCbC6eAyLj6363+Af5MqXzalep5Yt5ky/318eGUuqDsPeoCziUENp0629TvfQCO9/Sivr953N/p/GTRY9A4SE4UZgyfV B5hBNEfH 1he4KXaWgpLRI63yG46vJ1zwiC13kVFJypgjxkBK7dcUyNA6hzbzrppGvfkAMHYCo2wfb/sDTJ8fOQHSdNLMMLJNj0uTLIjlzCyg3mJPJq6ozHfs3kASKdDPjmJL7vFh1Kwbvjn2Qyt0ediJxeBFQ44ccgd2xP2FWg/Bl X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: If parameter is invalid or no change required, return directly. This can reduces unnecessary printing. Signed-off-by: Liu Shixin --- 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;