Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2209517rwl; Sun, 26 Mar 2023 18:24:18 -0700 (PDT) X-Google-Smtp-Source: AKy350boVpOmVxoLjJxzD6Nnhya3/SaA3Oj0SDgcAW04xoUwMt49CiWcy4jfgBvsPqY4up+77kKL X-Received: by 2002:a17:906:1cda:b0:920:3263:d643 with SMTP id i26-20020a1709061cda00b009203263d643mr9611553ejh.72.1679880258171; Sun, 26 Mar 2023 18:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679880258; cv=none; d=google.com; s=arc-20160816; b=EATit4jqCSZSwKqJfSnertakIlx0liMeIRiwBSdDgp/lyxrwN6HVdfAacc0my3FU4O I1JoMoC8fWWy3b+s27gUKY9jYPAttaBVlzofWpPNHEinwlN6ttIgFAoEwcNhoMi32SJr 8pjmUIYh0x+0FzPtVEu+iyVkmaZ7cJQyGGdvMtQqnqOvuAkmZQCHUHHOy2XfzK/f4iRy nfspKZHYPtNcVRtjkHLZUdfO0Ax1/Ti3hAKmDYyEIwG4MLqq7Np7YiCUIsoJLJRIm7De snrnuPCj23LtcEHoFsdNQDEmgCUnDPTp+JUaHGt2PHdbhiJPqe1WpnbvV0Z4QSRElphT SuCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=g8brUsXqD/3J/KyGStPua4p9xrS+QSnkHuin9x1hZuU=; b=nIJ6pEI9ZtYg87yPWgBKZuUCEUmtkh484IuUwXSfzY7xrfuLE6kuYJl5p40qGZXZLr zgekToVK9WzWHaBPwln+cm4FTxmcKBYBfZQPQI/RADUrmG0mfZNXMvNcgxS5n3S+mrC1 m1V7z9bKaVkPfkGsAXhogLV0j2yt2JrdpxhOotkaCCoRtumGUqEWygecfojKsILbapzw 5T2ojoc98TC5Vo1B3/U/IXl+CTvTTdgN1cgLMyLkRjNnw5q0TfjJDPucn5+s7AJhlB0T 8i3viKSmquXa90yd/eDrLCvmNiWumS/hnsUFZjnQkWW1lAyDr3cAM1nfzXIetVC8iWDO j/eg== 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 tc11-20020a1709078d0b00b009394bed261dsi17196624ejc.107.2023.03.26.18.23.53; Sun, 26 Mar 2023 18:24:18 -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 S230180AbjC0BWn (ORCPT + 99 others); Sun, 26 Mar 2023 21:22:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjC0BWm (ORCPT ); Sun, 26 Mar 2023 21:22:42 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 489FA4EFD for ; Sun, 26 Mar 2023 18:22:40 -0700 (PDT) Received: from dggpemm100009.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4PlFQM2hrXzrXYB; Mon, 27 Mar 2023 09:21:31 +0800 (CST) Received: from [10.174.179.24] (10.174.179.24) 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; Mon, 27 Mar 2023 09:22:36 +0800 Subject: Re: [PATCH -next v7 2/4] mm/zswap: skip invalid or unchanged parameter To: Christoph Hellwig , Sergey Senozhatsky References: <20230325071420.2246461-1-liushixin2@huawei.com> <20230325071420.2246461-3-liushixin2@huawei.com> <20230326031723.GD3269998@google.com> <20230326045327.GE3269998@google.com> <20230326232508.GB19631@lst.de> CC: Seth Jennings , Dan Streetman , Vitaly Wool , Andrew Morton , Nathan Chancellor , , From: Liu Shixin Message-ID: Date: Mon, 27 Mar 2023 09:22:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20230326232508.GB19631@lst.de> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100009.china.huawei.com (7.185.36.113) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.3 required=5.0 tests=NICE_REPLY_A, 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 On 2023/3/27 7:25, Christoph Hellwig wrote: > On Sun, Mar 26, 2023 at 01:53:27PM +0900, Sergey Senozhatsky wrote: >>>> + if (kstrtobool(val, &res)) >>>> + return -EINVAL; >>>> + >>>> + /* no change required */ >>>> + if (res == *(bool *)kp->arg) >>>> + return 0; >>> Bool kernel param can be any of these letters 'YyTt1NnFf0'. Doing things >>> to kp->arg outside of kernel/params.c is not going to be easy, let's not >>> even try. >> Please disregard my previous email. kp->arg is always true or false >> at this point. I'd still prefer to not do kp->arg in zswap. > The whole parameter handling in zswap is a mess and I don't really > have a good idea how to solve it all. > > But for this "paramter not changed" case I think we can helper a lot > by adding a core moduleparam.h helper to encapsule it. I.e.: > > static inline bool param_bool_unchanged(bool val, > const struct kernel_param *kp) > > return val == *(bool *)kp->arg); > } > > and at least keep it out of zswap. Thanks for your advice. I will try this way. > > . >