Subject: Re: [PATCH] net: factorize rt_do_flush for batch device unregistering

From: Eric Dumazet <[email-masked]>
Date: Mon, 16 Nov 2009 23:15:25 +0100

Octavian Purdila a écrit :
> 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.
> 

Ah, I got it now, confusion is that comment makes more sense for
rollback_registered_many() because when reading unregister_netdevice_many()
it is clear it doesnt change the list...

void unregister_netdevice_many(struct list_head *head)
{
        struct net_device *dev;

        if (!list_empty(head)) {
                rollback_registered_many(head);
                list_for_each_entry(dev, head, unreg_list)
                        net_set_todo(dev);
        }
}