Received: by 2002:ac8:156:0:b0:3e0:cd10:60c8 with SMTP id f22csp1804936qtg; Wed, 22 Mar 2023 02:35:25 -0700 (PDT) X-Google-Smtp-Source: AK7set8BY4PCHLowbrfC3bNr6MaZtynI3lJxfplQ1QiwmxkPPnjtRN+BWK5DFGZzBnQc6yN3MhnM X-Received: by 2002:a17:903:2307:b0:19e:665b:2514 with SMTP id d7-20020a170903230700b0019e665b2514mr2767464plh.43.1679477725466; Wed, 22 Mar 2023 02:35:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679477725; cv=none; d=google.com; s=arc-20160816; b=OgcDbaVAnjgYeLtWKWnhnjebfRmcav54kF7uDqfL7V2cM49U3LJSql0LCv7pbMTHlv 1RLECKy4toHPH+iXPongjdWiq8wctjF9MZiQnhYKJoMYtBf24y8P8thEt0X4cGDusVKT oLI4PLGYQCUam4tg+GO8bhNECzapdpVUcmbovbz3XNSIRz/PK5dCgyrOtLDRJgjEpePA GK1XMeQmGfMxTdR3/Asaja3A3CF8Ee2/xuf84dOTBxiGBQzaVqu9uzyUlek59xCJ/2Q7 MjnVGCByF2sqg1TpZXsO/GOrNNsZu+lT9CmxL86gn+FBoTF9fMtK8F8e+Hj7VY/CxaQN 5ipQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+jQ40/ALsZiRO+MzGTC8pgT58GtrxWOUy6birRfLIo8=; b=hmSoJgloKGfuOSU+oDgz2YJXr7T+B9l06CL1hu6TM290c3BGDITqV1GT7KuOcMSAnr Ldsk+30hf+/E+EYcyLdWZtqSCAqX/5aJFmdlNL0KeaDwpUydAGkUCLLNSZuBd+S3tM1z y6ojzq0Njbx/qNq/jZHpZdfpgWR0FZf6BkYTFaM2i0egpcTz+fX1f0XHo3Ch0wx/Ha6I m/ryUYQNRhallON5IEhoPcStRW75ORdRFLKHmZfdkWZPajegWlA8wOjBNg+gYDH4CoS6 oDf1VEdm9vXVdGKjMkbFY5P2KgVF4M7DEoRrx8T/BXp571gPXLgs+8uMQ0dNpbo9FDiR u1dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n18-20020a635c52000000b0050c0763b32csi15317552pgm.233.2023.03.22.02.35.13; Wed, 22 Mar 2023 02:35:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230519AbjCVJ3w (ORCPT + 99 others); Wed, 22 Mar 2023 05:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230413AbjCVJ3i (ORCPT ); Wed, 22 Mar 2023 05:29:38 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F4725DEC5 for ; Wed, 22 Mar 2023 02:29:27 -0700 (PDT) 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.25.1