Subject: Re: PATCH net-next-2.6] linkwatch: linkwatch_forget_dev() to speedup device dismantle

From: Stephen Hemminger <[email-masked]>
Date: Mon, 16 Nov 2009 14:39:17 -0800

On Mon, 16 Nov 2009 22:50:48 +0100
Eric Dumazet <[email-masked]> wrote:

> vlan_dev_stop() ->
> 	netif_carrier_off(dev) ->
> 		linkwatch_fire_event(dev) ->
> 			dev_hold() ...
> 
> And __linkwatch_run_queue() runs up to one second later...
> 
> A generic fix to this problem is to add a linkwatch_forget_dev() method
> to unlink the device from the list of watched devices.
> 
> dev->link_watch_next becomes dev->link_watch_list (and use a bit more memory),
> to be able to unlink device in O(1).
> 
> After patch :
> time ip link del eth3.103 ; time ip link del eth3.104 ; time ip link del eth3.105
> 
> real    0m0.024s
> user    0m0.000s
> sys     0m0.000s
> 
> real    0m0.032s
> user    0m0.000s
> sys     0m0.001s
> 
> real    0m0.033s
> user    0m0.000s
> sys     0m0.000s
> 
> 
> Signed-off-by: Eric Dumazet <[email-masked]>

Acked-by: Stephen Hemminger <[email-masked]>