diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index 240bcbff263a..09caa4f2687e 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 e06e142e3acc..4d66d2dd92f5 100644 --- a/drivers/staging/zsmalloc/zsmalloc_int.h +++ b/drivers/staging/zsmalloc/zsmalloc_int.h @@ -25,6 +25,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 (, ) is encoded as * as single (void *) handle value. @@ -58,12 +65,6 @@ #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 */