[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230713042037.980211-14-42.hyeyoo@gmail.com>
Date: Thu, 13 Jul 2023 13:20:28 +0900
From: Hyeonggon Yoo <42.hyeyoo@...il.com>
To: Minchan Kim <minchan@...nel.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Matthew Wilcox <willy@...radead.org>,
Mike Rapoport <rppt@...nel.org>,
Hyeonggon Yoo <42.hyeyoo@...il.com>
Subject: [RFC PATCH v2 13/21] mm/zsmalloc: convert reset_page() to reset_zsdesc()
reset_page() is called prior to freeing base pages of a zspage.
As it's closely associated with details of struct page, rename it to
reset_zsdesc() and move closer to newly added zsdesc helper functions.
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@...il.com>
---
mm/zsmalloc.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 5141a0c72c61..085f5c791a03 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -388,6 +388,17 @@ static inline void free_zsdesc(struct zsdesc *zsdesc)
__free_page(page);
}
+static void reset_zsdesc(struct zsdesc *zsdesc)
+{
+ struct page *page = zsdesc_page(zsdesc);
+
+ __ClearPageMovable(page);
+ ClearPagePrivate(page);
+ set_page_private(page, 0);
+ page_mapcount_reset(page);
+ page->index = 0;
+}
+
/* huge object: pages_per_zspage == 1 && maxobj_per_zspage == 1 */
static void SetZsHugePage(struct zspage *zspage)
{
@@ -962,15 +973,6 @@ static inline bool obj_allocated(struct zsdesc *zsdesc, void *obj,
return true;
}
-static void reset_page(struct page *page)
-{
- __ClearPageMovable(page);
- ClearPagePrivate(page);
- set_page_private(page, 0);
- page_mapcount_reset(page);
- page->index = 0;
-}
-
static int trylock_zspage(struct zspage *zspage)
{
struct zsdesc *cursor, *fail;
@@ -1010,7 +1012,7 @@ static void __free_zspage(struct zs_pool *pool, struct size_class *class,
do {
VM_BUG_ON_PAGE(!PageLocked(page), page);
next = get_next_page(page);
- reset_page(page);
+ reset_zsdesc(page_zsdesc(page));
unlock_page(page);
dec_zone_page_state(page, NR_ZSPAGES);
put_page(page);
@@ -2016,7 +2018,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
inc_zone_page_state(newpage, NR_ZSPAGES);
}
- reset_page(page);
+ reset_zsdesc(page_zsdesc(page));
put_page(page);
return MIGRATEPAGE_SUCCESS;
--
2.41.0
Powered by blists - more mailing lists