]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
staging: zsmalloc: add ZS_MAX_PAGES_PER_ZSPAGE
authorSeth Jennings <sjenning@linux.vnet.ibm.com>
Mon, 5 Mar 2012 17:33:21 +0000 (11:33 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Mar 2012 21:31:28 +0000 (13:31 -0800)
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>
drivers/staging/zsmalloc/zsmalloc-main.c
drivers/staging/zsmalloc/zsmalloc_int.h

index 240bcbff263ad33a6f15b7a07ee7301cda7ea4e3..09caa4f2687e04f9a3ce353dbe96838a8b8f1928 100644 (file)
@@ -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;
 
index e06e142e3acc98d1716911a9523ef67bb4892f37..4d66d2dd92f5da65a1e6ebea4cfc33c5fa8556cd 100644 (file)
  */
 #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.
 #define ZS_SIZE_CLASSES                ((ZS_MAX_ALLOC_SIZE - ZS_MIN_ALLOC_SIZE) / \
                                        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
  */