From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Nitin Gupta <ngupta@vflare.org>,
Dan Streetman <ddstreet@ieee.org>,
Seth Jennings <sjennings@variantweb.net>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Luigi Semenzato <semenzato@google.com>,
Jerome Marchand <jmarchan@redhat.com>,
juno.choi@lge.com, seungho1.park@lge.com,
Minchan Kim <minchan@kernel.org>
Subject: [RFC 1/6] zsmalloc: expand size class to support sizeof(unsigned long)
Date: Tue, 2 Dec 2014 11:49:42 +0900 [thread overview]
Message-ID: <1417488587-28609-2-git-send-email-minchan@kernel.org> (raw)
In-Reply-To: <1417488587-28609-1-git-send-email-minchan@kernel.org>
For compaction of zsmalloc, we need to decouple handle and
obj position binding. For that, we need another memory to
keep handle and I want to reuse existing functions of zsmalloc
to implement indirect layer.
For that, we need to support new size class(ie, sizeof(unsigned
long)) so this patch does it.
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
mm/zsmalloc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 2021df5eb891..a806d714924c 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -100,7 +100,8 @@
* span more than 1 page which avoids complex case of mapping 2 pages simply
* to restore link_free pointer values.
*/
-#define ZS_ALIGN 8
+#define ZS_ALIGN (sizeof(struct link_free))
+#define ZS_HANDLE_SIZE (sizeof(unsigned long))
/*
* A single 'zspage' is composed of up to 2^N discontiguous 0-order (single)
@@ -138,11 +139,11 @@
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
/* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */
#define ZS_MIN_ALLOC_SIZE \
- MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
-#define ZS_MAX_ALLOC_SIZE PAGE_SIZE
+ MAX(ZS_ALIGN, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
+#define ZS_MAX_ALLOC_SIZE (PAGE_SIZE + ZS_HANDLE_SIZE)
/*
- * On systems with 4K page size, this gives 255 size classes! There is a
+ * On systems with 4K page size, this gives 257 size classes! There is a
* trader-off here:
* - Large number of size classes is potentially wasteful as free page are
* spread across these classes
--
2.0.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Nitin Gupta <ngupta@vflare.org>,
Dan Streetman <ddstreet@ieee.org>,
Seth Jennings <sjennings@variantweb.net>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Luigi Semenzato <semenzato@google.com>,
Jerome Marchand <jmarchan@redhat.com>,
juno.choi@lge.com, seungho1.park@lge.com,
Minchan Kim <minchan@kernel.org>
Subject: [RFC 1/6] zsmalloc: expand size class to support sizeof(unsigned long)
Date: Tue, 2 Dec 2014 11:49:42 +0900 [thread overview]
Message-ID: <1417488587-28609-2-git-send-email-minchan@kernel.org> (raw)
In-Reply-To: <1417488587-28609-1-git-send-email-minchan@kernel.org>
For compaction of zsmalloc, we need to decouple handle and
obj position binding. For that, we need another memory to
keep handle and I want to reuse existing functions of zsmalloc
to implement indirect layer.
For that, we need to support new size class(ie, sizeof(unsigned
long)) so this patch does it.
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
mm/zsmalloc.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 2021df5eb891..a806d714924c 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -100,7 +100,8 @@
* span more than 1 page which avoids complex case of mapping 2 pages simply
* to restore link_free pointer values.
*/
-#define ZS_ALIGN 8
+#define ZS_ALIGN (sizeof(struct link_free))
+#define ZS_HANDLE_SIZE (sizeof(unsigned long))
/*
* A single 'zspage' is composed of up to 2^N discontiguous 0-order (single)
@@ -138,11 +139,11 @@
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
/* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */
#define ZS_MIN_ALLOC_SIZE \
- MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
-#define ZS_MAX_ALLOC_SIZE PAGE_SIZE
+ MAX(ZS_ALIGN, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS))
+#define ZS_MAX_ALLOC_SIZE (PAGE_SIZE + ZS_HANDLE_SIZE)
/*
- * On systems with 4K page size, this gives 255 size classes! There is a
+ * On systems with 4K page size, this gives 257 size classes! There is a
* trader-off here:
* - Large number of size classes is potentially wasteful as free page are
* spread across these classes
--
2.0.0
next prev parent reply other threads:[~2014-12-02 2:50 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-02 2:49 [RFC 0/6] zsmalloc support compaction Minchan Kim
2014-12-02 2:49 ` Minchan Kim
2014-12-02 2:49 ` Minchan Kim [this message]
2014-12-02 2:49 ` [RFC 1/6] zsmalloc: expand size class to support sizeof(unsigned long) Minchan Kim
2014-12-02 2:49 ` [RFC 2/6] zsmalloc: add indrection layer to decouple handle from object Minchan Kim
2014-12-02 2:49 ` Minchan Kim
2014-12-02 2:49 ` [RFC 3/6] zsmalloc: implement reverse mapping Minchan Kim
2014-12-02 2:49 ` Minchan Kim
2014-12-02 2:49 ` [RFC 4/6] zsmalloc: encode alloced mark in handle object Minchan Kim
2014-12-02 2:49 ` Minchan Kim
2014-12-02 2:49 ` [RFC 5/6] zsmalloc: support compaction Minchan Kim
2014-12-02 2:49 ` Minchan Kim
2014-12-02 2:49 ` [RFC 6/6] zram: " Minchan Kim
2014-12-02 2:49 ` Minchan Kim
2014-12-04 6:49 ` [RFC 0/6] zsmalloc " "박승호/책임연구원/SW Platform(연)AOT팀(seungho1.park@lge.com)"
2014-12-04 6:49 ` "박승호/책임연구원/SW Platform(연)AOT팀(seungho1.park@lge.com)"
2014-12-04 7:20 ` Minchan Kim
2014-12-04 7:20 ` Minchan Kim
2014-12-04 7:29 ` "박승호/책임연구원/SW Platform(연)AOT팀(seungho1.park@lge.com)"
2014-12-04 7:29 ` "박승호/책임연구원/SW Platform(연)AOT팀(seungho1.park@lge.com)"
2014-12-04 7:21 ` "박승호/책임연구원/SW Platform(연)AOT팀(seungho1.park@lge.com)"
2014-12-04 7:21 ` "박승호/책임연구원/SW Platform(연)AOT팀(seungho1.park@lge.com)"
2014-12-17 23:19 ` Seth Jennings
2014-12-17 23:19 ` Seth Jennings
2014-12-18 1:50 ` Ganesh Mahendran
2014-12-18 1:50 ` Ganesh Mahendran
2014-12-19 0:46 ` Minchan Kim
2014-12-19 0:46 ` Minchan Kim
2014-12-23 2:50 ` Minchan Kim
2014-12-23 2:50 ` Minchan Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1417488587-28609-2-git-send-email-minchan@kernel.org \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ddstreet@ieee.org \
--cc=jmarchan@redhat.com \
--cc=juno.choi@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ngupta@vflare.org \
--cc=semenzato@google.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=seungho1.park@lge.com \
--cc=sjennings@variantweb.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.