[PATCH 15/15] mm/z3fold: introduce __zpdesc_clear_movable

alexs
2024-06-21T05:43:08Z

Add a helper __zpdesc_clear_movable() for __ClearPageMovable(), and use it
in callers, that make code clear.

Signed-off-by: Alex Shi <alexs@kernel.org>
---
mm/z3fold.c | 4 ++--
mm/zpdesc.h | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/mm/z3fold.c b/mm/z3fold.c
index 35e48440c517..e23d56f46760 100644
--- a/mm/z3fold.c
+++ b/mm/z3fold.c
@@ -352,7 +352,7 @@ static void free_z3fold_page(struct zpdesc *zpdesc, bool headless)
{
if (!headless) {
zpdesc_lock(zpdesc);
- __ClearPageMovable(zpdesc_page(zpdesc));
+ __zpdesc_clear_movable(zpdesc);
zpdesc_unlock(zpdesc);
}
__free_page(zpdesc_page(zpdesc));
@@ -1322,7 +1322,7 @@ static int z3fold_page_migrate(struct page *newpage, struct page *page,
* so we only have to reinitialize it.
*/
INIT_LIST_HEAD(&new_zhdr->buddy);
- __ClearPageMovable(zpdesc_page(zpdesc));
+ __zpdesc_clear_movable(zpdesc);

zpdesc_get(newzpdesc);
z3fold_page_lock(new_zhdr);
diff --git a/mm/zpdesc.h b/mm/zpdesc.h
index 44473382f2cc..1319575dc31a 100644
--- a/mm/zpdesc.h
+++ b/mm/zpdesc.h
@@ -79,4 +79,9 @@ static inline void __zpdesc_set_movable(struct zpdesc *zpdesc,
__SetPageMovable(zpdesc_page(zpdesc), mops);
}

+static inline void __zpdesc_clear_movable(struct zpdesc *zpdesc)
+{
+ __ClearPageMovable(zpdesc_page(zpdesc));
+}
+
#endif
--
2.43.0