Re: [PATCH] veth: use batched device unregister

Michał Mirosław
2011-05-09T06:56:47Z

2011/5/9 Eric Dumazet <eric.dumazet@gmail.com>:
> veth devices dont use the batched device unregisters yet.
>
> Since veth are a pair of devices, it makes sense to use a batch of two
> unregisters, this roughly divide dismantle time by two.
[...]
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -451,8 +451,16 @@ static void veth_dellink(struct net_device *dev, struct list_head *head)
>        priv = netdev_priv(dev);
>        peer = priv->peer;
>
> -       unregister_netdevice_queue(dev, head);
> -       unregister_netdevice_queue(peer, head);
> +       if (head == NULL) {
> +               LIST_HEAD(list);
> +               /* make a batch of two devices to speedup unregister */
> +               unregister_netdevice_queue(dev, &list);
> +               unregister_netdevice_queue(peer, &list);
> +               unregister_netdevice_many(&list);
> +       } else {
> +               unregister_netdevice_queue(dev, head);
> +               unregister_netdevice_queue(peer, head);
> +       }

You could change dellink callers to always pass head != NULL. As a
side effect, unregister_netdevice_queue() would do just what its name
suggests.

Best Regards,
Michał Mirosław