From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f65.google.com ([74.125.83.65]:42053 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032539AbeCAQQ0 (ORCPT ); Thu, 1 Mar 2018 11:16:26 -0500 Received: by mail-pg0-f65.google.com with SMTP id y8so2489015pgr.9 for ; Thu, 01 Mar 2018 08:16:25 -0800 (PST) Date: Thu, 1 Mar 2018 08:16:13 -0800 From: Stephen Hemminger To: Eric Dumazet Cc: David Miller , netdev@vger.kernel.org, sthemmin@microsoft.com Subject: Re: [PATCH] inet: add bound ports statistic Message-ID: <20180301081613.3b52cd83@xeon-e3> In-Reply-To: <1519878495.11536.4.camel@gmail.com> References: <20180301020101.3975-1-sthemmin@microsoft.com> <1519871282.11536.2.camel@gmail.com> <20180228.223217.1178910703084049513.davem@davemloft.net> <1519878495.11536.4.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: netdev-owner@vger.kernel.org List-ID: On Wed, 28 Feb 2018 20:28:15 -0800 Eric Dumazet wrote: > On Wed, 2018-02-28 at 22:32 -0500, David Miller wrote: > > From: Eric Dumazet > > Date: Wed, 28 Feb 2018 18:28:02 -0800 > > =20 > > > How useful it is to report this information ? > > >=20 > > > Given REUSEADDR and REUSEPORT, I really wonder what can be derived fr= om > > > this counter. > > >=20 > > > It seems its semantic is weak. =20 > >=20 > > To me none of this really matters. > >=20 > > What matters is that iproute2 reported this via slabinfo for longer > > than a decade. > >=20 > > It broke recently when SLAB started merging caches just like SLUB > > always did. =20 >=20 >=20 > Linus himself removed some info that was much more useful in > commit a5ad88ce8c7fae7d ("mm: get rid of 'vmalloc_info' from > /proc/meminfo") >=20 > # egrep "VmallocUsed|VmallocChunk" /proc/meminfo > VmallocUsed:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A00 kB > VmallocChunk:=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= 0 kB >=20 > So I vote for not re-adding another loop in the kernel with no > preemption point. >=20 > Simply taking spinlocks like Stephen did is going to slow down the > other threads, lets face it. >=20 > This implementation has a high cost, and provides something that made > no sense in the first place. >=20 I went through a several possible alternatives. 1. Add a counter in the hash bucket head (like listen already has). But not namespace aware 2. Add a percpu counter in network namespace (new struct tcp_netns) Logical and adds place to move tcp open sockets as well. But more expensive and several places in code don't have easy access to namespace. 3. Counting entries in userspace; defeats the purpose of -s flag. Agree it is not an urgent statistic, it is just it got broken; willing to just drop it. What about adding cond_resched between buckets like other places do?