Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933444AbcKNGr0 (ORCPT ); Mon, 14 Nov 2016 01:47:26 -0500 Received: from mail-it0-f52.google.com ([209.85.214.52]:35421 "EHLO mail-it0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932656AbcKNGrX (ORCPT ); Mon, 14 Nov 2016 01:47:23 -0500 MIME-Version: 1.0 In-Reply-To: References: <20161110212404.GB4127@linux.vnet.ibm.com> <20161112002347.GL4127@linux.vnet.ibm.com> From: Cong Wang Date: Sun, 13 Nov 2016 22:47:01 -0800 Message-ID: Subject: Re: Long delays creating a netns after deleting one (possibly RCU related) To: "Paul E. McKenney" Cc: Rolf Neugebauer , LKML , Linux Kernel Network Developers , Justin Cormack , Ian Campbell Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1009 Lines: 25 On Fri, Nov 11, 2016 at 4:55 PM, Cong Wang wrote: > On Fri, Nov 11, 2016 at 4:23 PM, Paul E. McKenney > wrote: >> >> Ah! This net_mutex is different than RTNL. Should synchronize_net() be >> modified to check for net_mutex being held in addition to the current >> checks for RTNL being held? >> > > Good point! > > Like commit be3fc413da9eb17cce0991f214ab0, checking > for net_mutex for this case seems to be an optimization, I assume > synchronize_rcu_expedited() and synchronize_rcu() have the same > behavior... Thinking a bit more, I think commit be3fc413da9eb17cce0991f gets wrong on rtnl_is_locked(), the lock could be locked by other process not by the current one, therefore it should be lockdep_rtnl_is_held() which, however, is defined only when LOCKDEP is enabled... Sigh. I don't see any better way than letting callers decide if they want the expedited version or not, but this requires changes of all callers of synchronize_net(). Hm.