linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Seth Jennings <sjenning@linux.vnet.ibm.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Seth Jennings <sjenning@linux.vnet.ibm.com>,
	Dan Magenheimer <dan.magenheimer@oracle.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Nitin Gupta <ngupta@vflare.org>,
	Robert Jennings <rcj@linux.vnet.ibm.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: [PATCH 2/5] staging: zsmalloc: add ZS_MAX_PAGES_PER_ZSPAGE
Date: Mon,  5 Mar 2012 11:33:21 -0600	[thread overview]
Message-ID: <1330968804-8098-3-git-send-email-sjenning@linux.vnet.ibm.com> (raw)
In-Reply-To: <1330968804-8098-1-git-send-email-sjenning@linux.vnet.ibm.com>

This patch moves where max_zspage_order is declared and
changes its meaning.  "Order" typically implies 2^order
of something; however, it is currently being used as the
"maximum number of single pages in a zspage".  To add clarity,
ZS_MAX_ZSPAGE_ORDER is now used to calculate ZS_MAX_PAGES_PER_ZSPAGE,
which is 2^ZS_MAX_ZSPAGE_ORDER and is the upper bound on the number
of pages in a zspage.

Signed-off-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
---
 drivers/staging/zsmalloc/zsmalloc-main.c |    2 +-
 drivers/staging/zsmalloc/zsmalloc_int.h  |   13 +++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index 240bcbf..09caa4f 100644
--- a/drivers/staging/zsmalloc/zsmalloc-main.c
+++ b/drivers/staging/zsmalloc/zsmalloc-main.c
@@ -186,7 +186,7 @@ static int get_zspage_order(int class_size)
 	/* zspage order which gives maximum used size per KB */
 	int max_usedpc_order = 1;
 
-	for (i = 1; i <= max_zspage_order; i++) {
+	for (i = 1; i <= ZS_MAX_PAGES_PER_ZSPAGE; i++) {
 		int zspage_size;
 		int waste, usedpc;
 
diff --git a/drivers/staging/zsmalloc/zsmalloc_int.h b/drivers/staging/zsmalloc/zsmalloc_int.h
index e06e142..4d66d2d 100644
--- a/drivers/staging/zsmalloc/zsmalloc_int.h
+++ b/drivers/staging/zsmalloc/zsmalloc_int.h
@@ -26,6 +26,13 @@
 #define ZS_ALIGN		8
 
 /*
+ * A single 'zspage' is composed of up to 2^N discontiguous 0-order (single)
+ * pages. ZS_MAX_ZSPAGE_ORDER defines upper limit on N.
+ */
+#define ZS_MAX_ZSPAGE_ORDER 2
+#define ZS_MAX_PAGES_PER_ZSPAGE (_AC(1, UL) << ZS_MAX_ZSPAGE_ORDER)
+
+/*
  * Object location (<PFN>, <obj_idx>) is encoded as
  * as single (void *) handle value.
  *
@@ -59,12 +66,6 @@
 					ZS_SIZE_CLASS_DELTA + 1)
 
 /*
- * A single 'zspage' is composed of N discontiguous 0-order (single) pages.
- * This defines upper limit on N.
- */
-static const int max_zspage_order = 4;
-
-/*
  * We do not maintain any list for completely empty or full pages
  */
 enum fullness_group {
-- 
1.7.5.4

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2012-03-05 17:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-05 17:33 [PATCH 0/5] staging: zsmalloc: remove SPARSEMEM dependency Seth Jennings
2012-03-05 17:33 ` [PATCH 1/5] staging: zsmalloc: move object/handle masking defines Seth Jennings
2012-03-05 17:33 ` Seth Jennings [this message]
2012-03-05 17:33 ` [PATCH 3/5] staging: zsmalloc: calculate MAX_PHYSMEM_BITS if not defined Seth Jennings
2012-03-05 17:33 ` [PATCH 4/5] staging: zsmalloc: change ZS_MIN_ALLOC_SIZE Seth Jennings
2012-03-05 17:33 ` [PATCH 5/5] staging: zsmalloc: remove SPARSEMEM dep from Kconfig Seth Jennings
2012-03-05 18:07 ` [PATCH 0/5] staging: zsmalloc: remove SPARSEMEM dependency Nitin Gupta

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=1330968804-8098-3-git-send-email-sjenning@linux.vnet.ibm.com \
    --to=sjenning@linux.vnet.ibm.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ngupta@vflare.org \
    --cc=rcj@linux.vnet.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox