From: Alex Shi <alexs@xxxxxxxxxx> 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@xxxxxxxxx> Signed-off-by: Alex Shi <alexs@xxxxxxxxxx> --- 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