Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757709Ab3DXHbn (ORCPT ); Wed, 24 Apr 2013 03:31:43 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:59165 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757689Ab3DXHbl (ORCPT ); Wed, 24 Apr 2013 03:31:41 -0400 MIME-Version: 1.0 In-Reply-To: <20130422141621.384eb93a6a8f3d441cd1a991@linux-foundation.org> References: <1366225776.8817.28.camel@pippen.local.home> <20130422134415.32c7f2cac07c924bff3017a4@linux-foundation.org> <1366664301.9609.140.camel@gandalf.local.home> <20130422141621.384eb93a6a8f3d441cd1a991@linux-foundation.org> Date: Wed, 24 Apr 2013 10:31:40 +0300 X-Google-Sender-Auth: ZI99XzuVRT4haF9bkgllrsYB6vE Message-ID: Subject: Re: [PATCH] slab: Remove unnecessary __builtin_constant_p() From: Pekka Enberg To: Andrew Morton Cc: Steven Rostedt , David Rientjes , LKML , "linux-mm@kvack.org" , Christoph Lameter , Behan Webster Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1288 Lines: 43 Hello, On Tue, Apr 23, 2013 at 12:16 AM, Andrew Morton wrote: > The patch made index_of() weaker! > > It's probably all a bit academic, given that linux-next does > > -/* > - * This function must be completely optimized away if a constant is passed to > - * it. Mostly the same as what is in linux/slab.h except it returns an index. > - */ > -static __always_inline int index_of(const size_t size) > -{ > - extern void __bad_size(void); > - > - if (__builtin_constant_p(size)) { > - int i = 0; > - > -#define CACHE(x) \ > - if (size <=x) \ > - return i; \ > - else \ > - i++; > -#include > -#undef CACHE > - __bad_size(); > - } else > - __bad_size(); > - return 0; > -} > - Yup, Christoph nuked it in the following commit: https://git.kernel.org/cgit/linux/kernel/git/penberg/linux.git/commit/?h=slab/next&id=2c59dd6544212faa5ce761920d2251f4152f408d Pekka -- 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/