mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Gospodarek <andy@greyhouse.net>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Lee Revell <rlrevell@joe-job.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	davem@davemloft.net
Subject: Re: [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat
Date: Mon, 16 Jan 2006 17:33:59 -0500	[thread overview]
Message-ID: <bdfc5d6e0601161433g1c51dd4dpbc5da4cd7581d5d6@mail.gmail.com> (raw)
In-Reply-To: <9a8748490601161308g5f941c30o870042e6d9811c58@mail.gmail.com>

On 1/16/06, Jesper Juhl <jesper.juhl@gmail.com> wrote:
> >
> Maybe if you described "your current problem" someone could suggest a
> solution...
>

Sure, I'd be glad to.  If I add up all the entries from the procfiles
(in /proc/net) on my system

packet = 1
netlink = 6
raw = 0
raw6 = 0
tcp = 5
tcp6 = 3
udp = 9
udp6 = 1
unix = 29

I find there are a total of 54 sockets open on my system.

Now this seems to differ from the value in /proc/net/sockstat:
# cat sockstat
sockets: used 59
TCP: inuse 5 orphan 0 tw 0 alloc 8 mem 1
UDP: inuse 9
RAW: inuse 0
FRAG: inuse 0 memory 0

So we are off by 5.  I added some code around the stat collection used
in sockstat to get more detailed info about those sockets and the
output is here.  The values are family[protocol family][socket
family].

family[1][1] = 17        (UNIX/LOCAL,STREAM)
family[1][2] = 12        (UNIX/LOCAL,DGRAM)
family[2][1] = 5         (INET,STREAM)
family[2][2] = 9         (INET,DGRAM)
family[2][3] = 2         (INET,RAW)
family[10][1] = 3        (INET6,STREAM)
family[10][2] = 1        (INET6,DGRAM)
family[10][3] = 3        (INET6,RAW)
family[16][2] = 6        (NETLINK/ROUTE,DGRAM)
family[17][10] = 1       (PACKET,PACKET)
Total = 59

All of these numbers match up with what we saw above, except the
INET/RAW and INET6/RAW sockets.  It seems they aren't being counted
correctly -- which accounts for the 5 missing sockets.  The
decrementing of these values is in sock_release() and seems to get
done correctly other times RAW sockets are created, but not for the 5
sockets in question.

Since the total socket usage seems out of place in that file -- and
quite possibly wrong, it seemed like a nice idea to get rid of it
(prior to understanding the reasoning behind keeping it).  Now it
seems the goal will be to fix the discrepancy between these files.

-andy

  reply	other threads:[~2006-01-16 22:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-16 20:04 Andy Gospodarek
2006-01-16 20:14 ` Lee Revell
2006-01-16 20:25   ` Andy Gospodarek
2006-01-16 20:35     ` Jesper Juhl
2006-01-16 20:55       ` Andy Gospodarek
2006-01-16 21:08         ` Jesper Juhl
2006-01-16 22:33           ` Andy Gospodarek [this message]
2006-01-17  1:18             ` YOSHIFUJI Hideaki / 吉藤英明

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=bdfc5d6e0601161433g1c51dd4dpbc5da4cd7581d5d6@mail.gmail.com \
    --to=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rlrevell@joe-job.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

all inboxes | Powered by JetHome®