Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966431Ab3DQTKg (ORCPT ); Wed, 17 Apr 2013 15:10:36 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:28717 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965295Ab3DQTKe (ORCPT ); Wed, 17 Apr 2013 15:10:34 -0400 X-Authority-Analysis: v=2.0 cv=aOZyWMBm c=1 sm=0 a=rXTBtCOcEpjy1lPqhTCpEQ==:17 a=mNMOxpOpBa8A:10 a=P9tYZ7KxwnoA:10 a=5SG0PmZfjMsA:10 a=IkcTkHD0fZMA:10 a=meVymXHHAAAA:8 a=d4Hf9CRHXzMA:10 a=CVF7XyKItEI0EC762UMA:9 a=QEXdDO2ut3YA:10 a=jeBq3FmKZ4MA:10 a=rXTBtCOcEpjy1lPqhTCpEQ==:117 X-Cloudmark-Score: 0 X-Authenticated-User: X-Originating-IP: 74.67.115.198 Subject: [PATCH] slab: Remove unnecessary __builtin_constant_p() From: Steven Rostedt To: LKML , linux-mm@kvack.org Cc: Christoph Lameter , Behan Webster , Andrew Morton Content-Type: text/plain; charset="UTF-8" Date: Wed, 17 Apr 2013 15:09:36 -0400 Message-ID: <1366225776.8817.28.camel@pippen.local.home> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1499 Lines: 51 The slab.c code has a size check macro that checks the size of the following structs: struct arraycache_init struct kmem_list3 The index_of() function that takes the sizeof() of the above two structs and does an unnecessary __builtin_constant_p() on that. As sizeof() will always end up being a constant making this always be true. The code is not incorrect, but it just adds added complexity, and confuses users and wastes the time of reviewers of the code, who spends time trying to figure out why the builtin_constant_p() was used. This patch is just a clean up that makes the index_of() code a little bit less complex. Signed-off-by: Steven Rostedt diff --git a/mm/slab.c b/mm/slab.c index 856e4a1..6047900 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -325,9 +325,7 @@ static void cache_reap(struct work_struct *unused); static __always_inline int index_of(const size_t size) { extern void __bad_size(void); - - if (__builtin_constant_p(size)) { - int i = 0; + int i = 0; #define CACHE(x) \ if (size <=x) \ @@ -336,9 +334,7 @@ static __always_inline int index_of(const size_t size) i++; #include #undef CACHE - __bad_size(); - } else - __bad_size(); + __bad_size(); return 0; } -- 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/