Re: [CFT][PATCH] net: Delay default_device_exit_batch until no devices are unregistering
From: David Miller <davem@davemloft.net>
Date: 2013-09-17 23:22:00
From: David Miller <davem@davemloft.net>
Date: 2013-09-17 23:22:00
From: ebiederm@xmission.com (Eric W. Biederman) Date: Mon, 16 Sep 2013 20:49:31 -0700
/* Delayed registration/unregisteration */ static LIST_HEAD(net_todo_list); +static atomic_t netdev_unregistering = ATOMIC_INIT(0); +static DECLARE_WAIT_QUEUE_HEAD(netdev_unregistering_wait);
I think you don't need this atomic. Something like this should work and seems much simpler: 1) Still use the netdev_unregistering_wait queue, that's fine. 2) In netdev_run_todo(), unconditionally wake it up at the end of the while() loop. 3) In default_device_exit_batch() use the same retry logic but your tests are on list_empty(&net_todo_list() rather than the new atomic count. I think with this simplification I'm fine to apply this patch after it has been tested properly. Long term I'd like to see a per-namespace todo list, as seems to have been suggested and discussed already. Thanks.