[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230713042037.980211-13-42.hyeyoo@gmail.com>
Date: Thu, 13 Jul 2023 13:20:27 +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 12/21] mm/zsmalloc: convert obj_to_page() and zs_free() to use zsdesc
Convert obj_to_page() to obj_to_zsdesc() and also convert its user
zs_free() to use zsdesc.
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@...il.com>
---
mm/zsmalloc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index c8c3039a751a..5141a0c72c61 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -915,10 +915,10 @@ static void obj_to_location(unsigned long obj, struct zsdesc **zsdesc,
*obj_idx = (obj & OBJ_INDEX_MASK);
}
-static void obj_to_page(unsigned long obj, struct page **page)
+static void obj_to_zsdesc(unsigned long obj, struct zsdesc **zsdesc)
{
obj >>= OBJ_TAG_BITS;
- *page = pfn_to_page(obj >> OBJ_INDEX_BITS);
+ *zsdesc = pfn_zsdesc(obj >> OBJ_INDEX_BITS);
}
/**
@@ -1593,7 +1593,7 @@ static void obj_free(int class_size, unsigned long obj)
void zs_free(struct zs_pool *pool, unsigned long handle)
{
struct zspage *zspage;
- struct page *f_page;
+ struct zsdesc *f_zsdesc;
unsigned long obj;
struct size_class *class;
int fullness;
@@ -1607,8 +1607,8 @@ void zs_free(struct zs_pool *pool, unsigned long handle)
*/
spin_lock(&pool->lock);
obj = handle_to_obj(handle);
- obj_to_page(obj, &f_page);
- zspage = get_zspage(f_page);
+ obj_to_zsdesc(obj, &f_zsdesc);
+ zspage = get_zspage(zsdesc_page(f_zsdesc));
class = zspage_class(pool, zspage);
class_stat_dec(class, ZS_OBJS_INUSE, 1);
--
2.41.0
Powered by blists - more mailing lists