Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754867AbYCTDh1 (ORCPT ); Wed, 19 Mar 2008 23:37:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752596AbYCTDhE (ORCPT ); Wed, 19 Mar 2008 23:37:04 -0400 Received: from mga10.intel.com ([192.55.52.92]:35872 "EHLO fmsmga102.fm.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750698AbYCTDhC (ORCPT ); Wed, 19 Mar 2008 23:37:02 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.25,528,1199692800"; d="scan'208";a="536780486" Subject: Re: [patch 2/9] Store max number of objects in the page struct. From: "Zhang, Yanmin" To: Christoph Lameter , LKML Cc: Pekka Enberg , Mel Gorman , Matt Mackall , linux-mm@kvack.org In-Reply-To: References: <20080317230516.078358225@sgi.com> <20080317230528.279983034@sgi.com> <1205917757.10318.1.camel@ymzhang> Content-Type: text/plain; charset=utf-8 Date: Thu, 20 Mar 2008 11:32:17 +0800 Message-Id: <1205983937.14496.24.camel@ymzhang> Mime-Version: 1.0 X-Mailer: Evolution 2.9.2 (2.9.2-2.fc7) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1894 Lines: 68 On Wed, 2008-03-19 at 10:49 -0700, Christoph Lameter wrote: > On Wed, 19 Mar 2008, Zhang, Yanmin wrote: > > > > + if ((PAGE_SIZE << min_order) / size > 65535) > > > + return get_order(size * 65535) - 1; > > Is it better to define something like USHORT_MAX to replace 65535? > > Yes. Do we have something like that? I couldn't find such definition in include/linux/kernel.h. But glibc defines USHRT_MAX file include/limits.h: /* Minimum and maximum values a `signed short int' can hold. */ # define SHRT_MIN (-32768) # define SHRT_MAX 32767 /* Maximum value an `unsigned short int' can hold. (Minimum is 0.) */ # define USHRT_MAX 65535 How about below patch against 2.6.25-rc6? --- Add definitions of USHRT_MAX and others into kernel. ipc uses it and slub implementation might also use it. The patch is against 2.6.25-rc6. Signed-off-by: Zhang Yanmin --- --- linux-2.6.25-rc6/include/linux/kernel.h 2008-03-20 04:25:46.000000000 +0800 +++ linux-2.6.25-rc6_work/include/linux/kernel.h 2008-03-20 04:17:45.000000000 +0800 @@ -20,6 +20,9 @@ extern const char linux_banner[]; extern const char linux_proc_banner[]; +#define USHRT_MAX ((u16)(~0U)) +#define SHRT_MAX ((s16)(USHRT_MAX>>1)) +#define SHRT_MIN (-SHRT_MAX - 1) #define INT_MAX ((int)(~0U>>1)) #define INT_MIN (-INT_MAX - 1) #define UINT_MAX (~0U) --- linux-2.6.25-rc6/ipc/util.h 2008-03-20 04:25:46.000000000 +0800 +++ linux-2.6.25-rc6_work/ipc/util.h 2008-03-20 04:22:07.000000000 +0800 @@ -12,7 +12,6 @@ #include -#define USHRT_MAX 0xffff #define SEQ_MULTIPLIER (IPCMNI) void sem_init (void); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/