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: <20240621054658.1220796-10-alexs@kernel.org>
Date: Fri, 21 Jun 2024 13:46:49 +0800
From: alexs@...nel.org
To: Vitaly Wool <vitaly.wool@...sulko.com>,
	Miaohe Lin <linmiaohe@...wei.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org,
	linux-mm@...ck.org,
	minchan@...nel.org,
	willy@...radead.org,
	senozhatsky@...omium.org,
	david@...hat.com,
	42.hyeyoo@...il.com
Cc: Alex Shi <alexs@...nel.org>
Subject: [PATCH 09/15] mm/z3fold: use zpdesc in z3fold_compact_page and do_compact_page

From: Alex Shi <alexs@...nel.org>

The main purpose is converting page->private to zpdesc->zppage_flag too.

Signed-off-by: Alex Shi <alexs@...nel.org>
---
 mm/z3fold.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/mm/z3fold.c b/mm/z3fold.c
index 97580e2224c2..3d36448885c9 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -691,12 +691,12 @@ static struct z3fold_header *compact_single_buddy(struct z3fold_header *zhdr)
 /* Has to be called with lock held */
 static int z3fold_compact_page(struct z3fold_header *zhdr)
 {
-	struct page *page = virt_to_page(zhdr);
+	struct zpdesc *zpdesc = page_zpdesc(virt_to_page(zhdr));
 
-	if (test_bit(MIDDLE_CHUNK_MAPPED, &page->private))
+	if (test_bit(MIDDLE_CHUNK_MAPPED, &zpdesc->zppage_flag))
 		return 0; /* can't move middle chunk, it's used */
 
-	if (unlikely(PageIsolated(page)))
+	if (unlikely(PageIsolated(zpdesc_page(zpdesc))))
 		return 0;
 
 	if (zhdr->middle_chunks == 0)
@@ -739,14 +739,13 @@ static int z3fold_compact_page(struct z3fold_header *zhdr)
 static void do_compact_page(struct z3fold_header *zhdr, bool locked)
 {
 	struct z3fold_pool *pool = zhdr_to_pool(zhdr);
-	struct page *page;
+	struct zpdesc *zpdesc = page_zpdesc(virt_to_page(zhdr));
 
-	page = virt_to_page(zhdr);
 	if (locked)
 		WARN_ON(z3fold_page_trylock(zhdr));
 	else
 		z3fold_page_lock(zhdr);
-	if (WARN_ON(!test_and_clear_bit(NEEDS_COMPACTING, &page->private))) {
+	if (WARN_ON(!test_and_clear_bit(NEEDS_COMPACTING, &zpdesc->zppage_flag))) {
 		z3fold_page_unlock(zhdr);
 		return;
 	}
@@ -757,8 +756,8 @@ static void do_compact_page(struct z3fold_header *zhdr, bool locked)
 	if (put_z3fold_locked(zhdr))
 		return;
 
-	if (test_bit(PAGE_STALE, &page->private) ||
-	    test_and_set_bit(PAGE_CLAIMED, &page->private)) {
+	if (test_bit(PAGE_STALE, &zpdesc->zppage_flag) ||
+	    test_and_set_bit(PAGE_CLAIMED, &zpdesc->zppage_flag)) {
 		z3fold_page_unlock(zhdr);
 		return;
 	}
@@ -766,7 +765,7 @@ static void do_compact_page(struct z3fold_header *zhdr, bool locked)
 	if (!zhdr->foreign_handles && buddy_single(zhdr) &&
 	    zhdr->mapped_count == 0 && compact_single_buddy(zhdr)) {
 		if (!put_z3fold_locked(zhdr)) {
-			clear_bit(PAGE_CLAIMED, &page->private);
+			clear_bit(PAGE_CLAIMED, &zpdesc->zppage_flag);
 			z3fold_page_unlock(zhdr);
 		}
 		return;
@@ -774,7 +773,7 @@ static void do_compact_page(struct z3fold_header *zhdr, bool locked)
 
 	z3fold_compact_page(zhdr);
 	add_to_unbuddied(pool, zhdr);
-	clear_bit(PAGE_CLAIMED, &page->private);
+	clear_bit(PAGE_CLAIMED, &zpdesc->zppage_flag);
 	z3fold_page_unlock(zhdr);
 }
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ