linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chengming Zhou <chengming.zhou@linux.dev>
To: Johannes Weiner <hannes@cmpxchg.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Yosry Ahmed <yosryahmed@google.com>,
	Nhat Pham <nphamcs@gmail.com>,
	Chengming Zhou <zhouchengming@bytedance.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm: zpool: return pool size in pages
Date: Tue, 12 Mar 2024 12:56:35 +0800	[thread overview]
Message-ID: <02886208-06df-4370-b0a1-6295b654bea2@linux.dev> (raw)
In-Reply-To: <20240311161214.1145168-2-hannes@cmpxchg.org>

On 2024/3/12 00:12, Johannes Weiner wrote:
> All zswap backends track their pool sizes in pages. Currently they
> multiply by PAGE_SIZE for zswap, only for zswap to divide again in
> order to do limit math. Report pages directly.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

With the incremental diff, feel free to add:

Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>

Thanks.

> ---
>  mm/z3fold.c   | 2 +-
>  mm/zbud.c     | 2 +-
>  mm/zpool.c    | 4 ++--
>  mm/zsmalloc.c | 2 +-
>  mm/zswap.c    | 4 ++--
>  5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/z3fold.c b/mm/z3fold.c
> index 7ab05621052d..9bacacd4168c 100644
> --- a/mm/z3fold.c
> +++ b/mm/z3fold.c
> @@ -1404,7 +1404,7 @@ static void z3fold_zpool_unmap(void *pool, unsigned long handle)
>  
>  static u64 z3fold_zpool_total_size(void *pool)
>  {
> -	return z3fold_get_pool_size(pool) * PAGE_SIZE;
> +	return z3fold_get_pool_size(pool);
>  }
>  
>  static struct zpool_driver z3fold_zpool_driver = {
> diff --git a/mm/zbud.c b/mm/zbud.c
> index 2190cc1f37b3..b7d8a22bbf5f 100644
> --- a/mm/zbud.c
> +++ b/mm/zbud.c
> @@ -412,7 +412,7 @@ static void zbud_zpool_unmap(void *pool, unsigned long handle)
>  
>  static u64 zbud_zpool_total_size(void *pool)
>  {
> -	return zbud_get_pool_size(pool) * PAGE_SIZE;
> +	return zbud_get_pool_size(pool);
>  }
>  
>  static struct zpool_driver zbud_zpool_driver = {
> diff --git a/mm/zpool.c b/mm/zpool.c
> index 846410479c2f..410808aee7fe 100644
> --- a/mm/zpool.c
> +++ b/mm/zpool.c
> @@ -324,9 +324,9 @@ void zpool_unmap_handle(struct zpool *zpool, unsigned long handle)
>   * zpool_get_total_size() - The total size of the pool
>   * @zpool:	The zpool to check
>   *
> - * This returns the total size in bytes of the pool.
> + * This returns the total size in pages of the pool.
>   *
> - * Returns: Total size of the zpool in bytes.
> + * Returns: Total size of the zpool in pages.
>   */
>  u64 zpool_get_total_size(struct zpool *zpool)
>  {
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 7d7cb3eaabe0..398f3856817f 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -401,7 +401,7 @@ static void zs_zpool_unmap(void *pool, unsigned long handle)
>  
>  static u64 zs_zpool_total_size(void *pool)
>  {
> -	return zs_get_total_pages(pool) << PAGE_SHIFT;
> +	return zs_get_total_pages(pool);
>  }
>  
>  static struct zpool_driver zs_zpool_driver = {
> diff --git a/mm/zswap.c b/mm/zswap.c
> index 7c39327a7cc2..fe4343e416e0 100644
> --- a/mm/zswap.c
> +++ b/mm/zswap.c
> @@ -507,7 +507,7 @@ static unsigned long zswap_max_pages(void)
>  unsigned long zswap_total_pages(void)
>  {
>  	struct zswap_pool *pool;
> -	u64 total = 0;
> +	unsigned long total = 0;
>  
>  	rcu_read_lock();
>  	list_for_each_entry_rcu(pool, &zswap_pools, list) {
> @@ -518,7 +518,7 @@ unsigned long zswap_total_pages(void)
>  	}
>  	rcu_read_unlock();
>  
> -	return total >> PAGE_SHIFT;
> +	return total;
>  }
>  
>  /*********************************


  parent reply	other threads:[~2024-03-12  4:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-11 16:12 [PATCH 1/2] mm: zswap: optimize zswap pool size tracking Johannes Weiner
2024-03-11 16:12 ` [PATCH 2/2] mm: zpool: return pool size in pages Johannes Weiner
2024-03-11 22:12   ` Yosry Ahmed
2024-03-12  2:36     ` Johannes Weiner
2024-03-12  4:07       ` Yosry Ahmed
2024-03-12  4:56   ` Chengming Zhou [this message]
2024-03-12  9:15   ` Nhat Pham
2024-03-11 22:09 ` [PATCH 1/2] mm: zswap: optimize zswap pool size tracking Yosry Ahmed
2024-03-12  2:34   ` Johannes Weiner
2024-03-12  4:04     ` Yosry Ahmed
2024-03-12  4:55 ` Chengming Zhou
2024-03-12  9:12 ` Nhat Pham
2024-03-12 15:34 [PATCH V2 " Johannes Weiner
2024-03-12 15:34 ` [PATCH 2/2] mm: zpool: return pool size in pages Johannes Weiner

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=02886208-06df-4370-b0a1-6295b654bea2@linux.dev \
    --to=chengming.zhou@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=yosryahmed@google.com \
    --cc=zhouchengming@bytedance.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