From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757293Ab2CEReu (ORCPT ); Mon, 5 Mar 2012 12:34:50 -0500 Received: from e39.co.us.ibm.com ([32.97.110.160]:49110 "EHLO e39.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756941Ab2CERes (ORCPT ); Mon, 5 Mar 2012 12:34:48 -0500 From: Seth Jennings To: Greg Kroah-Hartman Cc: Seth Jennings , Dan Magenheimer , Konrad Rzeszutek Wilk , Nitin Gupta , Robert Jennings , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 4/5] staging: zsmalloc: change ZS_MIN_ALLOC_SIZE Date: Mon, 5 Mar 2012 11:33:23 -0600 Message-Id: <1330968804-8098-5-git-send-email-sjenning@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1330968804-8098-1-git-send-email-sjenning@linux.vnet.ibm.com> References: <1330968804-8098-1-git-send-email-sjenning@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12030517-4242-0000-0000-000000F62C07 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch ensures that the value of ZS_MIN_ALLOC_SIZE, for the PAGE_SIZE and MAX_PHYSMEM_BITS on the system, allows for all possible object ids in the lowest storage class to be encoded in the object handle. Signed-off-by: Seth Jennings --- drivers/staging/zsmalloc/zsmalloc_int.h | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/staging/zsmalloc/zsmalloc_int.h b/drivers/staging/zsmalloc/zsmalloc_int.h index ffb272f..92eefc6 100644 --- a/drivers/staging/zsmalloc/zsmalloc_int.h +++ b/drivers/staging/zsmalloc/zsmalloc_int.h @@ -58,8 +58,10 @@ #define OBJ_INDEX_BITS (BITS_PER_LONG - _PFN_BITS) #define OBJ_INDEX_MASK ((_AC(1, UL) << OBJ_INDEX_BITS) - 1) +#define MAX(a, b) ((a) >= (b) ? (a) : (b)) /* ZS_MIN_ALLOC_SIZE must be multiple of ZS_ALIGN */ -#define ZS_MIN_ALLOC_SIZE 32 +#define ZS_MIN_ALLOC_SIZE \ + MAX(32, (ZS_MAX_PAGES_PER_ZSPAGE << PAGE_SHIFT >> OBJ_INDEX_BITS)) #define ZS_MAX_ALLOC_SIZE PAGE_SIZE /* -- 1.7.5.4