From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-he1eur01on0122.outbound.protection.outlook.com ([104.47.0.122]:30748 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752335AbeBUIas (ORCPT ); Wed, 21 Feb 2018 03:30:48 -0500 Subject: Re: [PATCH 2/3] net: Make cleanup_list and net::cleanup_list of llist type To: Cong Wang Cc: David Miller , Nicolas Dichtel , vyasevic@redhat.com, "Paul E. McKenney" , Vladislav Yasevich , mark.rutland@arm.com, Greg KH , leonro@mellanox.com, avagin@virtuozzo.com, Florian Westphal , roman.kapl@sysgo.com, Linux Kernel Network Developers References: <151903409491.8021.11032992295248447417.stgit@localhost.localdomain> <151903432575.8021.5189428113212356710.stgit@localhost.localdomain> From: Kirill Tkhai Message-ID: <6eab9340-1e5b-aaec-b9aa-d6e40cb9a9a2@virtuozzo.com> Date: Wed, 21 Feb 2018 11:30:36 +0300 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On 20.02.2018 22:42, Cong Wang wrote: > On Mon, Feb 19, 2018 at 1:58 AM, Kirill Tkhai 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