Skip to content

mm/zsmalloc: add zpdesc memory descriptor for zswap.zpool

[email protected] linux-mm lkml 8 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest21 patches 10 repliesIn review
  2. v621 patches 0 repliesSuperseded
  3. v5 posting 2/20 of 21 patches 18 repliesSuperseded
Earlier versions · 5
VersionPostedPatchesRepliesStatus
v5 posting 1/221 patches0 repliesSuperseded
v422 patches26 repliesSuperseded
v320 patches2 repliesSuperseded
v220 patches1 replySuperseded
v120 patches7 repliesSuperseded

Changes in v7 from the cover letter

- rebase on akpm/mm-unstable on Aug 30

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/21mm/zsmalloc: add zpdesc memory descriptor for zswap.zpoolmm/zpdesc.h mm/zsmalloc.c+77 -41 reply
2/21mm/zsmalloc: use zpdesc in trylock_zspage()/lock_zspage()mm/zpdesc.h mm/zsmalloc.c+73 -210 replies
3/21mm/zsmalloc: convert __zs_map_object/__zs_unmap_object to use zpdescmm/zsmalloc.c+13 -80 replies
4/21mm/zsmalloc: add and use pfn/zpdesc seeking funcsmm/zpdesc.h mm/zsmalloc.c+47 -370 replies
5/21mm/zsmalloc: convert obj_malloc() to use zpdescmm/zsmalloc.c+8 -80 replies
6/21mm/zsmalloc: convert create_page_chain() and its users to use zpdescmm/zpdesc.h mm/zsmalloc.c+76 -390 replies
7/21mm/zsmalloc: convert obj_allocated() and related helpers to use zpdescmm/zsmalloc.c+10 -100 replies
8/21mm/zsmalloc: convert init_zspage() to use zpdescmm/zsmalloc.c+8 -80 replies
9/21mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdescmm/zsmalloc.c+5 -50 replies
10/21mm/zsmalloc: add zpdesc_is_isolated()/zpdesc_zone() helper for zs_page_migrate()mm/zpdesc.h mm/zsmalloc.c+27 -140 replies
11/21mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in itmm/zsmalloc.c+7 -50 replies
12/21mm/zsmalloc: convert __free_zspage() to use zdsescmm/zpdesc.h mm/zsmalloc.c+14 -100 replies
13/21mm/zsmalloc: convert location_to_obj() to take zpdescmm/zsmalloc.c+6 -70 replies
14/21mm/zsmalloc: convert migrate_zspage() to use zpdescmm/zsmalloc.c+4 -40 replies
15/21mm/zsmalloc: convert get_zspage() to take zpdescmm/zsmalloc.c+10 -100 replies
16/21mm/zsmalloc: convert SetZsPageMovable and remove unused funcsmm/zsmalloc.c+5 -280 replies
17/21mm/zsmalloc: convert get/set_first_obj_offset() to take zpdescmm/zsmalloc.c+14 -140 replies
18/21mm/zsmalloc: introduce __zpdesc_clear_movablemm/zpdesc.h mm/zsmalloc.c+6 -10 replies
19/21mm/zsmalloc: introduce __zpdesc_clear/set_zsmalloc()mm/zpdesc.h mm/zsmalloc.c+14 -40 replies
20/21mm/zsmalloc: introduce zpdesc_clear_first() helpermm/zsmalloc.c+6 -30 replies
21/21mm/zsmalloc: update comments for page->zpdesc changesmm/zsmalloc.c+31 -300 replies

Reviews trailers per patch

None of the 21 patches has a Reviewed-by or Acked-by.

PatchHyeonggon Yoo
1/21Originally-by
2/21Originally-by
3/21
4/21
5/21
6/21Originally-by
7/21
8/21
9/21
10/21
11/21
12/21
13/21
14/21
15/21
16/21Originally-by
17/21
18/21
19/21
20/21
21/21

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 00/21] mm/zsmalloc: add zpdesc memory descriptor for zswap.zpool

From: Alex Shi <[email protected]>

According to Metthew's plan, the page descriptor will be replace by a 8 bytes mem_desc on destination purpose.
https://lore.kernel.org/lkml/[email protected]/

This patchset abstracts the memory descriptor used in zsmalloc by zswap/zram. The descriptor still overlays the struct page; nothing has changed in that regard. What this patchset accomplishes is the use of folios in to save some code size, and the introduction of a new concept, zpdesc. This patchset is just an initial step; it does not bias the potential changes to kmem_alloc or larger zspage modifications.

To name the struct zpdesc instead of zsdesc, since there are still 3 zpools under zswap: zbud, z3fold, zsmalloc for now(z3fold maybe removed soon), and we could easyly extend it to other zswap.zpool in needs.

For all zswap.zpools, they are all using single page since often used under memory pressure. So the conversion via folio series helper is better than page's for compound_head check saving.

For now, all zpools are using some page struct members, like page.flags for PG_private/PG_locked. and list_head lru, page.mapping for page migration.

This patachset does not increase the descriptor size nor introduce any functional changes, and could save about 122Kbytes zsmalloc.o size.

Thanks a lot for comments and suggestion from Yosry, Yoo, Sergey, Willy and Vishal!

Thanks
Alex
---
v6->v7:
- rebase on akpm/mm-unstable on Aug 30

v5->v6:
- rebase on akpm/mm-unstable on Aug 4
- recover 2 helpers and update code comments according to Vishal's comments on patch 1 and 6.

v4->v5:
- rebase on akpm/mm-unstable on Aug 8 + Stephen Rothwell's build fix.
- add a helper and update code comments according to Sergey's comments
- fold patch 20/21, remove 3 helpers functions according to Vishal's comments

v3->v4:
- rebase on akpm/mm-unstable Jul 21
- fixed a build warning reported by LKP
- Add a comment update for struct page to zpdesc change

v2->v3:
- Fix LKP reported build issue
- Update the Usage of struct zpdesc fields.
- Rebase onto latest mm-unstable commit 2073cda629a4

v1->v2:
- Take Yosry and Yoo's suggestion to add more members in zpdesc,
- Rebase on latest mm-unstable commit 31334cf98dbd
Alex Shi (10):
mm/zsmalloc: add zpdesc memory descriptor for zswap.zpool mm/zsmalloc: use zpdesc in trylock_zspage()/lock_zspage() mm/zsmalloc: convert create_page_chain() and its users to use zpdesc mm/zsmalloc: rename reset_page to reset_zpdesc and use zpdesc in it mm/zsmalloc: convert SetZsPageMovable and remove unused funcs mm/zsmalloc: convert get/set_first_obj_offset() to take zpdesc mm/zsmalloc: introduce __zpdesc_clear_movable mm/zsmalloc: introduce __zpdesc_clear/set_zsmalloc() mm/zsmalloc: introduce zpdesc_clear_first() helper mm/zsmalloc: update comments for page->zpdesc changes

Hyeonggon Yoo (11):
mm/zsmalloc: convert __zs_map_object/__zs_unmap_object to use zpdesc mm/zsmalloc: add and use pfn/zpdesc seeking funcs mm/zsmalloc: convert obj_malloc() to use zpdesc mm/zsmalloc: convert obj_allocated() and related helpers to use zpdesc mm/zsmalloc: convert init_zspage() to use zpdesc mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc mm/zsmalloc: add zpdesc_is_isolated()/zpdesc_zone() helper for
zs_page_migrate()
mm/zsmalloc: convert __free_zspage() to use zdsesc mm/zsmalloc: convert location_to_obj() to take zpdesc mm/zsmalloc: convert migrate_zspage() to use zpdesc mm/zsmalloc: convert get_zspage() to take zpdesc

 mm/zpdesc.h   | 147 +++++++++++++++
 mm/zsmalloc.c | 490 +++++++++++++++++++++++++++-----------------------
 2 files changed, 414 insertions(+), 223 deletions(-)
 create mode 100644 mm/zpdesc.h
Signature · 1 line
2.46.0