Skip to content

Implement writeback for zsmalloc

Nhat Pham linux-mm lkml 8 versions – Applied

Status from this message: [merged mm-stable] zsmalloc-implement-writeback-mechanism-for-zsmalloc.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest6 patches 14 repliesApplied 6/6
  2. v6 posting 2/22 of 6 patches 0 repliesSuperseded
  3. v6 posting 1/26 patches 32 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v56 patches9 repliesSuperseded
v45 patches10 repliesSuperseded
v35 patches8 repliesSuperseded
v21 of 5 patches7 repliesSuperseded
v15 patches21 repliesSuperseded

Changes in v7 from the cover letter

* Rebase this series of patch on top of mm-unstable which removes some duplicate code (patch 1).
v6-fix:
* Add a comment explaining LRU update logic in zs_map_object. (patch 4)
(sugegested by Sergey Senozhatsky and Johannes Weiner).
* Use get_first_page() and add cond_resched() in retry-loop. (patch 6) (sugegested by Sergey Senozhatsky).

Patches in v7 All 6 applied

#Subject and filesSizeRepliesApplied
1/6zswap: fix writeback lock ordering for zsmallocmm/zswap.c+19 -161 replyApplied
2/6zpool: clean out dead codemm/z3fold.c mm/zbud.c mm/zpool.c+12 -660 repliesApplied
3/6zsmalloc: Consolidate zs_pool's migrate_lock and size_class's locksmm/zsmalloc.c+37 -501 replyApplied
4/6zsmalloc: Add a LRU to zs_pool to keep track of zspages in LRU ordermm/zsmalloc.c+50 -06 repliesApplied
5/6zsmalloc: Add zpool_ops field to zs_pool to store evict handlersmm/zsmalloc.c+10 -12 repliesApplied
6/6zsmalloc: Implement writeback mechanism for zsmallocmm/zsmalloc.c+183 -112 repliesApplied

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchSergey SenozhatskyMinchan KimJohannes Weiner
1/6R-b
2/6R-b
3/6R-b A-b A-b
4/6R-b A-b
5/6R-b A-b A-b
6/6R-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v7 thread

Cover letter [PATCH v7 0/6] Implement writeback for zsmalloc

Changelog:
v7:
* Rebase this series of patch on top of mm-unstable which removes some duplicate code (patch 1).
v6-fix:
* Add a comment explaining LRU update logic in zs_map_object. (patch 4)
(sugegested by Sergey Senozhatsky and Johannes Weiner).
* Use get_first_page() and add cond_resched() in retry-loop. (patch 6) (sugegested by Sergey Senozhatsky).
v6:
* Move the move-to-front logic into zs_map_object (patch 4) (suggested by Minchan Kim).
* Small clean up for free_zspage at free_handles() call site (patch 6) (suggested by Minchan Kim).
v5:
* Add a new patch that eliminates unused code in zpool and simplify the logic for storing evict handler in zbud/z3fold (patch 2)
* Remove redudant fields in zs_pool (previously required by zpool)

    (patch 3)

* Wrap under_reclaim and deferred handle freeing logic in CONFIG_ZPOOL (patch 6) (suggested by Minchan Kim)
* Move a small piece of refactoring from patch 6 to patch 4.
v4:
* Wrap the new LRU logic in CONFIG_ZPOOL (patch 3). (suggested by Minchan Kim)
v3:
* Set pool->ops = NULL when pool->zpool_ops is null (patch 4).
* Stop holding pool's lock when calling lock_zspage() (patch 5). (suggested by Sergey Senozhatsky)
* Stop holding pool's lock when checking pool->ops and retries. (patch 5) (suggested by Sergey Senozhatsky)
* Fix formatting issues (.shrink, extra spaces in casting removed). (patch 5) (suggested by Sergey Senozhatsky)
v2:
* Add missing CONFIG_ZPOOL ifdefs (patch 5)
(detected by kernel test robot).

Unlike other zswap's allocators such as zbud or z3fold, zsmalloc currently lacks the writeback mechanism. This means that when the zswap pool is full, it will simply reject further allocations, and the pages will be written directly to swap.

This series of patches implements writeback for zsmalloc. When the zswap pool becomes full, zsmalloc will attempt to evict all the compressed objects in the least-recently used zspages.

There are 6 patches in this series:

Johannes Weiner (2):
zswap: fix writeback lock ordering for zsmalloc
zpool: clean out dead code

Nhat Pham (4):
zsmalloc: Consolidate zs_pool's migrate_lock and size_class's locks
zsmalloc: Add a LRU to zs_pool to keep track of zspages in LRU order
zsmalloc: Add zpool_ops field to zs_pool to store evict handlers
zsmalloc: Implement writeback mechanism for zsmalloc

 mm/z3fold.c   |  36 +-----
 mm/zbud.c     |  32 +----
 mm/zpool.c    |  10 +-
 mm/zsmalloc.c | 342 +++++++++++++++++++++++++++++++++++++++++---------
 mm/zswap.c    |  35 +++---
 5 files changed, 311 insertions(+), 144 deletions(-)

--
2.30.2