1. 10 3月, 2018 1 次提交
    • E
      net: do not create fallback tunnels for non-default namespaces · 79134e6c
      Eric Dumazet 提交于
      fallback tunnels (like tunl0, gre0, gretap0, erspan0, sit0,
      ip6tnl0, ip6gre0) are automatically created when the corresponding
      module is loaded.
      
      These tunnels are also automatically created when a new network
      namespace is created, at a great cost.
      
      In many cases, netns are used for isolation purposes, and these
      extra network devices are a waste of resources. We are using
      thousands of netns per host, and hit the netns creation/delete
      bottleneck a lot. (Many thanks to Kirill for recent work on this)
      
      Add a new sysctl so that we can opt-out from this automatic creation.
      
      Note that these tunnels are still created for the initial namespace,
      to be the least intrusive for typical setups.
      
      Tested:
      lpk43:~# cat add_del_unshare.sh
      for i in `seq 1 40`
      do
       (for j in `seq 1 100` ; do  unshare -n /bin/true >/dev/null ; done) &
      done
      wait
      
      lpk43:~# echo 0 >/proc/sys/net/core/fb_tunnels_only_for_init_net
      lpk43:~# time ./add_del_unshare.sh
      
      real	0m37.521s
      user	0m0.886s
      sys	7m7.084s
      lpk43:~# echo 1 >/proc/sys/net/core/fb_tunnels_only_for_init_net
      lpk43:~# time ./add_del_unshare.sh
      
      real	0m4.761s
      user	0m0.851s
      sys	1m8.343s
      lpk43:~#
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      79134e6c
  2. 09 3月, 2018 24 次提交
  3. 08 3月, 2018 6 次提交
  4. 07 3月, 2018 4 次提交
  5. 06 3月, 2018 1 次提交
  6. 05 3月, 2018 4 次提交
    • K
      net: Convert proto_gre_net_ops · c29babb7
      Kirill Tkhai 提交于
      These pernet_operations register and unregister sysctl.
      nf_conntrack_l4proto_gre4->init_net is simple memory
      initializer. Also, exit method removes gre keymap_list,
      which is per-net. This looks safe to be executed
      in parallel with other pernet_operations.
      Signed-off-by: NKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c29babb7
    • K
      net: Convert ctnetlink_net_ops · b04a3d09
      Kirill Tkhai 提交于
      These pernet_operations register and unregister
      two conntrack notifiers, and they seem to be safe
      to be executed in parallel.
      
      General/not related to async pernet_operations JFI:
      ctnetlink_net_exit_batch() actions are grouped in batch,
      and this could look like there is synchronize_rcu()
      is forgotten. But there is synchronize_rcu() on module
      exit patch (in ctnetlink_exit()), so this batch may
      be reworked as simple .exit method.
      Signed-off-by: NKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b04a3d09
    • K
      net: Convert nf_conntrack_net_ops · 467d14b3
      Kirill Tkhai 提交于
      These pernet_operations register and unregister sysctl and /proc
      entries. Exit batch method also waits till all per-net conntracks
      are dead. Thus, they are safe to be marked as async.
      Signed-off-by: NKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      467d14b3
    • K
      net: Convert ip_set_net_ops · a5a179b6
      Kirill Tkhai 提交于
      These pernet_operations initialize and destroy
      net_generic(net, ip_set_net_id)-related data.
      Since ip_set is under CONFIG_IP_SET, it's easy
      to watch drivers, which depend on this config.
      All of them are in net/netfilter/ipset directory,
      except of net/netfilter/xt_set.c. There are no
      more drivers, which use ip_set, and all of
      the above don't register another pernet_operations.
      Also, there are is no indirect users, as header
      file include/linux/netfilter/ipset/ip_set.h does
      not define indirect users by something like this:
      
      	#ifdef CONFIG_IP_SET
      	extern func(void);
      	#else
      	static inline func(void);
      	#endif
      
      So, there are no more pernet operations, dereferencing
      net_generic(net, ip_set_net_id).
      
      ip_set_net_ops are OK to be executed in parallel
      for several net, so we mark them as async.
      Signed-off-by: NKirill Tkhai <ktkhai@virtuozzo.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a5a179b6