linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chengming Zhou <chengming.zhou@linux.dev>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: hannes@cmpxchg.org, yosryahmed@google.com, nphamcs@gmail.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Chengming Zhou <zhouchengming@bytedance.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH mm-hotfixes-unstable] mm/zswap: invalidate duplicate entry when !zswap_enabled
Date: Fri, 9 Feb 2024 12:50:41 +0800	[thread overview]
Message-ID: <61212b2b-7f40-42f0-9a44-1ab34a2a1cde@linux.dev> (raw)
In-Reply-To: <20240208130952.b2696eaf6a27eef9866723d4@linux-foundation.org>

On 2024/2/9 05:09, Andrew Morton wrote:
> On Thu,  8 Feb 2024 02:32:54 +0000 chengming.zhou@linux.dev wrote:
> 
>> From: Chengming Zhou <zhouchengming@bytedance.com>
>>
>> We have to invalidate any duplicate entry even when !zswap_enabled
>> since zswap can be disabled anytime. If the folio store success before,
>> then got dirtied again but zswap disabled, we won't invalidate the old
>> duplicate entry in the zswap_store(). So later lru writeback may
>> overwrite the new data in swapfile.
>>
>> ...
>>
>> --- a/mm/zswap.c
>> +++ b/mm/zswap.c
>> @@ -1516,7 +1516,7 @@ bool zswap_store(struct folio *folio)
>>  	if (folio_test_large(folio))
>>  		return false;
>>  
>> -	if (!zswap_enabled || !tree)
>> +	if (!tree)
>>  		return false;
>>  
>>  	/*
>> @@ -1531,6 +1531,10 @@ bool zswap_store(struct folio *folio)
>>  		zswap_invalidate_entry(tree, dupentry);
>>  	}
>>  	spin_unlock(&tree->lock);
>> +
>> +	if (!zswap_enabled)
>> +		return false;
>> +
>>  	objcg = get_obj_cgroup_from_folio(folio);
>>  	if (objcg && !obj_cgroup_may_zswap(objcg)) {
>>  		memcg = get_mem_cgroup_from_objcg(objcg);
> 
> OK, thanks.
> 
> I saw only one reject from mm-unstable patches.  Your patch "mm/zswap:
> make sure each swapfile always have zswap rb-tree" now does

It's correct. Thanks!

The other patch that includes optimization and cleanup is updated based on
mm-unstable and just resend:

https://lore.kernel.org/all/20240209044112.3883835-1-chengming.zhou@linux.dev/

> 
> --- a/mm/zswap.c~mm-zswap-make-sure-each-swapfile-always-have-zswap-rb-tree
> +++ a/mm/zswap.c
> @@ -1518,9 +1518,6 @@ bool zswap_store(struct folio *folio)
>  	if (folio_test_large(folio))
>  		return false;
>  
> -	if (!tree)
> -		return false;
> -
>  	/*
>  	 * If this is a duplicate, it must be removed before attempting to store
>  	 * it, otherwise, if the store fails the old page won't be removed from
> 
> 


  reply	other threads:[~2024-02-09  4:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 11:54 [PATCH v4] mm/zswap: invalidate old entry when store fail or !zswap_enabled chengming.zhou
2024-02-07 23:06 ` Nhat Pham
2024-02-08  2:34   ` Chengming Zhou
2024-02-07 23:43 ` Andrew Morton
2024-02-08  2:32   ` [PATCH mm-hotfixes-unstable] mm/zswap: invalidate duplicate entry when !zswap_enabled chengming.zhou
2024-02-08 13:14     ` Johannes Weiner
2024-02-08 21:09     ` Andrew Morton
2024-02-09  4:50       ` Chengming Zhou [this message]
2024-02-08  2:41   ` [PATCH v4] mm/zswap: invalidate old entry when store fail or !zswap_enabled Chengming Zhou
2024-02-09  4:41 ` [PATCH mm-unstable] mm/zswap: optimize and cleanup the invalidation of duplicate entry chengming.zhou

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=61212b2b-7f40-42f0-9a44-1ab34a2a1cde@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=stable@vger.kernel.org \
    --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