From: Seth Jennings Date: Mon, 5 Mar 2012 17:33:22 +0000 (-0600) Subject: staging: zsmalloc: calculate MAX_PHYSMEM_BITS if not defined X-Git-Tag: MMI-PSA29.97-13-9~17268^2~70 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6e00ec00b1a76a199b8c0acae401757b795daf57;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git staging: zsmalloc: calculate MAX_PHYSMEM_BITS if not defined This patch provides a way to determine or "set a reasonable value for" MAX_PHYSMEM_BITS in the case that it is not defined (i.e. !SPARSEMEM) Signed-off-by: Seth Jennings Acked-by: Nitin Gupta Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/zsmalloc/zsmalloc_int.h b/drivers/staging/zsmalloc/zsmalloc_int.h index 4d66d2dd92f5..ffb272f89343 100644 --- a/drivers/staging/zsmalloc/zsmalloc_int.h +++ b/drivers/staging/zsmalloc/zsmalloc_int.h @@ -39,7 +39,21 @@ * Note that object index is relative to system * page it is stored in, so for each sub-page belonging * to a zspage, obj_idx starts with 0. + * + * This is made more complicated by various memory models and PAE. + */ + +#ifndef MAX_PHYSMEM_BITS +#ifdef CONFIG_HIGHMEM64G +#define MAX_PHYSMEM_BITS 36 +#else /* !CONFIG_HIGHMEM64G */ +/* + * If this definition of MAX_PHYSMEM_BITS is used, OBJ_INDEX_BITS will just + * be PAGE_SHIFT */ +#define MAX_PHYSMEM_BITS BITS_PER_LONG +#endif +#endif #define _PFN_BITS (MAX_PHYSMEM_BITS - PAGE_SHIFT) #define OBJ_INDEX_BITS (BITS_PER_LONG - _PFN_BITS) #define OBJ_INDEX_MASK ((_AC(1, UL) << OBJ_INDEX_BITS) - 1)