diff mbox series

[10/15] mm/z3fold: use zpdesc in __z3fold_alloc

Message ID 20240621054658.1220796-11-alexs@kernel.org (mailing list archive)
State New
Headers show
Series add zpdesc memory descriptor for zswap.zpool | expand

Commit Message

alexs@kernel.org June 21, 2024, 5:46 a.m. UTC
From: Alex Shi <alexs@kernel.org>

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

Signed-off-by: Alex Shi <alexs@kernel.org>
---
 mm/z3fold.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/mm/z3fold.c b/mm/z3fold.c
index 3d36448885c9..f164eb4e1139 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -790,7 +790,7 @@  static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool,
 						size_t size, bool can_sleep)
 {
 	struct z3fold_header *zhdr = NULL;
-	struct page *page;
+	struct zpdesc *zpdesc;
 	struct list_head *unbuddied;
 	int chunks = size_to_chunks(size), i;
 
@@ -823,9 +823,9 @@  static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool,
 		zhdr->cpu = -1;
 		spin_unlock(&pool->lock);
 
-		page = virt_to_page(zhdr);
-		if (test_bit(NEEDS_COMPACTING, &page->private) ||
-		    test_bit(PAGE_CLAIMED, &page->private)) {
+		zpdesc = page_zpdesc(virt_to_page(zhdr));
+		if (test_bit(NEEDS_COMPACTING, &zpdesc->zppage_flag) ||
+		    test_bit(PAGE_CLAIMED, &zpdesc->zppage_flag)) {
 			z3fold_page_unlock(zhdr);
 			zhdr = NULL;
 			migrate_enable();
@@ -868,9 +868,9 @@  static inline struct z3fold_header *__z3fold_alloc(struct z3fold_pool *pool,
 			zhdr->cpu = -1;
 			spin_unlock(&pool->lock);
 
-			page = virt_to_page(zhdr);
-			if (test_bit(NEEDS_COMPACTING, &page->private) ||
-			    test_bit(PAGE_CLAIMED, &page->private)) {
+			zpdesc = page_zpdesc(virt_to_page(zhdr));
+			if (test_bit(NEEDS_COMPACTING, &zpdesc->zppage_flag) ||
+			    test_bit(PAGE_CLAIMED, &zpdesc->zppage_flag)) {
 				z3fold_page_unlock(zhdr);
 				zhdr = NULL;
 				if (can_sleep)