Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759766AbZCSSSh (ORCPT ); Thu, 19 Mar 2009 14:18:37 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754760AbZCSSS2 (ORCPT ); Thu, 19 Mar 2009 14:18:28 -0400 Received: from smtp.ultrahosting.com ([74.213.174.254]:55473 "EHLO smtp.ultrahosting.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066AbZCSSS1 (ORCPT ); Thu, 19 Mar 2009 14:18:27 -0400 Date: Thu, 19 Mar 2009 14:15:32 -0400 (EDT) From: Christoph Lameter X-X-Sender: cl@qirst.com To: Mel Gorman cc: KAMEZAWA Hiroyuki , Linux Memory Management List , Pekka Enberg , Rik van Riel , KOSAKI Motohiro , Johannes Weiner , Nick Piggin , Linux Kernel Mailing List , Lin Ming , Zhang Yanmin , Peter Zijlstra Subject: Re: [PATCH 24/27] Convert gfp_zone() to use a table of precalculated values In-Reply-To: <20090319181116.GA24586@csn.ul.ie> Message-ID: References: <20090318135222.GA4629@csn.ul.ie> <20090318153508.GA24462@csn.ul.ie> <20090318181717.GC24462@csn.ul.ie> <20090318194604.GD24462@csn.ul.ie> <20090319090456.fb11e23c.kamezawa.hiroyu@jp.fujitsu.com> <20090319181116.GA24586@csn.ul.ie> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 989 Lines: 28 On Thu, 19 Mar 2009, Mel Gorman wrote: > I ran into exactly that problem and ended up shoving the table into > page_alloc.c but then there is no benefits from having the table statically > declared because there is no constant folding. Right. The table must be defined in the .h file. Just a matter of figuring out how to convince the compiler/linker to do the right thing. > > + if (__builtin_constant_p(zone)) > > + BUILD_BUG_ON(zone == BAD_ZONE); > > +#ifdef CONFIG_DEBUG_VM > > + else > > + BUG_ON(zone == BAD_ZONE); > > #endif > > That could be made a bit prettier with > > if (__builtin_constant_p(zone)) > BUILD_BUG_ON(zone == BAD_ZONE); > VM_BUG_ON(zone == BAD_ZONE); VM_BUG_ON is not available here. It has to be that ugly. -- 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/