On 2024/2/12 05:04, Nhat Pham wrote: > On Sun, Feb 11, 2024 at 5:57 AM Chengming Zhou > <zhouchengming@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx> > > 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!