Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp840409ybb; Wed, 25 Mar 2020 10:35:57 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtNx+GMQbyFhpyAnDNpoRnqxemvk0ycQJDLXg8I0jGnfl2AV2AmJ0cXALM3O9CD1v5ntWGJ X-Received: by 2002:aca:bd0b:: with SMTP id n11mr3148215oif.90.1585157757447; Wed, 25 Mar 2020 10:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585157757; cv=none; d=google.com; s=arc-20160816; b=WHTJdpxFVoTHmXvDuTYXyVGhI1yM0eFlIYsP/27T7xLk/7Hi3MQPk9hHlzmHbVGjoi FqKb+jJRs644ghovOItx0knzIX755ObQbMqVdziEkiNx/OvL8YdQssc3zflUaiZ/efzA vb6c4NM4t/mgOkUmhjrLzbnF1+el4RFxjLCAembrn+5uNKhNxkfLMIVtIAwT5JJfQL/s /9xl/BkT5v8DZoc3p0TuBoQ0Ko6xJ1fcp0uA+prHsHsn1IlJrdO1PbWA6EsEb4svE6+B stlbalBkSFCxf4WyfleOfO8/bPkwGvCZbrAtUqSBI0F/ZC/cAwwR7pKWCYOpWO15Uz28 A8rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=Yi5HT0gIMU1vXoOcsaUkgeprWNpD7T8tR8cpKS9kJTk=; b=GyC21QNsmnqpgpnK5n8qURjJlx+83amS9wDQHqYCGtsAlVqyZ0KlU9HPAnzhqr+Rv4 cPQM228PmR6SxHrTsVdWm+7cn2xLZ7IN2v0MfHxucbdlfn1a6fJGOvZSX/FkHYWAx7KX uUIiraTFqYSP/7hauqHJPX09/FcCB0etpkGsCdGj24riPkoTda6SfMeEvPse+QQ9UqIy 1kS30SSxmu2tD1T99UQlde85VLfXKaTBmX2XS2kO0FAgysdKe5rC15TByqInNcLxCFfZ 7GqDg2LMrI+lW1odjmlxdhhCotZjBWf87MVKHTJfA4898F/vJ3JRZWZYLSVi7U3GKR7c e8Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=SLk1pebG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k193si82276oih.78.2020.03.25.10.35.44; Wed, 25 Mar 2020 10:35:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=SLk1pebG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727973AbgCYReu (ORCPT + 99 others); Wed, 25 Mar 2020 13:34:50 -0400 Received: from mail-qv1-f66.google.com ([209.85.219.66]:41287 "EHLO mail-qv1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727253AbgCYRet (ORCPT ); Wed, 25 Mar 2020 13:34:49 -0400 Received: by mail-qv1-f66.google.com with SMTP id o7so1486855qvq.8 for ; Wed, 25 Mar 2020 10:34:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=Yi5HT0gIMU1vXoOcsaUkgeprWNpD7T8tR8cpKS9kJTk=; b=SLk1pebGcLYeZ4z/jd6Fqh1mraqZbisWYOTgqwiA5nLWQUaeYs7xUhpQRw+6W11/Hu MrORLS95iFFGSRc/yEb/ns1zlod6UnpB5l4z0azg2eiIpg3WKa/yDjVuLsPWkWpGeg52 tOlgKuoSPSayanlhLPewETKDhOLWvDFYt53WzVCNcwwMRtns6kZVip3OIAGlrBIBnfCt 2tM82vWYGCpWCv6X5zk8lZgG8TTGMVLjMDGZG8DuyFWnyz9Ot/3WgromPZxnGJ0YT/eL BCX0epCrTOGn6RJFODaZQwBmD3tkMuWwOFnQwaxpJbqHb3RdwGYtwDT0DsX/MMgAUvVp gJ1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=Yi5HT0gIMU1vXoOcsaUkgeprWNpD7T8tR8cpKS9kJTk=; b=ktTdoEv0txm3FOm6uSArkrAXBtGjP5AZxfpZvc6PsADQkP3NSmCzWb7Qb1+9EqDh8G v+E4W2VFNSflNC6JrGgdkT7zlBVTMtHhjqE67URyqWdgqBqruGnhH5TKgw7UTiJ+cO6b U5W/E2UptQpszoQo4G8VcRQui3XBgj/D3nWsys3/Kq/KTrftafyGrQnD25gHaqivgT1q 2/FfrKrQsL1CatT8vvAcUrbUcwjE7fbdZLfdtvY5OCrkFR6V0z7absABp+0OM6ApjmbQ jb/YFeFZ67GatB8+dH717x1Ixq/DMINz2L1HP6RiNOpmDbt9WbBj2fc1fLBZROSo4H1k mDlg== X-Gm-Message-State: ANhLgQ0Ky50qY/OvYyWOXnPTQ9KdxLFjh1JMppO5POP1Ua43eotg0hp9 BI165UCpu2Fm7qIowSfXLXlYBA== X-Received: by 2002:a05:6214:aa2:: with SMTP id ew2mr4279653qvb.123.1585157687498; Wed, 25 Mar 2020 10:34:47 -0700 (PDT) Received: from [192.168.1.183] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id u25sm11933305qkj.71.2020.03.25.10.34.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Mar 2020 10:34:46 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable From: Qian Cai Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] ipv4: fix a RCU-list lock in fib_triestat_seq_show Date: Wed, 25 Mar 2020 13:34:46 -0400 Message-Id: <92C7474D-4592-44BF-B0ED-26253196511E@lca.pw> References: <5e2ed86a-23bc-d3e5-05ad-4e7ed147539c@gmail.com> Cc: davem@davemloft.net, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org, kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <5e2ed86a-23bc-d3e5-05ad-4e7ed147539c@gmail.com> To: Eric Dumazet X-Mailer: iPhone Mail (17D50) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Mar 25, 2020, at 12:13 PM, Eric Dumazet wrote:= >=20 > I would prefer : >=20 > diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c > index ff0c24371e3309b3068980f46d1ed743337d2a3e..4b98ffb27136d3b43f179d6b1b= 42fe84586acc06 100644 > --- a/net/ipv4/fib_trie.c > +++ b/net/ipv4/fib_trie.c > @@ -2581,6 +2581,7 @@ static int fib_triestat_seq_show(struct seq_file *se= q, void *v) > struct hlist_head *head =3D &net->ipv4.fib_table_hash[h]; > struct fib_table *tb; >=20 > + rcu_read_lock(); > hlist_for_each_entry_rcu(tb, head, tb_hlist) { > struct trie *t =3D (struct trie *) tb->tb_data; > struct trie_stat stat; > @@ -2596,6 +2597,7 @@ static int fib_triestat_seq_show(struct seq_file *se= q, void *v) > trie_show_usage(seq, t->stats); > #endif > } > + rcu_read_unlock(); > } >=20 > return 0; I have no strong opinion either way. My initial thought was to save 255 extr= a lock/unlock with a single lock/unlock, but I am not sure how time-consumin= g for each iteration of the outer loop could be. If it could take a bit too l= ong, it does make a lot of sense to reduce the critical section.=