linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chengming Zhou <zhouchengming@bytedance.com>
To: Nhat Pham <nphamcs@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Yosry Ahmed <yosryahmed@google.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm/zswap: global lru and shrinker shared by all zswap_pools
Date: Mon, 12 Feb 2024 21:20:19 +0800	[thread overview]
Message-ID: <e3068889-3991-429c-8a08-b23a1b2d368a@bytedance.com> (raw)
In-Reply-To: <CAKEwX=Nbbm=BZ8Rp7Knfk3P=jXK2SJnhgR_vOK9w1ovPUdF9UA@mail.gmail.com>

On 2024/2/12 05:04, Nhat Pham wrote:
> On Sun, Feb 11, 2024 at 5:57 AM Chengming Zhou
> <zhouchengming@bytedance.com> wrote:
>>
>> Dynamic zswap_pool creation may create/reuse to have multiple
>> zswap_pools in a list, only the first will be current used.
>>
>> Each zswap_pool has its own lru and shrinker, which is not
>> necessary and has its problem:
>>
>> 1. When memory has pressure, all shrinker of zswap_pools will
>>    try to shrink its own lru, there is no order between them.
>>
>> 2. When zswap limit hit, only the last zswap_pool's shrink_work
>>    will try to shrink its lru, which is inefficient.
>>
>> Anyway, having a global lru and shrinker shared by all zswap_pools
>> is better and efficient.
>>
>> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> 
> I'll do a careful review later, but IMO this is a good idea :)

Ok, thanks, take your time. :)

> 
> Chris pointed out when he reviewed the zswap shrinker patch series
> that the reclaim algorithm has to decide which pool to reclaim from,
> and I have always thought that it was a bit weird that we have to do
> it at all. We should reclaim stored objects by access ordering,
> irregardless of which pool it belongs to. Having a shared LRU and
> other associated reclaim structures is sound, and saves a bit of space
> too while we're at it.

Right, agree!


  reply	other threads:[~2024-02-12 13:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-11 13:57 [PATCH 0/2] mm/zswap: optimize for dynamic zswap_pools Chengming Zhou
2024-02-11 13:57 ` [PATCH 1/2] mm/zswap: global lru and shrinker shared by all zswap_pools Chengming Zhou
2024-02-11 19:01   ` kernel test robot
2024-02-12 13:17     ` Chengming Zhou
2024-02-11 21:04   ` Nhat Pham
2024-02-12 13:20     ` Chengming Zhou [this message]
2024-02-11 22:05   ` kernel test robot
2024-02-13 12:57   ` Yosry Ahmed
2024-02-13 14:20     ` Chengming Zhou
2024-02-13 17:43       ` Yosry Ahmed
2024-02-11 13:57 ` [PATCH 2/2] mm/zswap: change zswap_pool kref to percpu_ref Chengming Zhou
2024-02-11 21:21   ` Nhat Pham
2024-02-12 13:29     ` Chengming Zhou
2024-02-12 18:53       ` Nhat Pham
2024-02-13 14:22         ` Chengming Zhou
2024-02-12 22:42   ` Yosry Ahmed
2024-02-13 14:31     ` Chengming Zhou
2024-02-13 17:45       ` 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=e3068889-3991-429c-8a08-b23a1b2d368a@bytedance.com \
    --to=zhouchengming@bytedance.com \
    --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 \
    /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