linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: akpm@linux-foundation.org, sjenning@redhat.com,
	ddstreet@ieee.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [PATCH v2 2/2] mm/zbud: don't export any zbud API
Date: Thu, 17 Jun 2021 19:42:30 -0700	[thread overview]
Message-ID: <621684b8-7aac-97e5-198e-e62061c79301@kernel.org> (raw)
In-Reply-To: <813ac556-4a48-1e29-ad87-1ddb74546ef1@huawei.com>

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 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 <linmiaohe@huawei.com>
>>
> 
> 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. :)

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.

Cheers,
Nathan

> 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
>> .
>>
> 


  reply	other threads:[~2021-06-18  2:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-08 11:45 [PATCH v2 0/2] Cleanups for zbud Miaohe Lin
2021-06-08 11:45 ` [PATCH v2 1/2] mm/zbud: reuse unbuddied[0] as buddied in zbud_pool Miaohe Lin
2021-06-08 11:45 ` [PATCH v2 2/2] mm/zbud: don't export any zbud API Miaohe Lin
2021-06-18  0:44   ` Nathan Chancellor
2021-06-18  2:28     ` Miaohe Lin
2021-06-18  2:42       ` Nathan Chancellor [this message]
2021-06-18  2:52         ` Miaohe Lin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=621684b8-7aac-97e5-198e-e62061c79301@kernel.org \
    --to=nathan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=ddstreet@ieee.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sjenning@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).