From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Salam Noureddine <noureddine@arista.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jiri Pirko <jiri@mellanox.com>,
Alexei Starovoitov <ast@plumgrid.com>,
Daniel Borkmann <daniel@iogearbox.net>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Julian Anastasov <ja@ssi.bg>,
netdev@vger.kernel.org
Subject: Re: [PATCH v2 net-next 4/4] net: fib: avoid calling fib_flush for each device when doing batch close and unregister
Date: Fri, 5 Feb 2016 19:04:02 +0300 [thread overview]
Message-ID: <56B4C7F2.1020109@cogentembedded.com> (raw)
In-Reply-To: <1454628956-4803-5-git-send-email-noureddine@arista.com>
On 02/05/2016 02:35 AM, Salam Noureddine wrote:
> Call fib_flush at the end when closing or unregistering multiple
> devices. This can save walking the fib many times and greatly
> reduce rtnl_lock hold time when unregistering many devices with
> a fib having hundreds of thousands of routes.
>
> Signed-off-by: Salam Noureddine <noureddine@arista.com>
> ---
> include/net/netns/ipv4.h | 1 +
> net/ipv4/fib_frontend.c | 16 ++++++++++++++--
> 2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
> index d75be32..d59a078 100644
> --- a/include/net/netns/ipv4.h
> +++ b/include/net/netns/ipv4.h
[...]
> diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
> index 4734475..808426e 100644
> --- a/net/ipv4/fib_frontend.c
> +++ b/net/ipv4/fib_frontend.c
> @@ -1161,11 +1161,22 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
> unsigned int flags;
>
> if (event == NETDEV_UNREGISTER) {
> - fib_disable_ip(dev, event, true);
> + if (fib_sync_down_dev(dev, event, true))
> + net->ipv4.needs_fib_flush = true;
> rt_flush_dev(dev);
> return NOTIFY_DONE;
> }
>
> + if (event == NETDEV_UNREGISTER_BATCH || event == NETDEV_DOWN_BATCH) {
> + if (net->ipv4.needs_fib_flush) {
> + fib_flush(net);
> + net->ipv4.needs_fib_flush = false;
> + }
> + rt_cache_flush(net);
> + arp_ifdown_all();
> + return NOTIFY_DONE;
> + }
> +
I'd convert to *switch* the above 2 *if*'s...
[...]
MBR, Sergei
next prev parent reply other threads:[~2016-02-05 16:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-04 23:35 [PATCH v2 net-next 0/4] batch calls to fib_flush and arp_ifdown Salam Noureddine
2016-02-04 23:35 ` [PATCH v2 net-next 1/4] net: add event_list to struct net and provide utility functions Salam Noureddine
2016-02-04 23:35 ` [PATCH v2 net-next 2/4] net: dev: add batching to net_device notifiers Salam Noureddine
2016-02-06 18:58 ` Julian Anastasov
2016-02-07 6:25 ` Salam Noureddine
2016-02-07 10:09 ` Julian Anastasov
2016-02-04 23:35 ` [PATCH v2 net-next 3/4] net: core: introduce neigh_ifdown_all for all down interfaces Salam Noureddine
2016-02-04 23:35 ` [PATCH v2 net-next 4/4] net: fib: avoid calling fib_flush for each device when doing batch close and unregister Salam Noureddine
2016-02-05 16:04 ` Sergei Shtylyov [this message]
2016-02-07 6:09 ` Salam Noureddine
2016-02-07 10:24 ` Sergei Shtylyov
2016-02-05 22:37 ` [PATCH v2 net-next 0/4] batch calls to fib_flush and arp_ifdown Salam Noureddine
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=56B4C7F2.1020109@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=ast@plumgrid.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=edumazet@google.com \
--cc=ja@ssi.bg \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=noureddine@arista.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.