netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: David Miller <davem@davemloft.net>,
	alexei.starovoitov@gmail.com, eric.dumazet@gmail.com
Cc: netdev@vger.kernel.org, solar@openwall.com, vvs@virtuozzo.com,
	avagin@virtuozzo.com, xemul@virtuozzo.com,
	vdavydov@virtuozzo.com, khorenko@virtuozzo.com,
	pablo@netfilter.org, netfilter-devel@vger.kernel.org
Subject: Re: [RFC] net: ipv4 -- Introduce ifa limit per net
Date: Thu, 10 Mar 2016 18:09:20 +0300	[thread overview]
Message-ID: <20160310150920.GC21154@uranus.lan> (raw)
In-Reply-To: <20160310110324.GB21154@uranus.lan>

On Thu, Mar 10, 2016 at 02:03:24PM +0300, Cyrill Gorcunov wrote:
> On Thu, Mar 10, 2016 at 01:20:18PM +0300, Cyrill Gorcunov wrote:
> > On Thu, Mar 10, 2016 at 12:16:29AM +0300, Cyrill Gorcunov wrote:
> > > 
> > > Thanks for explanation, Dave! I'll continue on this task tomorrow
> > > tryin to implement optimization you proposed.
> > 
> > OK, here are the results for the preliminary patch with conntrack running
> ...
> >  net/ipv4/devinet.c |   13 ++++++++++++-
> >  1 file changed, 12 insertions(+), 1 deletion(-)
> > 
> > Index: linux-ml.git/net/ipv4/devinet.c
> > ===================================================================
> > --- linux-ml.git.orig/net/ipv4/devinet.c
> > +++ linux-ml.git/net/ipv4/devinet.c
> > @@ -403,7 +403,18 @@ no_promotions:
> >  	   So that, this order is correct.
> >  	 */
> 
> This patch is wrong, so drop it please. I'll do another.

Here I think is a better variant. The resulst are good
enough -- 1 sec for cleanup. Does the patch look sane?
---
 net/ipv4/netfilter/nf_nat_masquerade_ipv4.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Index: linux-ml.git/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
===================================================================
--- linux-ml.git.orig/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
+++ linux-ml.git/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
@@ -108,9 +108,22 @@ static int masq_inet_event(struct notifi
 			   unsigned long event,
 			   void *ptr)
 {
-	struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
+	struct in_ifaddr *ifa = ptr;
+	struct net_device *dev = ifa->ifa_dev->dev;
 	struct netdev_notifier_info info;
 
+	if (event == NETDEV_DOWN) {
+		/*
+		 * When we meet dead device which is
+		 * being released with dozeon of addresses
+		 * assigned -- we can optimize calls
+		 * to conntrack cleanups and do it only
+		 * once.
+		 */
+		if (ifa->ifa_dev->dead && ifa->ifa_next)
+			return NOTIFY_DONE;
+	}
+
 	netdev_notifier_info_init(&info, dev);
 	return masq_device_event(this, event, &info);
 }

  reply	other threads:[~2016-03-10 15:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160309175307.GM2207@uranus.lan>
     [not found] ` <20160309.152730.691838022304871697.davem@davemloft.net>
     [not found]   ` <20160309204158.GO2207@uranus.lan>
2016-03-09 20:47     ` [RFC] net: ipv4 -- Introduce ifa limit per net David Miller
2016-03-09 20:57       ` Cyrill Gorcunov
2016-03-09 21:10         ` David Miller
2016-03-09 21:16           ` Cyrill Gorcunov
2016-03-10 10:20             ` Cyrill Gorcunov
2016-03-10 11:03               ` Cyrill Gorcunov
2016-03-10 15:09                 ` Cyrill Gorcunov [this message]
2016-03-10 18:01                   ` David Miller
2016-03-10 18:48                     ` Cyrill Gorcunov
2016-03-10 19:02                     ` Cong Wang
2016-03-10 19:55                       ` David Miller
2016-03-10 20:01                         ` Cyrill Gorcunov
2016-03-10 20:03                           ` David Miller
2016-03-10 20:13                             ` Cyrill Gorcunov
2016-03-10 20:19                               ` Cyrill Gorcunov
2016-03-10 21:05                               ` David Miller
2016-03-10 21:19                                 ` Cyrill Gorcunov
2016-03-10 21:59                                   ` Cyrill Gorcunov
2016-03-10 22:36                                     ` David Miller
2016-03-10 22:40                                       ` Cyrill Gorcunov
2016-03-11 20:40                                         ` David Miller
2016-03-11 20:58                                           ` Florian Westphal
2016-03-11 21:00                                           ` Cyrill Gorcunov
2016-03-11 21:22                                           ` Cyrill Gorcunov
2016-03-11 21:59                                             ` Cyrill Gorcunov
2016-03-14  3:29                                               ` David Miller
2016-03-10 21:09                         ` Cong Wang

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=20160310150920.GC21154@uranus.lan \
    --to=gorcunov@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=avagin@virtuozzo.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=khorenko@virtuozzo.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=solar@openwall.com \
    --cc=vdavydov@virtuozzo.com \
    --cc=vvs@virtuozzo.com \
    --cc=xemul@virtuozzo.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;
as well as URLs for NNTP newsgroup(s).