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

alexs
2024-06-21T05:42:49Z

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 --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)
--
2.43.0