From: alexs@kernel.org
To: Vitaly Wool <vitaly.wool@konsulko.com>,
Miaohe Lin <linmiaohe@huawei.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
minchan@kernel.org, willy@infradead.org,
senozhatsky@chromium.org, david@redhat.com, 42.hyeyoo@gmail.com
Cc: Alex Shi <alexs@kernel.org>
Subject: [PATCH 14/15] mm/z3fold: introduce __zpdesc_set_movable
Date: Fri, 21 Jun 2024 13:46:54 +0800 [thread overview]
Message-ID: <20240621054658.1220796-15-alexs@kernel.org> (raw)
In-Reply-To: <20240621054658.1220796-1-alexs@kernel.org>
From: Alex Shi <alexs@kernel.org>
Add a helper __zpdesc_set_movable() for __SetPageMovable(), and use it
in callers.
Since we actually use the page.mapping for 'struct movable_operations'
pointer, we could add it into zpdesc struct now.
Originally-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: Alex Shi <alexs@kernel.org>
---
mm/z3fold.c | 6 +++---
mm/zpdesc.h | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/mm/z3fold.c b/mm/z3fold.c
index 7d95c0293664..35e48440c517 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -1050,11 +1050,11 @@ static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp,
}
if (can_sleep) {
zpdesc_lock(zpdesc);
- __SetPageMovable(zpdesc_page(zpdesc), &z3fold_mops);
+ __zpdesc_set_movable(zpdesc, &z3fold_mops);
zpdesc_unlock(zpdesc);
} else {
WARN_ON(!zpdesc_trylock(zpdesc));
- __SetPageMovable(zpdesc_page(zpdesc), &z3fold_mops);
+ __zpdesc_set_movable(zpdesc, &z3fold_mops);
zpdesc_unlock(zpdesc);
}
z3fold_page_lock(zhdr);
@@ -1334,7 +1334,7 @@ static int z3fold_page_migrate(struct page *newpage, struct page *page,
encode_handle(new_zhdr, MIDDLE);
set_bit(NEEDS_COMPACTING, &newzpdesc->zppage_flag);
new_zhdr->cpu = smp_processor_id();
- __SetPageMovable(zpdesc_page(newzpdesc), &z3fold_mops);
+ __zpdesc_set_movable(newzpdesc, &z3fold_mops);
z3fold_page_unlock(new_zhdr);
queue_work_on(new_zhdr->cpu, pool->compact_wq, &new_zhdr->work);
diff --git a/mm/zpdesc.h b/mm/zpdesc.h
index 9ead7a452f2a..44473382f2cc 100644
--- a/mm/zpdesc.h
+++ b/mm/zpdesc.h
@@ -73,4 +73,10 @@ static inline void zpdesc_unlock(struct zpdesc *zpdesc)
folio_unlock(zpdesc_folio(zpdesc));
}
+static inline void __zpdesc_set_movable(struct zpdesc *zpdesc,
+ const struct movable_operations *mops)
+{
+ __SetPageMovable(zpdesc_page(zpdesc), mops);
+}
+
#endif
--
2.43.0
next prev parent reply other threads:[~2024-06-21 5:43 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-21 5:46 [PATCH 00/15] add zpdesc memory descriptor for zswap.zpool alexs
2024-06-21 5:46 ` [PATCH 01/15] mm/z3fold: add zpdesc struct and helper and use them in z3fold_page_isolate alexs
2024-06-21 5:46 ` [PATCH 02/15] mm/z3fold: use zpdesc in z3fold_page_migrate alexs
2024-06-21 5:46 ` [PATCH 03/15] mm/z3fold: use zpdesc in z3fold_page_putback alexs
2024-06-21 5:46 ` [PATCH 04/15] mm/z3fold: use zpdesc in get/put_z3fold_header funcs alexs
2024-06-21 5:46 ` [PATCH 05/15] mm/z3fold: use zpdesc in init_z3fold_page alexs
2024-06-21 5:46 ` [PATCH 06/15] mm/z3fold: use zpdesc in free_z3fold_page alexs
2024-06-21 5:46 ` [PATCH 07/15] mm/z3fold: convert page to zpdesc in __release_z3fold_page alexs
2024-06-21 5:46 ` [PATCH 08/15] mm/z3fold: use zpdesc free_pages_work alexs
2024-06-21 5:46 ` [PATCH 09/15] mm/z3fold: use zpdesc in z3fold_compact_page and do_compact_page alexs
2024-06-21 5:46 ` [PATCH 10/15] mm/z3fold: use zpdesc in __z3fold_alloc alexs
2024-06-21 5:46 ` [PATCH 11/15] mm/z3fold: use zpdesc in z3fold_alloc alexs
2024-06-21 5:46 ` [PATCH 12/15] mm/z3fold: use zpdesc in free_z3fold_page and z3fold_free alexs
2024-06-21 5:46 ` [PATCH 13/15] mm/z3fold: use zpdesc in z3fold_map/z3fold_unmap alexs
2024-06-21 5:46 ` alexs [this message]
2024-06-21 5:46 ` [PATCH 15/15] mm/z3fold: introduce __zpdesc_clear_movable alexs
2024-06-21 6:43 ` [PATCH 00/15] add zpdesc memory descriptor for zswap.zpool Alex Shi
2024-06-24 21:46 ` Yosry Ahmed
2024-06-25 8:11 ` Alex Shi
2024-06-25 9:28 ` Hyeonggon Yoo
2024-06-25 13:39 ` Alex Shi
2024-06-25 10:30 ` Yosry Ahmed
2024-06-25 13:44 ` Alex Shi
2024-06-25 17:22 ` Nhat Pham
2024-06-25 21:02 ` Yosry Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240621054658.1220796-15-alexs@kernel.org \
--to=alexs@kernel.org \
--cc=42.hyeyoo@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=senozhatsky@chromium.org \
--cc=vitaly.wool@konsulko.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox