All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
Cc: vitaly.wool@konsulko.com, senozhatsky@chromium.org,
	yosryahmed@google.com, linux-mm@kvack.org, ddstreet@ieee.org,
	sjenning@redhat.com, nphamcs@gmail.com, hannes@cmpxchg.org,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com
Subject: Re: [RFC PATCH v2 4/7] mm: zswap: remove page reclaim logic from zsmalloc
Date: Wed, 7 Jun 2023 10:45:31 -0700	[thread overview]
Message-ID: <ZIDCO2dAOHFM5mhS@google.com> (raw)
In-Reply-To: <20230606145611.704392-5-cerasuolodomenico@gmail.com>

On Tue, Jun 06, 2023 at 04:56:08PM +0200, Domenico Cerasuolo wrote:
> With the recent enhancement to zswap enabling direct page writeback, the
> need for the shrink code in zsmalloc has become obsolete. As a result,
> this commit removes the page reclaim logic from zsmalloc entirely.
> 
> Signed-off-by: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
> ---
>  mm/zsmalloc.c | 393 ++------------------------------------------------
>  1 file changed, 13 insertions(+), 380 deletions(-)
> 
> diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
> index 02f7f414aade..75386283dba0 100644
> --- a/mm/zsmalloc.c
> +++ b/mm/zsmalloc.c
> @@ -107,21 +107,8 @@
>   */
>  #define OBJ_ALLOCATED_TAG 1
>  
> -#ifdef CONFIG_ZPOOL
> -/*
> - * The second least-significant bit in the object's header identifies if the
> - * value stored at the header is a deferred handle from the last reclaim
> - * attempt.
> - *
> - * As noted above, this is valid because we have room for two bits.
> - */
> -#define OBJ_DEFERRED_HANDLE_TAG	2
> -#define OBJ_TAG_BITS	2
> -#define OBJ_TAG_MASK	(OBJ_ALLOCATED_TAG | OBJ_DEFERRED_HANDLE_TAG)
> -#else
>  #define OBJ_TAG_BITS	1
>  #define OBJ_TAG_MASK	OBJ_ALLOCATED_TAG
> -#endif /* CONFIG_ZPOOL */
>  
>  #define OBJ_INDEX_BITS	(BITS_PER_LONG - _PFN_BITS - OBJ_TAG_BITS)
>  #define OBJ_INDEX_MASK	((_AC(1, UL) << OBJ_INDEX_BITS) - 1)
> @@ -227,12 +214,6 @@ struct link_free {
>  		 * Handle of allocated object.
>  		 */
>  		unsigned long handle;
> -#ifdef CONFIG_ZPOOL
> -		/*
> -		 * Deferred handle of a reclaimed object.
> -		 */
> -		unsigned long deferred_handle;
> -#endif
>  	};
>  };
>  
> @@ -250,13 +231,6 @@ struct zs_pool {
>  	/* Compact classes */
>  	struct shrinker shrinker;
>  
> -#ifdef CONFIG_ZPOOL
> -	/* List tracking the zspages in LRU order by most recently added object */
> -	struct list_head lru;
> -	struct zpool *zpool;
> -	const struct zpool_ops *zpool_ops;
> -#endif
> -
>  #ifdef CONFIG_ZSMALLOC_STAT
>  	struct dentry *stat_dentry;
>  #endif
> @@ -279,13 +253,6 @@ struct zspage {
>  	unsigned int freeobj;
>  	struct page *first_page;
>  	struct list_head list; /* fullness list */
> -
> -#ifdef CONFIG_ZPOOL
> -	/* links the zspage to the lru list in the pool */
> -	struct list_head lru;
> -	bool under_reclaim;
> -#endif
> -
>  	struct zs_pool *pool;
>  	rwlock_t lock;
>  };
> @@ -393,14 +360,7 @@ static void *zs_zpool_create(const char *name, gfp_t gfp,
>  	 * different contexts and its caller must provide a valid
>  	 * gfp mask.
>  	 */
> -	struct zs_pool *pool = zs_create_pool(name);
> -
> -	if (pool) {
> -		pool->zpool = zpool;
> -		pool->zpool_ops = zpool_ops;
> -	}
> -
> -	return pool;
> +	return zs_create_pool(name);
>  }
>  
>  static void zs_zpool_destroy(void *pool)
> @@ -422,27 +382,6 @@ static void zs_zpool_free(void *pool, unsigned long handle)
>  	zs_free(pool, handle);
>  }
>  
> -static int zs_reclaim_page(struct zs_pool *pool, unsigned int retries);
> -
> -static int zs_zpool_shrink(void *pool, unsigned int pages,
> -			unsigned int *reclaimed)
> -{
> -	unsigned int total = 0;
> -	int ret = -EINVAL;
> -
> -	while (total < pages) {
> -		ret = zs_reclaim_page(pool, 8);
> -		if (ret < 0)
> -			break;
> -		total++;
> -	}
> -
> -	if (reclaimed)
> -		*reclaimed = total;
> -
> -	return ret;
> -}
> -
>  static void *zs_zpool_map(void *pool, unsigned long handle,
>  			enum zpool_mapmode mm)
>  {
> @@ -481,7 +420,7 @@ static struct zpool_driver zs_zpool_driver = {
>  	.malloc_support_movable = true,
>  	.malloc =		  zs_zpool_malloc,
>  	.free =			  zs_zpool_free,
> -	.shrink =		  zs_zpool_shrink,
> +	.shrink =		  NULL,

You can simply delete the line instead since the NULL is default behavior.

Other than that, Super nice. Thanks, Domenico!

Acked-by: Minchan Kim <minchan@kernel.org>


  parent reply	other threads:[~2023-06-07 17:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06 14:56 [RFC PATCH v2 0/7] mm: zswap: move writeback LRU from zpool to zswap Domenico Cerasuolo
2023-06-06 14:56 ` [RFC PATCH v2 1/7] mm: zswap: add pool shrinking mechanism Domenico Cerasuolo
2023-06-07  8:14   ` Yosry Ahmed
2023-06-07  9:22     ` Domenico Cerasuolo
2023-06-07  9:31       ` Yosry Ahmed
2023-06-07 21:39   ` Nhat Pham
2023-06-08 15:58   ` Johannes Weiner
2023-06-08 16:52   ` Johannes Weiner
2023-06-08 17:04     ` Johannes Weiner
2023-06-08 18:45       ` Johannes Weiner
2023-06-09  8:39         ` Domenico Cerasuolo
2023-06-06 14:56 ` [RFC PATCH v2 2/7] mm: zswap: remove page reclaim logic from zbud Domenico Cerasuolo
2023-06-08 16:02   ` Johannes Weiner
2023-06-06 14:56 ` [RFC PATCH v2 3/7] mm: zswap: remove page reclaim logic from z3fold Domenico Cerasuolo
2023-06-08 16:05   ` Johannes Weiner
2023-06-06 14:56 ` [RFC PATCH v2 4/7] mm: zswap: remove page reclaim logic from zsmalloc Domenico Cerasuolo
2023-06-07 17:23   ` Nhat Pham
2023-06-07 17:45   ` Minchan Kim [this message]
2023-06-08 16:07   ` Johannes Weiner
2023-06-06 14:56 ` [RFC PATCH v2 5/7] mm: zswap: remove shrink from zpool interface Domenico Cerasuolo
2023-06-07  9:19   ` Yosry Ahmed
2023-06-08 16:10   ` Johannes Weiner
2023-06-08 17:51   ` Nhat Pham
2023-06-06 14:56 ` [RFC PATCH v2 6/7] mm: zswap: simplify writeback function Domenico Cerasuolo
2023-06-07  9:26   ` Yosry Ahmed
2023-06-09 10:23     ` Domenico Cerasuolo
2023-06-09 11:01       ` Yosry Ahmed
2023-06-08 16:48   ` Johannes Weiner
2023-06-09 11:05     ` Domenico Cerasuolo
2023-06-06 14:56 ` [RFC PATCH v2 7/7] mm: zswap: remove zswap_header Domenico Cerasuolo
2023-06-07  9:30   ` Yosry Ahmed
2023-06-09 16:10     ` Domenico Cerasuolo
2023-06-09 17:13       ` Yosry Ahmed
2023-06-07  9:16 ` [RFC PATCH v2 0/7] mm: zswap: move writeback LRU from zpool to zswap Yosry Ahmed
2023-06-07  9:23   ` Domenico Cerasuolo
2023-06-07  9:32     ` Yosry Ahmed

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=ZIDCO2dAOHFM5mhS@google.com \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cerasuolodomenico@gmail.com \
    --cc=ddstreet@ieee.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nphamcs@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=sjenning@redhat.com \
    --cc=vitaly.wool@konsulko.com \
    --cc=yosryahmed@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.