aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorSeth Jennings <sjenning@linux.vnet.ibm.com>2012-03-05 12:33:21 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-03-07 16:31:28 -0500
commit84d4faaba27991bde9fa5ec0716d14ad279ba8ab (patch)
tree37204c7ced4ed402ec8afda0bb3eb4c5c2c082a0 /drivers/staging
parentaafefe932a46f7d0a85b6c48e71befd1003d1e6b (diff)
staging: zsmalloc: add ZS_MAX_PAGES_PER_ZSPAGE
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> Acked-by: Nitin Gupta <ngupta@vflare.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/zsmalloc/zsmalloc-main.c2
-rw-r--r--drivers/staging/zsmalloc/zsmalloc_int.h13
2 files changed, 8 insertions, 7 deletions
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c
index 240bcbff263..09caa4f2687 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)
186 /* zspage order which gives maximum used size per KB */ 186 /* zspage order which gives maximum used size per KB */
187 int max_usedpc_order = 1; 187 int max_usedpc_order = 1;
188 188
189 for (i = 1; i <= max_zspage_order; i++) { 189 for (i = 1; i <= ZS_MAX_PAGES_PER_ZSPAGE; i++) {
190 int zspage_size; 190 int zspage_size;
191 int waste, usedpc; 191 int waste, usedpc;
192 192
diff --git a/drivers/staging/zsmalloc/zsmalloc_int.h b/drivers/staging/zsmalloc/zsmalloc_int.h
index e06e142e3ac..4d66d2dd92f 100644
--- a/drivers/staging/zsmalloc/zsmalloc_int.h
+++ b/drivers/staging/zsmalloc/zsmalloc_int.h
@@ -26,6 +26,13 @@
26#define ZS_ALIGN 8 26#define ZS_ALIGN 8
27 27
28/* 28/*
29 * A single 'zspage' is composed of up to 2^N discontiguous 0-order (single)
30 * pages. ZS_MAX_ZSPAGE_ORDER defines upper limit on N.
31 */
32#define ZS_MAX_ZSPAGE_ORDER 2
33#define ZS_MAX_PAGES_PER_ZSPAGE (_AC(1, UL) << ZS_MAX_ZSPAGE_ORDER)
34
35/*
29 * Object location (<PFN>, <obj_idx>) is encoded as 36 * Object location (<PFN>, <obj_idx>) is encoded as
30 * as single (void *) handle value. 37 * as single (void *) handle value.
31 * 38 *
@@ -59,12 +66,6 @@
59 ZS_SIZE_CLASS_DELTA + 1) 66 ZS_SIZE_CLASS_DELTA + 1)
60 67
61/* 68/*
62 * A single 'zspage' is composed of N discontiguous 0-order (single) pages.
63 * This defines upper limit on N.
64 */
65static const int max_zspage_order = 4;
66
67/*
68 * We do not maintain any list for completely empty or full pages 69 * We do not maintain any list for completely empty or full pages
69 */ 70 */
70enum fullness_group { 71enum fullness_group {