From: Alex Shi <alexs@xxxxxxxxxx> Convert page to zpdesc in free_z3fold_page and introduce new helper zpdesc_lock/unlock. this patch could saves about 10kbytes on object file size. Signed-off-by: Alex Shi <alexs@xxxxxxxxxx> --- mm/z3fold.c | 10 ++++++---- mm/zpdesc.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/mm/z3fold.c b/mm/z3fold.c index cd1332243c62..c3c740b42052 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -351,12 +351,14 @@ static struct z3fold_header *init_z3fold_page(struct page *page, bool headless, /* Resets the struct page fields and frees the page */ static void free_z3fold_page(struct page *page, bool headless) { + struct zpdesc *zpdesc = page_zpdesc(page); + if (!headless) { - lock_page(page); - __ClearPageMovable(page); - unlock_page(page); + zpdesc_lock(zpdesc); + __ClearPageMovable(zpdesc_page(zpdesc)); + zpdesc_unlock(zpdesc); } - __free_page(page); + __free_page(zpdesc_page(zpdesc)); } /* Helper function to build the index */ diff --git a/mm/zpdesc.h b/mm/zpdesc.h index 7fde29645331..06cfd33de330 100644 --- a/mm/zpdesc.h +++ b/mm/zpdesc.h @@ -58,4 +58,14 @@ static inline void zpdesc_put(struct zpdesc *zpdesc) folio_put(zpdesc_folio(zpdesc)); } +static inline void zpdesc_lock(struct zpdesc *zpdesc) +{ + folio_lock(zpdesc_folio(zpdesc)); +} + +static inline void zpdesc_unlock(struct zpdesc *zpdesc) +{ + folio_unlock(zpdesc_folio(zpdesc)); +} + #endif -- 2.43.0