On 20.02.2018 22:42, Cong Wang wrote: > On Mon, Feb 19, 2018 at 1:58 AM, Kirill Tkhai <ktk...@virtuozzo.com> wrote: >> void __put_net(struct net *net) >> { >> /* Cleanup the network namespace in process context */ >> - unsigned long flags; >> - >> - spin_lock_irqsave(&cleanup_list_lock, flags); >> - list_add(&net->cleanup_list, &cleanup_list); >> - spin_unlock_irqrestore(&cleanup_list_lock, flags); >> - >> + llist_add(&net->cleanup_list, &cleanup_list); >> queue_work(netns_wq, &net_cleanup_work); >> } > > Is llist safe against IRQ too?
Yes, it's safe and it's aimed for the cases like this. There is no "locked" state like spinlock has, there is single cmpxchg(). You may find examples it's used in ./kernel directory. Kirill