lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250206072102.29045-15-kanchana.p.sridhar@intel.com>
Date: Wed,  5 Feb 2025 23:21:00 -0800
From: Kanchana P Sridhar <kanchana.p.sridhar@...el.com>
To: linux-kernel@...r.kernel.org,
	linux-mm@...ck.org,
	hannes@...xchg.org,
	yosry.ahmed@...ux.dev,
	nphamcs@...il.com,
	chengming.zhou@...ux.dev,
	usamaarif642@...il.com,
	ryan.roberts@....com,
	21cnbao@...il.com,
	akpm@...ux-foundation.org,
	linux-crypto@...r.kernel.org,
	herbert@...dor.apana.org.au,
	davem@...emloft.net,
	clabbe@...libre.com,
	ardb@...nel.org,
	ebiggers@...gle.com,
	surenb@...gle.com,
	kristen.c.accardi@...el.com
Cc: wajdi.k.feghali@...el.com,
	vinodh.gopal@...el.com,
	kanchana.p.sridhar@...el.com
Subject: [PATCH v6 14/16] mm: zswap: Introduce zswap_compress_folio() to compress all pages in a folio.

This patch encapsulates away the computes for compressing the pages in a
folio and storing the compressed memory in zpool, into a distinct
zswap_compress_folio() procedure.

For now, zswap_compress_folio() simply calls zswap_compress() for each page
in the folio it is called with.

This facilitates adding compress batching in subsequent patches.

Signed-off-by: Kanchana P Sridhar <kanchana.p.sridhar@...el.com>
---
 mm/zswap.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/mm/zswap.c b/mm/zswap.c
index af682bf0f690..6563d12e907b 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1509,6 +1509,22 @@ static void shrink_worker(struct work_struct *w)
 * main API
 **********************************/
 
+static bool zswap_compress_folio(struct folio *folio,
+				 struct zswap_entry *entries[],
+				 struct zswap_pool *pool)
+{
+	long index, nr_pages = folio_nr_pages(folio);
+
+	for (index = 0; index < nr_pages; ++index) {
+		struct page *page = folio_page(folio, index);
+
+		if (!zswap_compress(page, entries[index], pool))
+			return false;
+	}
+
+	return true;
+}
+
 /*
  * Store all pages in a folio.
  *
@@ -1542,12 +1558,8 @@ static bool zswap_store_folio(struct folio *folio,
 		entries[index]->handle = (unsigned long)ERR_PTR(-EINVAL);
 	}
 
-	for (index = 0; index < nr_pages; ++index) {
-		struct page *page = folio_page(folio, index);
-
-		if (!zswap_compress(page, entries[index], pool))
-			goto store_folio_failed;
-	}
+	if (!zswap_compress_folio(folio, entries, pool))
+		goto store_folio_failed;
 
 	for (index = 0; index < nr_pages; ++index) {
 		swp_entry_t page_swpentry = page_swap_entry(folio_page(folio, index));
-- 
2.27.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ