lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1439190743-13933-5-git-send-email-minchan@kernel.org>
Date:	Mon, 10 Aug 2015 16:12:23 +0900
From:	Minchan Kim <minchan@...nel.org>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	gioh.kim@....com,
	Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	Minchan Kim <minchan@...nel.org>
Subject: [RFC zsmalloc 4/4] zsmalloc: move struct zs_meta from mapping to somewhere

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 <minchan@...nel.org>
---
 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 majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ