From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941039AbcKNWPe (ORCPT ); Mon, 14 Nov 2016 17:15:34 -0500 Received: from out03.mta.xmission.com ([166.70.13.233]:38831 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933656AbcKNWPb (ORCPT ); Mon, 14 Nov 2016 17:15:31 -0500 From: ebiederm@xmission.com (Eric W. Biederman) To: "Paul E. McKenney" Cc: Cong Wang , Rolf Neugebauer , LKML , Linux Kernel Network Developers , Justin Cormack , Ian Campbell , , Eric Dumazet References: <20161110212404.GB4127@linux.vnet.ibm.com> <20161112002347.GL4127@linux.vnet.ibm.com> <20161114162417.GJ4127@linux.vnet.ibm.com> <20161114181425.GN4127@linux.vnet.ibm.com> Date: Mon, 14 Nov 2016 16:12:54 -0600 In-Reply-To: <20161114181425.GN4127@linux.vnet.ibm.com> (Paul E. McKenney's message of "Mon, 14 Nov 2016 10:14:25 -0800") Message-ID: <87y40lhfrt.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1c6PX9-0002lZ-Lw;;;mid=<87y40lhfrt.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=75.170.125.99;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19v1/nmilLXQ8ww3od4fWybliePITCh5yQ= X-SA-Exim-Connect-IP: 75.170.125.99 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa08 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa08 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;"Paul E. McKenney" X-Spam-Relay-Country: X-Spam-Timing: total 5548 ms - load_scoreonly_sql: 0.10 (0.0%), signal_user_changed: 8 (0.1%), b_tie_ro: 6 (0.1%), parse: 1.62 (0.0%), extract_message_metadata: 12 (0.2%), get_uri_detail_list: 2.2 (0.0%), tests_pri_-1000: 4.6 (0.1%), tests_pri_-950: 1.24 (0.0%), tests_pri_-900: 1.04 (0.0%), tests_pri_-400: 31 (0.6%), check_bayes: 30 (0.5%), b_tokenize: 9 (0.2%), b_tok_get_all: 12 (0.2%), b_comp_prob: 2.9 (0.1%), b_tok_touch_all: 3.4 (0.1%), b_finish: 0.74 (0.0%), tests_pri_0: 341 (6.2%), check_dkim_signature: 0.64 (0.0%), check_dkim_adsp: 2.7 (0.0%), tests_pri_500: 5142 (92.7%), poll_dns_idle: 5136 (92.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: Long delays creating a netns after deleting one (possibly RCU related) X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "Paul E. McKenney" writes: > On Mon, Nov 14, 2016 at 09:44:35AM -0800, Cong Wang wrote: >> On Mon, Nov 14, 2016 at 8:24 AM, Paul E. McKenney >> wrote: >> > On Sun, Nov 13, 2016 at 10:47:01PM -0800, Cong Wang wrote: >> >> 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. >> > >> > I must confess that I don't understand how it would help to use an >> > expedited grace period when some other process is holding RTNL. >> > In contrast, I do well understand how it helps when the current process >> > is holding RTNL. >> >> Yeah, this is exactly my point. And same for ASSERT_RTNL() which checks >> rtnl_is_locked(), clearly we need to assert "it is held by the current process" >> rather than "it is locked by whatever process". >> >> But given *_is_held() is always defined by LOCKDEP, so we probably need >> mutex to provide such a helper directly, mutex->owner is not always defined >> either. :-/ > > There is always the option of making acquisition and release set a per-task > variable that can be tested. (Where did I put that asbestos suit, anyway?) > > Thanx, Paul synchronize_rcu_expidited is not enough if you have multiple network devices in play. Looking at the code it comes down to this commit, and it appears there is a promise add rcu grace period combining by Eric Dumazet. Eric since people are hitting noticable stalls because of the rcu grace period taking a long time do you think you could look at this code path a bit more? commit 93d05d4a320cb16712bb3d57a9658f395d8cecb9 Author: Eric Dumazet Date: Wed Nov 18 06:31:03 2015 -0800 net: provide generic busy polling to all NAPI drivers NAPI drivers no longer need to observe a particular protocol to benefit from busy polling (CONFIG_NET_RX_BUSY_POLL=y) napi_hash_add() and napi_hash_del() are automatically called from core networking stack, respectively from netif_napi_add() and netif_napi_del() This patch depends on free_netdev() and netif_napi_del() being called from process context, which seems to be the norm. Drivers might still prefer to call napi_hash_del() on their own, since they might combine all the rcu grace periods into a single one, knowing their NAPI structures lifetime, while core networking stack has no idea of a possible combining. Once this patch proves to not bring serious regressions, we will cleanup drivers to either remove napi_hash_del() or provide appropriate rcu grace periods combining. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Eric