From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764761AbdEWQ4O (ORCPT ); Tue, 23 May 2017 12:56:14 -0400 Received: from mail-pf0-f179.google.com ([209.85.192.179]:36348 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1764745AbdEWQ4L (ORCPT ); Tue, 23 May 2017 12:56:11 -0400 Date: Tue, 23 May 2017 09:56:08 -0700 From: Matthias Kaehlcke To: David Rientjes Cc: Andrew Morton , Christoph Lameter , Pekka Enberg , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Douglas Anderson Subject: Re: [PATCH 1/3] mm/slub: Only define kmalloc_large_node_hook() for NUMA systems Message-ID: <20170523165608.GN141096@google.com> References: <20170519210036.146880-1-mka@chromium.org> <20170519210036.146880-2-mka@chromium.org> <20170522205621.GL141096@google.com> <20170522144501.2d02b5799e07167dc5aecf3e@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi David, El Mon, May 22, 2017 at 06:35:23PM -0700 David Rientjes ha dit: > On Mon, 22 May 2017, Andrew Morton wrote: > > > > > Is clang not inlining kmalloc_large_node_hook() for some reason? I don't > > > > think this should ever warn on gcc. > > > > > > clang warns about unused static inline functions outside of header > > > files, in difference to gcc. > > > > I wish it wouldn't. These patches just add clutter. > > > > Matthias, what breaks if you do this? > > diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h > index de179993e039..e1895ce6fa1b 100644 > --- a/include/linux/compiler-clang.h > +++ b/include/linux/compiler-clang.h > @@ -15,3 +15,8 @@ > * with any version that can compile the kernel > */ > #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) > + > +#ifdef inline > +#undef inline > +#define inline __attribute__((unused)) > +#endif Thanks for the suggestion! Nothing breaks and the warnings are silenced. It seems we could use this if there is a stong opposition against having warnings on unused static inline functions in .c files. Still I am not convinced that gcc's behavior is preferable in this case. True, it saves us from adding a bunch of __maybe_unused or #ifdefs, on the other hand the warning is a useful tool to spot truly unused code. So far about 50% of the warnings I looked into fall into this category.