Commit 84d4faaba27991bde9fa5ec0716d14ad279ba8ab
Committed by
Greg Kroah-Hartman
1 parent
aafefe932a
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 2 changed files with 8 additions and 7 deletions Side-by-side Diff
drivers/staging/zsmalloc/zsmalloc-main.c
drivers/staging/zsmalloc/zsmalloc_int.h
... | ... | @@ -26,6 +26,13 @@ |
26 | 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 | 36 | * Object location (<PFN>, <obj_idx>) is encoded as |
30 | 37 | * as single (void *) handle value. |
31 | 38 | * |
... | ... | @@ -57,12 +64,6 @@ |
57 | 64 | #define ZS_SIZE_CLASS_DELTA 16 |
58 | 65 | #define ZS_SIZE_CLASSES ((ZS_MAX_ALLOC_SIZE - ZS_MIN_ALLOC_SIZE) / \ |
59 | 66 | ZS_SIZE_CLASS_DELTA + 1) |
60 | - | |
61 | -/* | |
62 | - * A single 'zspage' is composed of N discontiguous 0-order (single) pages. | |
63 | - * This defines upper limit on N. | |
64 | - */ | |
65 | -static const int max_zspage_order = 4; | |
66 | 67 | |
67 | 68 | /* |
68 | 69 | * We do not maintain any list for completely empty or full pages |