Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1143401pxj; Fri, 18 Jun 2021 00:02:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwLyxO1GRll1eAUxNdS/iNHGxokNQKGf3YxEjOl2qx3owk/iwMtKhoJkYrhAoN4n9fuYeTS X-Received: by 2002:a05:6602:2a43:: with SMTP id k3mr6980272iov.47.1623999738158; Fri, 18 Jun 2021 00:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623999738; cv=none; d=google.com; s=arc-20160816; b=P3TlHAehQ4eK4cE91CPFaoG1Sppvl9qSWLS5FNfAxb9OWnz5HJf0z7dV15Pt8QY/sQ t3R2XHo98PNMUbKenmbHNAdp4PNYE8NW/fxOFerdQJ+31JtxTMKkHrbIyCoppNSigY0R 62booXJfuTFwi+VwqEbsNLiSbp9eF1IbjLhyY3pa0k78ZKIjRCLogb5i2rVnhMIO/9mk or5XCHvI8ymIm58g/A63mfhe40mwmuXf/okS1sHI1ljPPZoSQYi2QZRxT1er7JgGmtNI oinGmdBlHHzsopNKT0TzNuorem8yRVqnIWnwdmEhHHP9f4sTEpTpgD20I9yHlnER6z4+ S3Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=qXfD7it5YaOdWe+90tx5BUQxdLcddDuQ6oOvA7/bVSU=; b=SM3OqCfSgr6KkH6T7KFGapDxOHCnOSNdojdq5NyNMFy8tKuOPvPIO2m3bDKl+up2pr DNGM/kcZUwyW+ePOGRIcm9CFGX6dW8zYlyIes8kQxyLG1/J1KbcIx1hPqCMhdUAX33KS gMQh9+mXTWE/03GQp+3lPeSYKLMHA+Yb7jlwfcR25WUbwqN+G/vtrZa6IF6oBj6+8D1z vp59sVQPAPgnsCWLVkMofmfvU7M8xp0XqKzHXi96RNSJViZu9bJk4Fa18PyN04l4LS4Z lf/lbWeU0k4lAAv5DugQ9cwcUT/cZswiakDE/udUmN9jqZjGm8JOB31uFnQlmllHslF+ 5IEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n18si7918487iob.78.2021.06.18.00.02.04; Fri, 18 Jun 2021 00:02:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233603AbhFRCbI (ORCPT + 99 others); Thu, 17 Jun 2021 22:31:08 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:5032 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231289AbhFRCbH (ORCPT ); Thu, 17 Jun 2021 22:31:07 -0400 Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4G5jQx5JYJzXgkK; Fri, 18 Jun 2021 10:23:53 +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:28:56 +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> From: Miaohe Lin Message-ID: <813ac556-4a48-1e29-ad87-1ddb74546ef1@huawei.com> Date: Fri, 18 Jun 2021 10:28:56 +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: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.176.146] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggeme703-chm.china.huawei.com (10.1.199.99) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 via >> 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 API >> 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 depends on ZPOOL and eliminate the CONFIG_ZPOOL macro in zbud.c like what z3fold does. Does this make sense for you? Thanks again. :) diff --git a/mm/Kconfig b/mm/Kconfig index 8f748010f7ea..5dc28e9205e0 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -674,6 +674,7 @@ config ZPOOL config ZBUD tristate "Low (Up to 2x) density storage for compressed pages" + depends on ZPOOL help A special purpose allocator for storing compressed pages. It is designed 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 { struct list_head lru; u64 pages_nr; const struct zbud_ops *ops; -#ifdef CONFIG_ZPOOL struct zpool *zpool; const struct zpool_ops *zpool_ops; -#endif }; /* @@ -526,8 +524,6 @@ static u64 zbud_get_pool_size(struct zbud_pool *pool) * zpool ****************/ -#ifdef CONFIG_ZPOOL - static int zbud_zpool_evict(struct zbud_pool *pool, unsigned long handle) { if (pool->zpool && pool->zpool_ops && pool->zpool_ops->evict) @@ -618,7 +614,6 @@ static struct zpool_driver zbud_zpool_driver = { }; MODULE_ALIAS("zpool-zbud"); -#endif /* CONFIG_ZPOOL */ static int __init init_zbud(void) { @@ -626,19 +621,14 @@ static int __init init_zbud(void) BUILD_BUG_ON(sizeof(struct zbud_header) > ZHDR_SIZE_ALIGNED); pr_info("loaded\n"); -#ifdef CONFIG_ZPOOL zpool_register_driver(&zbud_zpool_driver); -#endif return 0; } static void __exit exit_zbud(void) { -#ifdef CONFIG_ZPOOL zpool_unregister_driver(&zbud_zpool_driver); -#endif - pr_info("unloaded\n"); } > This patch causes several new warnings when CONFIG_ZPOOL is disabled: > > mm/zbud.c:222:26: warning: unused function 'zbud_create_pool' [-Wunused-function] > mm/zbud.c:246:13: warning: unused function 'zbud_destroy_pool' [-Wunused-function] > mm/zbud.c:270:12: warning: unused function 'zbud_alloc' [-Wunused-function] > mm/zbud.c:345:13: warning: unused function 'zbud_free' [-Wunused-function] > mm/zbud.c:417:12: warning: unused function 'zbud_reclaim_page' [-Wunused-function] > mm/zbud.c:499:14: warning: unused function 'zbud_map' [-Wunused-function] > mm/zbud.c:509:13: warning: unused function 'zbud_unmap' [-Wunused-function] > mm/zbud.c:520:12: warning: unused function 'zbud_get_pool_size' [-Wunused-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 familiar > with this should probably do it. > > Cheers, > Nathan > . >