mbox series

[v9,mm-unstable,00/18] Add zpdesc memory descriptor for zswap.zpool

Message ID 20241216150450.1228021-1-42.hyeyoo@gmail.com (mailing list archive)
Headers show
Series Add zpdesc memory descriptor for zswap.zpool | expand

Message

Hyeonggon Yoo Dec. 16, 2024, 3:04 p.m. UTC
This patch series introduces a new memory descriptor for zswap.zpool that
currently overlaps with struct page for now. This is part of the effort
to reduce the size of struct page and to enable dynamic allocation of
memory descriptors [1].

This series does not bloat anything for zsmalloc and no functional
change is intended (except for using zpdesc and folios).

In the near future, the removal of page->index from struct page [2]
will be addressed and the project also depends on this patch series.

I think this series is now ready to be included in mm-unstable if there's
no objection. Sergey thankfully added Reviewed-by and Tested-by tags on v8.
But as I updated the patchset, could you please explicitly add them for v9
as well? A range-diff output is included at the end of this cover letter
to help review.

Thanks to everyone got involved in this series, especially, Alex who's been
pushing it forward this year.

v8: https://lore.kernel.org/linux-mm/20241205175000.3187069-1-willy@infradead.org
[1] https://lore.kernel.org/linux-mm/ZvRKzKizOfEWBtJp@casper.infradead.org
[2] https://lore.kernel.org/linux-mm/Z09hOy-UY9KC8WMb@casper.infradead.org

v8 -> v9:
Functionally very little change and most of them are comment/changelog
updates.

  - (patch 1) Added comments for basic zpdesc helper functions,
    some bits copied from struct slab.

  - (patch 4) Changed 'f_zpdesc->next = NULL' to 'f_zpdesc->handle = 0'
    as f_zpdesc here is for a huge zspage.

  - (patch 17) Fixed a mistake in a previous rebase from v6 to v7.

  - (page 11, 19) Changed reset_zpdesc() to use struct page for robustness
    against re-organizing zpdesc fields.

  - Dropped patch 20 in v8 as it does not make re-implementing
    zsdesc management easier in the glorious future. we can just
    re-implement the whole reset_zpdesc().

  - Dropped patch 21 in v8 and folded some comments of the patch into
    patch 2 that introduces zpdesc_{un,}lock().

The rest of the changes are changelog/comment cleanups.

Cheers,
Hyeonggon

Alex Shi (7):
  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: convert reset_page to reset_zpdesc
  mm/zsmalloc: convert SetZsPageMovable and remove unused funcs
  mm/zsmalloc: convert get/set_first_obj_offset() to take zpdesc
  mm/zsmalloc: introduce __zpdesc_clear/set_zsmalloc()

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 two helpers for zs_page_migrate() and make it use
    zpdesc
  mm/zsmalloc: convert __free_zspage() to use zpdesc
  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   | 182 +++++++++++++++++++++
 mm/zsmalloc.c | 436 ++++++++++++++++++++++++++------------------------
 2 files changed, 408 insertions(+), 210 deletions(-)
 create mode 100644 mm/zpdesc.h