On (23/06/12 13:51), Andrew Morton wrote: > Subject: mm: zswap: add pool shrinking mechanism > Date: Mon, 12 Jun 2023 11:38:09 +0200 > > Patch series "mm: zswap: move writeback LRU from zpool to zswap", v3. > > This series aims to improve the zswap reclaim mechanism by reorganizing > the LRU management. In the current implementation, the LRU is maintained > within each zpool driver, resulting in duplicated code across the three > drivers. The proposed change consists in moving the LRU management from > the individual implementations up to the zswap layer. > > The primary objective of this refactoring effort is to simplify the > codebase. By unifying the reclaim loop and consolidating LRU handling > within zswap, we can eliminate redundant code and improve > maintainability. Additionally, this change enables the reclamation of > stored pages in their actual LRU order. Presently, the zpool drivers > link backing pages in an LRU, causing compressed pages with different > LRU positions to be written back simultaneously. > > The series consists of several patches. The first patch implements the > LRU and the reclaim loop in zswap, but it is not used yet because all > three driver implementations are marked as zpool_evictable. > The following three commits modify each zpool driver to be not > zpool_evictable, allowing the use of the reclaim loop in zswap. > As the drivers removed their shrink functions, the zpool interface is > then trimmed by removing zpool_evictable, zpool_ops, and zpool_shrink. > Finally, the code in zswap is further cleaned up by simplifying the > writeback function and removing the now unnecessary zswap_header. > > > This patch (of 7): > > Each zpool driver (zbud, z3fold and zsmalloc) implements its own shrink > function, which is called from zpool_shrink. However, with this commit, a > unified shrink function is added to zswap. The ultimate goal is to > eliminate the need for zpool_shrink once all zpool implementations have > dropped their shrink code. > > To ensure the functionality of each commit, this change focuses solely on > adding the mechanism itself. No modifications are made to the backends, > meaning that functionally, there are no immediate changes. The zswap > mechanism will only come into effect once the backends have removed their > shrink code. The subsequent commits will address the modifications needed > in the backends. > > Link: https://lkml.kernel.org/r/20230612093815.133504-1-cerasuolodomenico@xxxxxxxxx > Link: https://lkml.kernel.org/r/20230612093815.133504-2-cerasuolodomenico@xxxxxxxxx > Signed-off-by: Domenico Cerasuolo <cerasuolodomenico@xxxxxxxxx> > Acked-by: Nhat Pham <nphamcs@xxxxxxxxx> > Tested-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx> > Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> > Reviewed-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx> > Cc: Dan Streetman <ddstreet@xxxxxxxx> > Cc: Minchan Kim <minchan@xxxxxxxxxx> > Cc: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> > Cc: Seth Jennings <sjenning@xxxxxxxxxx> > Cc: Vitaly Wool <vitaly.wool@xxxxxxxxxxxx> > Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Reviewed-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>