Messages in this thread |  | | Subject | Re: [PATCH] netns: deinline net_generic() | From | Eric Dumazet <> | Date | Tue, 14 Apr 2015 06:19:32 -0700 |
| |
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]; }
|  |