For supporting runtime compaction with VM, we need to have proper
address_space on every page so zsmalloc shouldn't use page->mapping.

This patch moves zsmalloc metadata from mapping to freelist.

Signed-off-by: Minchan Kim <[email protected]>
---
 mm/zsmalloc.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 55dc066..1b18144 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -30,7 +30,7 @@
  *             Look at size_class->huge.
  *     page->lru: links together first pages of various zspages.
  *             Basically forming list of zspages in a fullness group.
- *     page->mapping: override by struct zs_meta
+ *     page->freelist: override by struct zs_meta
  *
  * Usage of struct page flags:
  *     PG_private: identifies the first component page
@@ -261,7 +261,7 @@ struct zs_pool {
 
 /*
  * In this implementation, a free_idx, zspage's class index, fullness group,
- * inuse object count are encoded in its (first)page->mapping
+ * inuse object count are encoded in its (first)page->freelist
  * sizeof(struct zs_meta) should be equal to sizeof(unsigned long).
  */
 struct zs_meta {
@@ -414,7 +414,7 @@ static int get_inuse_obj(struct page *page)
 
        BUG_ON(!is_first_page(page));
 
-       m = (struct zs_meta *)&page->mapping;
+       m = (struct zs_meta *)&page->freelist;
 
        return m->inuse;
 }
@@ -425,19 +425,19 @@ static void set_inuse_obj(struct page *page, int inc)
 
        BUG_ON(!is_first_page(page));
 
-       m = (struct zs_meta *)&page->mapping;
+       m = (struct zs_meta *)&page->freelist;
        m->inuse += inc;
 }
 
 static void set_free_obj_idx(struct page *first_page, int idx)
 {
-       struct zs_meta *m = (struct zs_meta *)&first_page->mapping;
+       struct zs_meta *m = (struct zs_meta *)&first_page->freelist;
        m->free_idx = idx;
 }
 
 static unsigned long get_free_obj_idx(struct page *first_page)
 {
-       struct zs_meta *m = (struct zs_meta *)&first_page->mapping;
+       struct zs_meta *m = (struct zs_meta *)&first_page->freelist;
        return m->free_idx;
 }
 
@@ -447,7 +447,7 @@ static void get_zspage_mapping(struct page *page, unsigned 
int *class_idx,
        struct zs_meta *m;
        BUG_ON(!is_first_page(page));
 
-       m = (struct zs_meta *)&page->mapping;
+       m = (struct zs_meta *)&page->freelist;
        *fullness = m->fullness;
        *class_idx = m->class_idx;
 }
@@ -462,7 +462,7 @@ static void set_zspage_mapping(struct page *page, unsigned 
int class_idx,
        BUG_ON(class_idx >= (1 << CLASS_IDX_BITS));
        BUG_ON(fullness >= (1 << FULLNESS_BITS));
 
-       m = (struct zs_meta *)&page->mapping;
+       m = (struct zs_meta *)&page->freelist;
        m->fullness = fullness;
        m->class_idx = class_idx;
 }
@@ -908,7 +908,7 @@ static void reset_page(struct page *page)
        clear_bit(PG_private, &page->flags);
        clear_bit(PG_private_2, &page->flags);
        set_page_private(page, 0);
-       page->mapping = NULL;
+       page->freelist = NULL;
        page_mapcount_reset(page);
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to