From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755970AbdKNRHv (ORCPT ); Tue, 14 Nov 2017 12:07:51 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:51630 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754217AbdKNRHl (ORCPT ); Tue, 14 Nov 2017 12:07:41 -0500 X-Google-Smtp-Source: AGs4zMZlP5CnbpGVBiPl5y+jWX1VEEU+QNecLirHYmbZkJ9zbJlCC2Hd8g8ESLTRAqogEd06df4Q4Q== Message-ID: <1510679257.2849.170.camel@edumazet-glaptop3.roam.corp.google.com> Subject: Re: [PATCH] net: Convert net_mutex into rw_semaphore and down read it on net->init/->exit From: Eric Dumazet To: Kirill Tkhai Cc: davem@davemloft.net, vyasevic@redhat.com, kstewart@linuxfoundation.org, pombredanne@nexb.com, vyasevich@gmail.com, mark.rutland@arm.com, gregkh@linuxfoundation.org, adobriyan@gmail.com, fw@strlen.de, nicolas.dichtel@6wind.com, xiyou.wangcong@gmail.com, roman.kapl@sysgo.com, paul@paul-moore.com, dsahern@gmail.com, daniel@iogearbox.net, lucien.xin@gmail.com, mschiffer@universe-factory.net, rshearma@brocade.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, ebiederm@xmission.com, avagin@virtuozzo.com, gorcunov@virtuozzo.com Date: Tue, 14 Nov 2017 09:07:37 -0800 In-Reply-To: <151066759055.14465.9783879083192000862.stgit@localhost.localdomain> References: <151066759055.14465.9783879083192000862.stgit@localhost.localdomain> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2017-11-14 at 16:53 +0300, Kirill Tkhai wrote: > Curently mutex is used to protect pernet operations list. It makes > cleanup_net() to execute ->exit methods of the same operations set, > which was used on the time of ->init, even after net namespace is > unlinked from net_namespace_list. > ... > The solution is to convert net_mutex to the rw_semaphore. Then, > pernet_operations::init/::exit methods, modifying the net-related data, > will require down_read() locking only, while down_write() will be used > for changing pernet_list. > ... > This patch requires commit 76f8507f7a64 "locking/rwsem: Add down_read_killable()" > from Linus tree (not in net-next yet). Looks great, thanks for doing this. I wonder if the down_read_killable() is really needed, maybe a down_read() would not be blocking the thread too long after this change.