diff mbox series

[RFC,v2,16/21] mm/zsmalloc: convert location_to_obj() to use zsdesc

Message ID 20230713042037.980211-17-42.hyeyoo@gmail.com (mailing list archive)
State New
Headers show
Series mm/zsmalloc: Split zsdesc from struct page | expand

Commit Message

Hyeonggon Yoo July 13, 2023, 4:20 a.m. UTC
As all users of location_to_obj() now use zsdesc, convert
location_to_obj() to use zsdesc.

Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
---
 mm/zsmalloc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Sergey Senozhatsky July 20, 2023, 7:49 a.m. UTC | #1
On (23/07/13 13:20), Hyeonggon Yoo wrote:
>  /**
> - * 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

      @zsdesc:

>   * @obj_idx: object index
>   */
diff mbox series

Patch

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);
 		}