mm: zswap: move more same-filled pages checks outside of zswap_store()
authorYosry Ahmed <yosryahmed@google.com>
Sat, 13 Apr 2024 02:24:06 +0000 (02:24 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 6 May 2024 00:53:38 +0000 (17:53 -0700)
commite87b881489085b4832ad417da653739cbace49e7
treeaf73af849cdb082bcaa7194194de2403b8bc22e4
parent82e0f8e47b406bb5948c2300a02ac6ede21532c1
mm: zswap: move more same-filled pages checks outside of zswap_store()

Currently, zswap_store() checks zswap_same_filled_pages_enabled, kmaps the
folio, then calls zswap_is_page_same_filled() to check the folio contents.
Move this logic into zswap_is_page_same_filled() as well (and rename it
to use 'folio' while we are at it).

This makes zswap_store() cleaner, and makes following changes to that
logic contained within the helper.

While we are at it:
- Rename the insert_entry label to store_entry to match xa_store().
- Add comment headers for same-filled functions and the main API
  functions (load, store, invalidate, swapon, swapoff).

No functional change intended.

Link: https://lkml.kernel.org/r/20240413022407.785696-4-yosryahmed@google.com
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Nhat Pham <nphamcs@gmail.com>
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/zswap.c