From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53F42C48BE5 for ; Fri, 18 Jun 2021 02:52:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CAB1161241 for ; Fri, 18 Jun 2021 02:52:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CAB1161241 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 612D26B0070; Thu, 17 Jun 2021 22:52:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C2DD6B0071; Thu, 17 Jun 2021 22:52:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4635B6B0072; Thu, 17 Jun 2021 22:52:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id 167AA6B0070 for ; Thu, 17 Jun 2021 22:52:51 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9FBB4181AEF07 for ; Fri, 18 Jun 2021 02:52:50 +0000 (UTC) X-FDA: 78265322100.24.58952B5 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf05.hostedemail.com (Postfix) with ESMTP id 95072E00027B for ; Fri, 18 Jun 2021 02:52:49 +0000 (UTC) Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4G5k0s1c6lzZdGs; Fri, 18 Jun 2021 10:49:49 +0800 (CST) Received: from [10.174.176.146] (10.174.176.146) by dggeme703-chm.china.huawei.com (10.1.199.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Fri, 18 Jun 2021 10:52:45 +0800 Subject: Re: [PATCH v2 2/2] mm/zbud: don't export any zbud API To: Nathan Chancellor CC: , , , , References: <20210608114515.206992-1-linmiaohe@huawei.com> <20210608114515.206992-3-linmiaohe@huawei.com> <813ac556-4a48-1e29-ad87-1ddb74546ef1@huawei.com> <621684b8-7aac-97e5-198e-e62061c79301@kernel.org> From: Miaohe Lin Message-ID: Date: Fri, 18 Jun 2021 10:52:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <621684b8-7aac-97e5-198e-e62061c79301@kernel.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US X-Originating-IP: [10.174.176.146] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggeme703-chm.china.huawei.com (10.1.199.99) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 95072E00027B X-Stat-Signature: p39ukw68j338uqcbxccyn1g4nbdkgghk Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=none) header.from=huawei.com X-HE-Tag: 1623984769-369310 Content-Transfer-Encoding: quoted-printable 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: On 2021/6/18 10:42, Nathan Chancellor wrote: > On 6/17/2021 7:28 PM, Miaohe Lin wrote: >> Hi: >> On 2021/6/18 8:44, Nathan Chancellor wrote: >>> On Tue, Jun 08, 2021 at 07:45:15PM +0800, Miaohe Lin wrote: >>>> The zbud doesn't need to export any API and it is meant to be used v= ia >>>> zpool API since the commit 12d79d64bfd3 ("mm/zpool: update zswap to = use >>>> zpool"). So we can remove the unneeded zbud.h and move down zpool AP= I >>>> to avoid any forward declaration. >>>> >>>> Signed-off-by: Miaohe Lin >>> >> >> Thank you for help figure these warnings out. It seems zbud module won= 't do >> anything when CONFIG_ZPOOL is disabled. I think we should make zbud de= pends >> on ZPOOL and eliminate the CONFIG_ZPOOL macro in zbud.c like what z3fo= ld does. >> Does this make sense for you? >> Thanks again. :) >=20 > That seems logical to me. It probably makes sense to send that as a fix= patch for this one so Andrew can squash it in. Sure. This is also what I meant to do. Will do it later. Many thanks! >=20 > Cheers, > Nathan >=20 >> diff --git a/mm/Kconfig b/mm/Kconfig >> index 8f748010f7ea..5dc28e9205e0 100644 >> --- a/mm/Kconfig >> +++ b/mm/Kconfig >> @@ -674,6 +674,7 @@ config ZPOOL >> >> =C2=A0 config ZBUD >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tristate "Low (Up to = 2x) density storage for compressed pages" >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 depends on ZPOOL >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 help >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 A special= purpose allocator for storing compressed pages. >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 It is des= igned to store up to two compressed pages per physical >> diff --git a/mm/zbud.c b/mm/zbud.c >> index 3f61304405cb..6348932430b8 100644 >> --- a/mm/zbud.c >> +++ b/mm/zbud.c >> @@ -111,10 +111,8 @@ struct zbud_pool { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct list_head lru; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 u64 pages_nr; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const struct zbud_ops= *ops; >> -#ifdef CONFIG_ZPOOL >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct zpool *zpool; >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 const struct zpool_op= s *zpool_ops; >> -#endif >> =C2=A0 }; >> >> =C2=A0 /* >> @@ -526,8 +524,6 @@ static u64 zbud_get_pool_size(struct zbud_pool *po= ol) >> =C2=A0=C2=A0 * zpool >> =C2=A0=C2=A0 ****************/ >> >> -#ifdef CONFIG_ZPOOL >> - >> =C2=A0 static int zbud_zpool_evict(struct zbud_pool *pool, unsigned lo= ng handle) >> =C2=A0 { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (pool->zpool && po= ol->zpool_ops && pool->zpool_ops->evict) >> @@ -618,7 +614,6 @@ static struct zpool_driver zbud_zpool_driver =3D { >> =C2=A0 }; >> >> =C2=A0 MODULE_ALIAS("zpool-zbud"); >> -#endif /* CONFIG_ZPOOL */ >> >> =C2=A0 static int __init init_zbud(void) >> =C2=A0 { >> @@ -626,19 +621,14 @@ static int __init init_zbud(void) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 BUILD_BUG_ON(sizeof(s= truct zbud_header) > ZHDR_SIZE_ALIGNED); >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pr_info("loaded\n"); >> >> -#ifdef CONFIG_ZPOOL >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 zpool_register_driver= (&zbud_zpool_driver); >> -#endif >> >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return 0; >> =C2=A0 } >> >> =C2=A0 static void __exit exit_zbud(void) >> =C2=A0 { >> -#ifdef CONFIG_ZPOOL >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 zpool_unregister_driv= er(&zbud_zpool_driver); >> -#endif >> - >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 pr_info("unloaded\n")= ; >> =C2=A0 } >> >>> This patch causes several new warnings when CONFIG_ZPOOL is disabled: >>> >>> mm/zbud.c:222:26: warning: unused function 'zbud_create_pool' [-Wunus= ed-function] >>> mm/zbud.c:246:13: warning: unused function 'zbud_destroy_pool' [-Wunu= sed-function] >>> mm/zbud.c:270:12: warning: unused function 'zbud_alloc' [-Wunused-fun= ction] >>> mm/zbud.c:345:13: warning: unused function 'zbud_free' [-Wunused-func= tion] >>> mm/zbud.c:417:12: warning: unused function 'zbud_reclaim_page' [-Wunu= sed-function] >>> mm/zbud.c:499:14: warning: unused function 'zbud_map' [-Wunused-funct= ion] >>> mm/zbud.c:509:13: warning: unused function 'zbud_unmap' [-Wunused-fun= ction] >>> mm/zbud.c:520:12: warning: unused function 'zbud_get_pool_size' [-Wun= used-function] >>> >>> It seems to me like all of these functions should be sunk into their >>> callers and eliminated entirely as part of this refactoring. I took a >>> whack at it but got lost with the kernel docs so someone who is famil= iar >>> with this should probably do it. >>> >>> Cheers, >>> Nathan >>> . >>> >> >=20 > .