public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: davem@davemloft.net, vyasevic@redhat.com,
	kstewart@linuxfoundation.org, pombredanne@nexb.com,
	vyasevich@gmail.com, mark.rutland@arm.com,
	gregkh@linuxfoundation.org, adobriyan@gmail.com, fw@strlen.de,
	nicolas.dichtel@6wind.com, xiyou.wangcong@gmail.com,
	roman.kapl@sysgo.com, paul@paul-moore.com, dsahern@gmail.com,
	daniel@iogearbox.net, lucien.xin@gmail.com,
	mschiffer@universe-factory.net, rshearma@brocade.com,
	netdev@vger.kernel.org, ktkhai@virtuozzo.com,
	ebiederm@xmission.com, avagin@virtuozzo.com,
	gorcunov@virtuozzo.com, eric.dumazet@gmail.com,
	stephen@networkplumber.org, ktkhai@virtuozzo.com
Subject: [PATCH net-next v3 00/32] Replacing net_mutex with rw_semaphore
Date: Tue, 13 Feb 2018 12:25:51 +0300	[thread overview]
Message-ID: <151851357738.5034.10272265431844825686.stgit@localhost.localdomain> (raw)

Hi,

this is the third version of the patchset introducing net_sem
instead of net_mutex. The patchset adds net_sem in addition
to net_mutex and allows pernet_operations to be "async". This
flag means, the pernet_operations methods are safe to be
executed with any other pernet_operations (un)initializing
another net.

If there are only async pernet_operations in the system,
net_mutex is not used either for setup_net() or for cleanup_net().

The pernet_operations converted in this patchset allow
to create minimal .config to have network working, and
the changes improve the performance like you may see
below:

    %for i in {1..10000}; do unshare -n bash -c exit; done
    
    *before*
    real 1m40,377s
    user 0m9,672s
    sys 0m19,928s
    
    *after*
    real 0m17,007s
    user 0m5,311s
    sys 0m11,779
    
    (5.8 times faster)

In the future, when all pernet_operations become async,
we'll just remove this "async" field tree-wide.

All the new logic is concentrated in patches [1-5/32].
The rest of patches converts specific operations:
review, rationale of they can be converted, and setting
of async flag.

Kirill

v3: Improved patches descriptions. Added comment into [5/32].
Added [32/32] converting netlink_tap_net_ops (new pernet operations
introduced in 2018).

v2: Single patch -> patchset with rationale of every conversion

---

Kirill Tkhai (32):
      net: Assign net to net_namespace_list in setup_net()
      net: Cleanup in copy_net_ns()
      net: Introduce net_sem for protection of pernet_list
      net: Move mutex_unlock() in cleanup_net() up
      net: Allow pernet_operations to be executed in parallel
      net: Convert proc_net_ns_ops
      net: Convert net_ns_ops methods
      net: Convert sysctl_pernet_ops
      net: Convert netfilter_net_ops
      net: Convert nf_log_net_ops
      net: Convert net_inuse_ops
      net: Convert net_defaults_ops
      net: Convert netlink_net_ops
      net: Convert rtnetlink_net_ops
      net: Convert audit_net_ops
      net: Convert uevent_net_ops
      net: Convert proto_net_ops
      net: Convert pernet_subsys ops, registered via net_dev_init()
      net: Convert fib_* pernet_operations, registered via subsys_initcall
      net: Convert subsys_initcall() registered pernet_operations from net/sched
      net: Convert genl_pernet_ops
      net: Convert wext_pernet_ops
      net: Convert sysctl_core_ops
      net: Convert pernet_subsys, registered from inet_init()
      net: Convert unix_net_ops
      net: Convert packet_net_ops
      net: Convert ipv4_sysctl_ops
      net: Convert addrconf_ops
      net: Convert loopback_net_ops
      net: Convert default_device_ops
      net: Convert diag_net_ops
      net: Convert netlink_tap_net_ops


 drivers/net/loopback.c      |    1 
 fs/proc/proc_net.c          |    1 
 include/linux/rtnetlink.h   |    1 
 include/net/net_namespace.h |    6 +++
 kernel/audit.c              |    1 
 lib/kobject_uevent.c        |    1 
 net/core/dev.c              |    2 +
 net/core/fib_notifier.c     |    1 
 net/core/fib_rules.c        |    1 
 net/core/net-procfs.c       |    2 +
 net/core/net_namespace.c    |   95 +++++++++++++++++++++++++------------------
 net/core/rtnetlink.c        |    5 +-
 net/core/sock.c             |    2 +
 net/core/sock_diag.c        |    1 
 net/core/sysctl_net_core.c  |    1 
 net/ipv4/af_inet.c          |    2 +
 net/ipv4/arp.c              |    1 
 net/ipv4/devinet.c          |    1 
 net/ipv4/fib_frontend.c     |    1 
 net/ipv4/icmp.c             |    1 
 net/ipv4/igmp.c             |    1 
 net/ipv4/ip_fragment.c      |    1 
 net/ipv4/ipmr.c             |    1 
 net/ipv4/ping.c             |    1 
 net/ipv4/proc.c             |    1 
 net/ipv4/raw.c              |    1 
 net/ipv4/route.c            |    4 ++
 net/ipv4/sysctl_net_ipv4.c  |    1 
 net/ipv4/tcp_ipv4.c         |    2 +
 net/ipv4/tcp_metrics.c      |    1 
 net/ipv4/udp.c              |    1 
 net/ipv4/udplite.c          |    1 
 net/ipv4/xfrm4_policy.c     |    1 
 net/ipv6/addrconf.c         |    1 
 net/netfilter/core.c        |    1 
 net/netfilter/nf_log.c      |    1 
 net/netlink/af_netlink.c    |    2 +
 net/netlink/genetlink.c     |    1 
 net/packet/af_packet.c      |    1 
 net/sched/act_api.c         |    1 
 net/sched/sch_api.c         |    1 
 net/sysctl_net.c            |    1 
 net/unix/af_unix.c          |    1 
 net/wireless/wext-core.c    |    1 
 net/xfrm/xfrm_policy.c      |    1 
 45 files changed, 116 insertions(+), 41 deletions(-)

             reply	other threads:[~2018-02-13  9:26 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13  9:25 Kirill Tkhai [this message]
2018-02-13  9:26 ` [PATCH net-next v3 01/32] net: Assign net to net_namespace_list in setup_net() Kirill Tkhai
2018-02-13  9:26 ` [PATCH net-next v3 02/32] net: Cleanup in copy_net_ns() Kirill Tkhai
2018-02-13  9:26 ` [PATCH net-next v3 03/32] net: Introduce net_sem for protection of pernet_list Kirill Tkhai
2018-02-26  2:04   ` [lkp-robot] [net] 37b927536f: kernel_BUG_at_net/core/net_namespace.c kernel test robot
2018-02-26  9:40     ` Kirill Tkhai
2018-02-13  9:26 ` [PATCH net-next v3 04/32] net: Move mutex_unlock() in cleanup_net() up Kirill Tkhai
2018-02-13  9:26 ` [PATCH net-next v3 05/32] net: Allow pernet_operations to be executed in parallel Kirill Tkhai
2018-02-13  9:26 ` [PATCH net-next v3 06/32] net: Convert proc_net_ns_ops Kirill Tkhai
2018-02-13  9:27 ` [PATCH net-next v3 07/32] net: Convert net_ns_ops methods Kirill Tkhai
2018-02-13  9:27 ` [PATCH net-next v3 08/32] net: Convert sysctl_pernet_ops Kirill Tkhai
2018-02-13  9:27 ` [PATCH net-next v3 09/32] net: Convert netfilter_net_ops Kirill Tkhai
2018-02-13  9:27 ` [PATCH net-next v3 10/32] net: Convert nf_log_net_ops Kirill Tkhai
2018-02-13  9:27 ` [PATCH net-next v3 11/32] net: Convert net_inuse_ops Kirill Tkhai
2018-02-13  9:27 ` [PATCH net-next v3 12/32] net: Convert net_defaults_ops Kirill Tkhai
2018-02-13  9:28 ` [PATCH net-next v3 13/32] net: Convert netlink_net_ops Kirill Tkhai
2018-02-13  9:28 ` [PATCH net-next v3 14/32] net: Convert rtnetlink_net_ops Kirill Tkhai
2018-02-13  9:28 ` [PATCH net-next v3 15/32] net: Convert audit_net_ops Kirill Tkhai
2018-02-13  9:28 ` [PATCH net-next v3 16/32] net: Convert uevent_net_ops Kirill Tkhai
2018-02-13  9:28 ` [PATCH net-next v3 17/32] net: Convert proto_net_ops Kirill Tkhai
2018-02-13  9:28 ` [PATCH net-next v3 18/32] net: Convert pernet_subsys ops, registered via net_dev_init() Kirill Tkhai
2018-02-13  9:29 ` [PATCH net-next v3 19/32] net: Convert fib_* pernet_operations, registered via subsys_initcall Kirill Tkhai
2018-02-13  9:29 ` [PATCH net-next v3 20/32] net: Convert subsys_initcall() registered pernet_operations from net/sched Kirill Tkhai
2018-02-13  9:29 ` [PATCH net-next v3 21/32] net: Convert genl_pernet_ops Kirill Tkhai
2018-02-13  9:29 ` [PATCH net-next v3 22/32] net: Convert wext_pernet_ops Kirill Tkhai
2018-02-13  9:29 ` [PATCH net-next v3 23/32] net: Convert sysctl_core_ops Kirill Tkhai
2018-02-13  9:29 ` [PATCH net-next v3 24/32] net: Convert pernet_subsys, registered from inet_init() Kirill Tkhai
2018-02-13  9:30 ` [PATCH net-next v3 25/32] net: Convert unix_net_ops Kirill Tkhai
2018-02-13  9:30 ` [PATCH net-next v3 26/32] net: Convert packet_net_ops Kirill Tkhai
2018-02-13  9:30 ` [PATCH net-next v3 27/32] net: Convert ipv4_sysctl_ops Kirill Tkhai
2018-02-13  9:30 ` [PATCH net-next v3 28/32] net: Convert addrconf_ops Kirill Tkhai
2018-02-13  9:30 ` [PATCH net-next v3 29/32] net: Convert loopback_net_ops Kirill Tkhai
2018-02-13  9:30 ` [PATCH net-next v3 30/32] net: Convert default_device_ops Kirill Tkhai
2018-02-13  9:30 ` [PATCH net-next v3 31/32] net: Convert diag_net_ops Kirill Tkhai
2018-02-13  9:31 ` [PATCH net-next v3 32/32] net: Convert netlink_tap_net_ops Kirill Tkhai
2018-02-13 15:54 ` [PATCH net-next v3 00/32] Replacing net_mutex with rw_semaphore 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=151851357738.5034.10272265431844825686.stgit@localhost.localdomain \
    --to=ktkhai@virtuozzo.com \
    --cc=adobriyan@gmail.com \
    --cc=avagin@virtuozzo.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=ebiederm@xmission.com \
    --cc=eric.dumazet@gmail.com \
    --cc=fw@strlen.de \
    --cc=gorcunov@virtuozzo.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=lucien.xin@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=mschiffer@universe-factory.net \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=paul@paul-moore.com \
    --cc=pombredanne@nexb.com \
    --cc=roman.kapl@sysgo.com \
    --cc=rshearma@brocade.com \
    --cc=stephen@networkplumber.org \
    --cc=vyasevic@redhat.com \
    --cc=vyasevich@gmail.com \
    --cc=xiyou.wangcong@gmail.com \
    /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