[PATCH 0/3] mm: zswap: trivial folio conversions

From: Yosry Ahmed
Date: Thu May 23 2024 - 23:38:29 EST


Some trivial folio conversions in zswap code.

The mean reason I included a cover letter is that I wanted to get
feedback on what other trivial conversions can/should be done in
mm/zswap.c (keeping in mind that only order-0 folios are supported
anyway). These are the things I came across while searching for 'page'
in mm/zswap.c, and chose not to do anything about for now:

1. zswap_max_pages(), zswap_accept_thr_pages(), zswap_total_pages():
- We can use 'size' instead of 'pages' and shift the return by
PAGE_SHIFT. This adds an unnecessary shift, but I doubt it matters
at all. The motivation is to get rid of 'page' to find things that
should be converted more easily.

2. Counters names: zswap_stored_pages, zswap_written_back_pages, etc.

3. Comments all over the place reference 'page' instead of 'folio'.

4. shrink_memcg_cb(), zswap_shrinker_scan():
- Rename encountered_page_in_swap_cache to
encounterd_folio_in_swap_cache, or even better: folio_eexist or
hit_swap_cache.

5. entry_to_nid():
- It's tempting to try to use folio_to_nid(virt_to_folio()), but I
think this adds an unnecessary call to compound_head(). It may not
matter in practice though because the page is always a head page.

Yosry Ahmed (3):
mm: zswap: use sg_set_folio() in zswap_{compress/decompress}()
mm :zswap: use kmap_local_folio() in zswap_load()
mm: zswap: make same_filled functions folio-friendly

mm/zswap.c | 41 ++++++++++++++++++-----------------------
1 file changed, 18 insertions(+), 23 deletions(-)

--
2.45.1.288.g0e0cd299f1-goog