@@ -1373,14 +1373,14 @@ static void shrink_worker(struct work_struct *w)
/*********************************
* same-filled functions
**********************************/
-static bool zswap_is_folio_same_filled(struct folio *folio, unsigned long *value)
+static bool zswap_is_folio_same_filled(struct folio *folio, long index, unsigned long *value)
{
unsigned long *page;
unsigned long val;
unsigned int pos, last_pos = PAGE_SIZE / sizeof(*page) - 1;
bool ret = false;
- page = kmap_local_folio(folio, 0);
+ page = kmap_local_folio(folio, index * PAGE_SIZE);
val = page[0];
if (val != page[last_pos])
@@ -1450,7 +1450,7 @@ bool zswap_store(struct folio *folio)
goto reject;
}
- if (zswap_is_folio_same_filled(folio, &value)) {
+ if (zswap_is_folio_same_filled(folio, 0, &value)) {
entry->length = 0;
entry->value = value;
atomic_inc(&zswap_same_filled_pages);
This change is being made so that zswap_store can process mTHP folios. Modified zswap_is_folio_same_filled() to work for any-order folios, by accepting an additional "index" parameter to arrive at the page within the folio to run the same-filled page check. Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@intel.com> --- mm/zswap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)