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: 73324 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp2249293wrt; Wed, 22 Mar 2023 02:50:38 -0700 (PDT) X-Google-Smtp-Source: AK7set/wcPPeqrZ591yqzoRJG+UJY6tonoDhD8ZZdSBEUpPWvPw4xKzkzR8WwCQd3uyAtEscweUy X-Received: by 2002:a17:906:3a94:b0:931:d8db:8a2f with SMTP id y20-20020a1709063a9400b00931d8db8a2fmr6282516ejd.58.1679478637807; Wed, 22 Mar 2023 02:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679478637; cv=none; d=google.com; s=arc-20160816; b=TZVh898+Odon0Xm0cbIL0tNGxPGsEjZ4COZbSB8MJpOWrCIu5knA3Z0a/0WMVT8gO8 WNE+cTdEwxpIcSAmcswQirmwlO1zynkywGslRr0FGog+Fe+Yy5oQbsMmx8fgXdStXntZ vqIrGVGCgUnp4Jbp81ZRhnlJQpudyMLK/kXhL5iGidxeVBoUxRFZ46QTp2q6KxJGTYt5 w1RTj/Ke78Zi/tiwEWkvOfvzedL9if++NECh0BY73wDp8WaqU6TuF3j2zeDvdO6mXgjx p8+1VHZi32RZUpIyH8l6R/A0vpEwiDDSXimeuiLTRetkSHWKvPt6wRw7rC1ay9thtO+L QD6A== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l20-20020a170906795400b00933f92e9917si8484633ejo.371.2023.03.22.02.50.14; Wed, 22 Mar 2023 02:50:37 -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 S230520AbjCVJ3x (ORCPT + 99 others); Wed, 22 Mar 2023 05:29:53 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761060992231838403?= X-GMAIL-MSGID: =?utf-8?q?1761060992231838403?= 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;