mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
Cc: vitaly.wool@konsulko.com, minchan@kernel.org,
	senozhatsky@chromium.org, yosryahmed@google.com,
	linux-mm@kvack.org, ddstreet@ieee.org, sjenning@redhat.com,
	nphamcs@gmail.com, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [RFC PATCH 6/7] mm: zswap: simplify writeback function
Date: Mon, 5 Jun 2023 11:44:05 -0400	[thread overview]
Message-ID: <20230605154405.GC221380@cmpxchg.org> (raw)
In-Reply-To: <20230605085419.44383-7-cerasuolodomenico@gmail.com>

On Mon, Jun 05, 2023 at 10:54:18AM +0200, Domenico Cerasuolo wrote:
> @@ -1142,9 +1122,6 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
>  	zswap_written_back_pages++;
>  
>  	spin_lock(&tree->lock);
> -	/* drop local reference */
> -	zswap_entry_put(tree, entry);
> -
>  	/*
>  	* There are two possible situations for entry here:
>  	* (1) refcount is 1(normal case),  entry is valid and on the tree
> @@ -1152,7 +1129,7 @@ static int zswap_writeback_entry(struct zpool *pool, unsigned long handle)
>  	*     because invalidate happened during writeback
>  	*  search the tree and free the entry if find entry
>  	*/
> -	if (entry == zswap_rb_search(&tree->rbroot, offset))
> +	if (entry == zswap_rb_search(&tree->rbroot, swp_offset(swpentry)))
>  		zswap_entry_put(tree, entry);
>  	spin_unlock(&tree->lock);

This can be moved to zswap_shrink() as well. It already has a
post-writeback tree->lock section for lru putback and dropping its
local reference, it should do this as well.

Writeback is then is done after it bumped zswap_written_pages.

  reply	other threads:[~2023-06-05 15:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-05  8:54 [PATCH 0/7] mm: zswap: move writeback LRU from zpool to zswap Domenico Cerasuolo
2023-06-05  8:54 ` [RFC PATCH 1/7] mm: zswap: add pool shrinking mechanism Domenico Cerasuolo
2023-06-05 15:29   ` Johannes Weiner
2023-06-06  9:31     ` Domenico Cerasuolo
2023-06-06  2:18   ` Yosry Ahmed
2023-06-06  9:35     ` Domenico Cerasuolo
2023-06-05  8:54 ` [RFC PATCH 2/7] mm: zswap: remove page reclaim logic from zbud Domenico Cerasuolo
2023-06-05  8:54 ` [RFC PATCH 3/7] mm: zswap: remove page reclaim logic from z3fold Domenico Cerasuolo
2023-06-05  8:54 ` [RFC PATCH 4/7] mm: zswap: remove page reclaim logic from zsmalloc Domenico Cerasuolo
2023-06-05 15:37   ` Johannes Weiner
2023-06-05 23:21     ` Nhat Pham
2023-06-05 23:37   ` Nhat Pham
2023-06-06  9:47     ` Domenico Cerasuolo
2023-06-05  8:54 ` [RFC PATCH 5/7] mm: zswap: remove shrink from zpool interface Domenico Cerasuolo
2023-06-05  8:54 ` [RFC PATCH 6/7] mm: zswap: simplify writeback function Domenico Cerasuolo
2023-06-05 15:44   ` Johannes Weiner [this message]
2023-06-05  8:54 ` [RFC PATCH 7/7] mm: zswap: remove zswap_header Domenico Cerasuolo

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=20230605154405.GC221380@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=cerasuolodomenico@gmail.com \
    --cc=ddstreet@ieee.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®