From: Octavian Purdila <opurdila@ixiacom.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] net: factorize rt_do_flush for batch device unregistering
Date: Tue, 17 Nov 2009 00:03:44 +0200 [thread overview]
Message-ID: <200911170003.44099.opurdila@ixiacom.com> (raw)
In-Reply-To: <4B01C507.9050908@gmail.com>
On Monday 16 November 2009 23:32:55 you wrote:
> > @@ -5374,6 +5395,9 @@ EXPORT_SYMBOL(unregister_netdevice_queue);
> > * unregister_netdevice_many - unregister many devices
> > * @head: list of devices
> > *
> > + * WARNING: This function modifies the list. It may change the order of
> > the + * elements in the list. However, you can assume it does not add or
> > delete + * elements to/from the list.
>
> Sorry I dont understand this comment
>
The list passed to unregister_netdevice_many(), as the "head" parameter, may
be altered, e.g. order may change between the elements.
That is because we temporarily move the items from the list to the
rt_flush_list for the flush. When we add the items back they may not be added in
the same place.
Perhaps the confusion comes from the fact that I did not specified which list?
(i.e. head)
> > @@ -937,7 +937,10 @@ static int fib_netdev_event(struct notifier_block
> > *this, unsigned long event, vo struct in_device *in_dev =
> > __in_dev_get_rtnl(dev);
> >
> > if (event == NETDEV_UNREGISTER) {
> > - fib_disable_ip(dev, 2);
> > + /* if this event is part of a batch then don't flush the cache
> > + * now; we will receive another event at the end of the batch */
> > + int rt_flush = list_empty(&dev->unreg_list) ? 0 : -1;
>
> hmm... a bit ugly...
>
Would it be better if I would add a dev_is_batch_unregister() instead?
Or add a new device flag to explicitly signal the batch unregister?
> > + fib_disable_ip(dev, 2, rt_flush);
> > return NOTIFY_DONE;
> > }
> >
> > @@ -955,7 +958,7 @@ static int fib_netdev_event(struct notifier_block
> > *this, unsigned long event, vo rt_cache_flush(dev_net(dev), -1);
> > break;
> > case NETDEV_DOWN:
> > - fib_disable_ip(dev, 0);
> > + fib_disable_ip(dev, 0, 0);
> > break;
> > case NETDEV_CHANGEMTU:
> > case NETDEV_CHANGE:
>
> Are you sure you want to overload NETDEV_UNREGISTER ?
>
> Maybe it would be cleaner to add a new value, NETDEV_UNREGISTER_PERNET or
> something for the final loop...
>
Hmm, I think that will allow us to get rid of the ugly test: never flush the
cache for NETDEV_UNREGISTER, only flush it for NETDEV_UNREGISTER_PERNET.
We just need to make sure to add NETDEV_UNREGISTER_PERNET in other places
where NETDEV_UNREGISTER is called.
I'll try this in the next patch. Thanks for reviewing.
next prev parent reply other threads:[~2009-11-16 22:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-16 21:08 [PATCH] net: factorize rt_do_flush for batch device unregistering Octavian Purdila
2009-11-16 21:32 ` Eric Dumazet
2009-11-16 22:03 ` Octavian Purdila [this message]
2009-11-16 22:15 ` Eric Dumazet
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=200911170003.44099.opurdila@ixiacom.com \
--to=opurdila@ixiacom.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
/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).