[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230713042037.980211-17-42.hyeyoo@gmail.com>
Date: Thu, 13 Jul 2023 13:20:31 +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 16/21] mm/zsmalloc: convert location_to_obj() to use zsdesc
As all users of location_to_obj() now use zsdesc, convert
location_to_obj() to use zsdesc.
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@...il.com>
---
mm/zsmalloc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 69bd497de35e..fd920b659b1d 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -948,15 +948,15 @@ static void obj_to_zsdesc(unsigned long obj, struct zsdesc **zsdesc)
}
/**
- * location_to_obj - get obj value encoded from (<page>, <obj_idx>)
- * @page: page object resides in zspage
+ * location_to_obj - get obj value encoded from (<zsdesc>, <obj_idx>)
+ * @zsdesc object resides in zspage
* @obj_idx: object index
*/
-static unsigned long location_to_obj(struct page *page, unsigned int obj_idx)
+static unsigned long location_to_obj(struct zsdesc *zsdesc, unsigned int obj_idx)
{
unsigned long obj;
- obj = page_to_pfn(page) << OBJ_INDEX_BITS;
+ obj = zsdesc_pfn(zsdesc) << OBJ_INDEX_BITS;
obj |= obj_idx & OBJ_INDEX_MASK;
obj <<= OBJ_TAG_BITS;
@@ -1505,7 +1505,7 @@ static unsigned long obj_malloc(struct zs_pool *pool,
kunmap_atomic(vaddr);
mod_zspage_inuse(zspage, 1);
- obj = location_to_obj(zsdesc_page(m_zsdesc), obj);
+ obj = location_to_obj(m_zsdesc, obj);
return obj;
}
@@ -2014,7 +2014,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page,
old_obj = handle_to_obj(handle);
obj_to_location(old_obj, &dummy, &obj_idx);
- new_obj = (unsigned long)location_to_obj(zsdesc_page(new_zsdesc),
+ new_obj = (unsigned long)location_to_obj(new_zsdesc,
obj_idx);
record_obj(handle, new_obj);
}
--
2.41.0
Powered by blists - more mailing lists