lkml.org 
[lkml]   [2015]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] netns: deinline net_generic()
From
Date
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];
}





\
 
 \ /
  Last update: 2015-04-14 15:41    [W:0.108 / U:6.756 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site