From: Jiri Pirko <jpirko@redhat.com>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Jan Engelhardt <jengelh@medozas.de>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] netns: deinline net_generic()
Date: Tue, 14 Apr 2015 14:36:03 +0200 [thread overview]
Message-ID: <20150414123603.GD2022@nanopsycho.lan> (raw)
In-Reply-To: <1429014311-19868-1-git-send-email-dvlasenk@redhat.com>
Tue, Apr 14, 2015 at 02:25:11PM CEST, dvlasenk@redhat.com 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.
Hmm. That is not much. How about performance impacts?
>
> text data bss dec hex filename
>82447071 22255384 20627456 125329911 77861f7 vmlinux4
>82419165 22255384 20627456 125302005 777f4f5 vmlinux5
>
>Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
>CC: Eric W. Biederman <ebiederm@xmission.com>
>CC: David S. Miller <davem@davemloft.net>
>CC: Jan Engelhardt <jengelh@medozas.de>
>CC: Jiri Pirko <jpirko@redhat.com>
>CC: linux-kernel@vger.kernel.org
>CC: netdev@vger.kernel.org
>---
> include/net/netns/generic.h | 15 +--------------
> net/core/net_namespace.c | 16 ++++++++++++++++
> 2 files changed, 17 insertions(+), 14 deletions(-)
>
>diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
>index 0931618..61a33bf 100644
>--- a/include/net/netns/generic.h
>+++ b/include/net/netns/generic.h
>@@ -31,18 +31,5 @@ struct net_generic {
> void *ptr[0];
> };
>
>-static inline void *net_generic(const struct net *net, int id)
>-{
>- struct net_generic *ng;
>- void *ptr;
>-
>- rcu_read_lock();
>- ng = rcu_dereference(net->gen);
>- BUG_ON(id == 0 || id > ng->len);
>- ptr = ng->ptr[id - 1];
>- rcu_read_unlock();
>-
>- BUG_ON(!ptr);
>- return ptr;
>-}
>+void *net_generic(const struct net *net, int id);
> #endif
>diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
>index cb5290b..66c9ba1 100644
>--- a/net/core/net_namespace.c
>+++ b/net/core/net_namespace.c
>@@ -42,6 +42,22 @@ EXPORT_SYMBOL(init_net);
>
> static unsigned int max_gen_ptrs = INITIAL_NET_GEN_PTRS;
>
>+void *net_generic(const struct net *net, int id)
>+{
>+ struct net_generic *ng;
>+ void *ptr;
>+
>+ rcu_read_lock();
>+ ng = rcu_dereference(net->gen);
>+ BUG_ON(id == 0 || id > ng->len);
>+ ptr = ng->ptr[id - 1];
>+ rcu_read_unlock();
>+
>+ BUG_ON(!ptr);
>+ return ptr;
>+}
>+EXPORT_SYMBOL(net_generic);
>+
> static struct net_generic *net_alloc_generic(void)
> {
> struct net_generic *ng;
>--
>1.8.1.4
>
next prev parent reply other threads:[~2015-04-14 12:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 12:25 [PATCH] netns: deinline net_generic() Denys Vlasenko
2015-04-14 12:36 ` Jiri Pirko [this message]
2015-04-14 13:19 ` Eric Dumazet
2015-04-14 13:57 ` Denys Vlasenko
2015-04-14 14:21 ` Eric Dumazet
2015-04-14 15:04 ` Denys Vlasenko
2015-04-14 15:25 ` Eric Dumazet
2015-04-14 18:37 ` David Miller
2015-04-16 11:14 ` Denys Vlasenko
2015-04-16 12:38 ` Eric Dumazet
2015-04-17 17:05 ` Denys Vlasenko
2015-04-17 17:42 ` Eric Dumazet
2015-04-17 18:05 ` Denys Vlasenko
2015-04-17 18:55 ` David Miller
2015-04-17 19:55 ` David Miller
2015-04-16 15:41 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150414123603.GD2022@nanopsycho.lan \
--to=jpirko@redhat.com \
--cc=davem@davemloft.net \
--cc=dvlasenk@redhat.com \
--cc=ebiederm@xmission.com \
--cc=jengelh@medozas.de \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox