diff options
author | Seth Jennings <sjenning@linux.vnet.ibm.com> | 2012-03-05 12:33:20 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-03-07 16:31:28 -0500 |
commit | aafefe932a46f7d0a85b6c48e71befd1003d1e6b (patch) | |
tree | ff438d9ab6f79961967cb777141bdb22acf4e78f /drivers/staging/zsmalloc | |
parent | bec25dfd850cf92cba894c94d6660fc18d3a7447 (diff) |
staging: zsmalloc: move object/handle masking defines
This patch moves the definitions of _PFN_BITS, OBJ_INDEX_BITS
and OBJ_INDEX_MASK from zsmalloc-main.c to zsmalloc_int.h
They will be needed to determine ZS_MIN_ALLOC_SIZE in the next
patch
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/zsmalloc')
-rw-r--r-- | drivers/staging/zsmalloc/zsmalloc-main.c | 12 | ||||
-rw-r--r-- | drivers/staging/zsmalloc/zsmalloc_int.h | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index 455fc2f9724..240bcbff263 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c | |||
@@ -40,18 +40,6 @@ | |||
40 | #define CLASS_IDX_MASK ((1 << CLASS_IDX_BITS) - 1) | 40 | #define CLASS_IDX_MASK ((1 << CLASS_IDX_BITS) - 1) |
41 | #define FULLNESS_MASK ((1 << FULLNESS_BITS) - 1) | 41 | #define FULLNESS_MASK ((1 << FULLNESS_BITS) - 1) |
42 | 42 | ||
43 | /* | ||
44 | * Object location (<PFN>, <obj_idx>) is encoded as | ||
45 | * as single (void *) handle value. | ||
46 | * | ||
47 | * Note that object index <obj_idx> is relative to system | ||
48 | * page <PFN> it is stored in, so for each sub-page belonging | ||
49 | * to a zspage, obj_idx starts with 0. | ||
50 | */ | ||
51 | #define _PFN_BITS (MAX_PHYSMEM_BITS - PAGE_SHIFT) | ||
52 | #define OBJ_INDEX_BITS (BITS_PER_LONG - _PFN_BITS) | ||
53 | #define OBJ_INDEX_MASK ((_AC(1, UL) << OBJ_INDEX_BITS) - 1) | ||
54 | |||
55 | /* per-cpu VM mapping areas for zspage accesses that cross page boundaries */ | 43 | /* per-cpu VM mapping areas for zspage accesses that cross page boundaries */ |
56 | static DEFINE_PER_CPU(struct mapping_area, zs_map_area); | 44 | static DEFINE_PER_CPU(struct mapping_area, zs_map_area); |
57 | 45 | ||
diff --git a/drivers/staging/zsmalloc/zsmalloc_int.h b/drivers/staging/zsmalloc/zsmalloc_int.h index 354a0200143..e06e142e3ac 100644 --- a/drivers/staging/zsmalloc/zsmalloc_int.h +++ b/drivers/staging/zsmalloc/zsmalloc_int.h | |||
@@ -25,6 +25,18 @@ | |||
25 | */ | 25 | */ |
26 | #define ZS_ALIGN 8 | 26 | #define ZS_ALIGN 8 |
27 | 27 | ||
28 | /* | ||
29 | * Object location (<PFN>, <obj_idx>) is encoded as | ||
30 | * as single (void *) handle value. | ||
31 | * | ||
32 | * Note that object index <obj_idx> is relative to system | ||
33 | * page <PFN> it is stored in, so for each sub-page belonging | ||
34 | * to a zspage, obj_idx starts with 0. | ||
35 | */ | ||
36 | #define _PFN_BITS (MAX_PHYSMEM_BITS - PAGE_SHIFT) | ||
37 | #define OBJ_INDEX_BITS (BITS_PER_LONG - _PFN_BITS) | ||
38 | #define OBJ_INDEX_MASK ((_AC(1, UL) << OBJ_INDEX_BITS) - 1) | ||
39 | |||
28 | /* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */ | 40 | /* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */ |
29 | #define ZS_MIN_ALLOC_SIZE 32 | 41 | #define ZS_MIN_ALLOC_SIZE 32 |
30 | #define ZS_MAX_ALLOC_SIZE PAGE_SIZE | 42 | #define ZS_MAX_ALLOC_SIZE PAGE_SIZE |