From: Eric Dumazet <eric.dumazet@gmail.com>
To: Stephen Hemminger <stephen@networkplumber.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [PATCH] inet: add bound ports statistic
Date: Wed, 28 Feb 2018 18:28:02 -0800 [thread overview]
Message-ID: <1519871282.11536.2.camel@gmail.com> (raw)
In-Reply-To: <20180301020101.3975-1-sthemmin@microsoft.com>
On Wed, 2018-02-28 at 18:01 -0800, Stephen Hemminger wrote:
> This adds a number of bound ports in a network namespace which is
> a useful for socket summary (ss) command. It adds one additional
> field onto /proc/net/sockstat.
>
> Since collecting these kind of counters can be sensitive for large
> machines, the impact is placed on the reading side which will be
> much rarer.
>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
> include/net/inet_connection_sock.h | 2 +-
> net/ipv4/inet_connection_sock.c | 22 ++++++++++++++++++++++
> net/ipv4/proc.c | 5 +++--
> 3 files changed, 26 insertions(+), 3 deletions(-)
>
> diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
> index c1a93ce35e62..3044deec73ce 100644
> --- a/include/net/inet_connection_sock.h
> +++ b/include/net/inet_connection_sock.h
> @@ -265,7 +265,7 @@ inet_csk_rto_backoff(const struct inet_connection_sock *icsk,
> }
>
> struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern);
> -
> +unsigned int inet_csk_count_ports(struct net *net, struct proto *prot);
> int inet_csk_get_port(struct sock *sk, unsigned short snum);
>
> struct dst_entry *inet_csk_route_req(const struct sock *sk, struct flowi4 *fl4,
> diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c
> index 881ac6d046f2..2418abce4d50 100644
> --- a/net/ipv4/inet_connection_sock.c
> +++ b/net/ipv4/inet_connection_sock.c
> @@ -424,6 +424,28 @@ static int inet_csk_wait_for_connect(struct sock *sk, long timeo)
> return err;
> }
>
> +/* Count how many any entries are in the bind hash table */
How useful it is to report this information ?
Given REUSEADDR and REUSEPORT, I really wonder what can be derived from
this counter.
It seems its semantic is weak.
next prev parent reply other threads:[~2018-03-01 2:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 2:01 [PATCH] inet: add bound ports statistic Stephen Hemminger
2018-03-01 2:28 ` Eric Dumazet [this message]
2018-03-01 3:32 ` David Miller
2018-03-01 4:28 ` Eric Dumazet
2018-03-01 16:16 ` Stephen Hemminger
2018-03-01 17:09 ` Eric Dumazet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1519871282.11536.2.camel@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
--cc=sthemmin@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).