Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755431AbbDNNTp (ORCPT ); Tue, 14 Apr 2015 09:19:45 -0400 Received: from mail-ie0-f169.google.com ([209.85.223.169]:33999 "EHLO mail-ie0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753471AbbDNNTf (ORCPT ); Tue, 14 Apr 2015 09:19:35 -0400 Message-ID: <1429017572.7346.20.camel@edumazet-glaptop2.roam.corp.google.com> Subject: Re: [PATCH] netns: deinline net_generic() From: Eric Dumazet To: Denys Vlasenko Cc: "David S. Miller" , "Eric W. Biederman" , Jan Engelhardt , Jiri Pirko , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Date: Tue, 14 Apr 2015 06:19:32 -0700 In-Reply-To: <1429014311-19868-1-git-send-email-dvlasenk@redhat.com> References: <1429014311-19868-1-git-send-email-dvlasenk@redhat.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1191 Lines: 39 On Tue, 2015-04-14 at 14:25 +0200, Denys Vlasenko wrote: > On x86 allyesconfig build: > The function compiles to 130 bytes of machine code. > It has 493 callsites. > Total reduction of vmlinux size: 27906 bytes. > > text data bss dec hex filename > 82447071 22255384 20627456 125329911 77861f7 vmlinux4 > 82419165 22255384 20627456 125302005 777f4f5 vmlinux5 This sounds a big hammer to me. These savings probably comes from the BUG_ON() that could simply be removed. The second one for sure has no purpose. First one looks defensive. For a typical (non allyesconfig) kernel, net_generic() would translate to : return net->gen[id - 1] Tunnels need this in fast path, so I presume we could introduce net_generic_rcu() to keep this stuff inlined where it matters. static inline void *net_generic_rcu(const struct net *net, int id) { struct net_generic *ng = rcu_dereference(net->gen); return ng->ptr[id - 1]; } -- 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/