netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat
@ 2006-01-16 20:04 Andy Gospodarek
  2006-01-16 20:14 ` Lee Revell
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Gospodarek @ 2006-01-16 20:04 UTC (permalink / raw)
  To: linux-kernel, netdev, davem

Printing the total number of sockets used in /proc/net/sockstat is out
of place in a file that is supposed to contain information related to
ipv4 sockets.  Removed output for total socket usage.

Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
---

 proc.c |    1 -
 1 files changed, 1 deletion(-)


diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -60,7 +60,6 @@ static int fold_prot_inuse(struct proto 
  */
 static int sockstat_seq_show(struct seq_file *seq, void *v)
 {
-	socket_seq_show(seq);
 	seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %d\n",
 		   fold_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count),
 		   tcp_death_row.tw_count, atomic_read(&tcp_sockets_allocated),

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat
  2006-01-16 20:04 [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat Andy Gospodarek
@ 2006-01-16 20:14 ` Lee Revell
  2006-01-16 20:25   ` Andy Gospodarek
  0 siblings, 1 reply; 8+ messages in thread
From: Lee Revell @ 2006-01-16 20:14 UTC (permalink / raw)
  To: Andy Gospodarek; +Cc: linux-kernel, netdev, davem

On Mon, 2006-01-16 at 15:04 -0500, Andy Gospodarek wrote:
> Printing the total number of sockets used in /proc/net/sockstat is out
> of place in a file that is supposed to contain information related to
> ipv4 sockets.  Removed output for total socket usage.
> 

Um, you can't do that, it will break userspace.

Lee

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat
  2006-01-16 20:14 ` Lee Revell
@ 2006-01-16 20:25   ` Andy Gospodarek
  2006-01-16 20:35     ` Jesper Juhl
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Gospodarek @ 2006-01-16 20:25 UTC (permalink / raw)
  To: Lee Revell; +Cc: linux-kernel, netdev, davem

What userspace app will break because of this?

On 1/16/06, Lee Revell <rlrevell@joe-job.com> wrote:
> On Mon, 2006-01-16 at 15:04 -0500, Andy Gospodarek wrote:
> > Printing the total number of sockets used in /proc/net/sockstat is out
> > of place in a file that is supposed to contain information related to
> > ipv4 sockets.  Removed output for total socket usage.
> >
>
> Um, you can't do that, it will break userspace.
>
> Lee
>
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat
  2006-01-16 20:25   ` Andy Gospodarek
@ 2006-01-16 20:35     ` Jesper Juhl
  2006-01-16 20:55       ` Andy Gospodarek
  0 siblings, 1 reply; 8+ messages in thread
From: Jesper Juhl @ 2006-01-16 20:35 UTC (permalink / raw)
  To: Andy Gospodarek; +Cc: Lee Revell, linux-kernel, netdev, davem

On 1/16/06, Andy Gospodarek <andy@greyhouse.net> wrote:
> What userspace app will break because of this?
>
> On 1/16/06, Lee Revell <rlrevell@joe-job.com> wrote:
> > On Mon, 2006-01-16 at 15:04 -0500, Andy Gospodarek wrote:
> > > Printing the total number of sockets used in /proc/net/sockstat is out
> > > of place in a file that is supposed to contain information related to
> > > ipv4 sockets.  Removed output for total socket usage.
> > >
> >
> > Um, you can't do that, it will break userspace.
> >

That's not the point. The point is you can't go around changing things
exported to usersace - that has the potential to break apps.  Even if
no app is known to the people on this list there may still be apps out
there depending on it - and we don't break userspace without *very*
good reasons, and even then it's announced for several months (years
sometimes) in Documentation/feature-removal.txt and elsewhere.

--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat
  2006-01-16 20:35     ` Jesper Juhl
@ 2006-01-16 20:55       ` Andy Gospodarek
  2006-01-16 21:08         ` Jesper Juhl
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Gospodarek @ 2006-01-16 20:55 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: Lee Revell, linux-kernel, netdev, davem

Jesper,

Thanks for the explanation.  Your reasoning makes sense.  I will
consider other ways to solve my current problem and post a patch that
doesn't "break userspace" if necessary.

-andy



On 1/16/06, Jesper Juhl <jesper.juhl@gmail.com> wrote:
> On 1/16/06, Andy Gospodarek <andy@greyhouse.net> wrote:
> > What userspace app will break because of this?
> >
> > On 1/16/06, Lee Revell <rlrevell@joe-job.com> wrote:
> > > On Mon, 2006-01-16 at 15:04 -0500, Andy Gospodarek wrote:
> > > > Printing the total number of sockets used in /proc/net/sockstat is out
> > > > of place in a file that is supposed to contain information related to
> > > > ipv4 sockets.  Removed output for total socket usage.
> > > >
> > >
> > > Um, you can't do that, it will break userspace.
> > >
>
> That's not the point. The point is you can't go around changing things
> exported to usersace - that has the potential to break apps.  Even if
> no app is known to the people on this list there may still be apps out
> there depending on it - and we don't break userspace without *very*
> good reasons, and even then it's announced for several months (years
> sometimes) in Documentation/feature-removal.txt and elsewhere.
>
> --
> Jesper Juhl <jesper.juhl@gmail.com>
> Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
> Plain text mails only, please      http://www.expita.com/nomime.html
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat
  2006-01-16 20:55       ` Andy Gospodarek
@ 2006-01-16 21:08         ` Jesper Juhl
  2006-01-16 22:33           ` Andy Gospodarek
  0 siblings, 1 reply; 8+ messages in thread
From: Jesper Juhl @ 2006-01-16 21:08 UTC (permalink / raw)
  To: Andy Gospodarek; +Cc: Lee Revell, linux-kernel, netdev, davem

On 1/16/06, Andy Gospodarek <andy@greyhouse.net> wrote:

[could you *please* not top post? It's pretty annoying]

> Jesper,
>
> Thanks for the explanation.  Your reasoning makes sense.  I will

I'm glad you found it useful.

> consider other ways to solve my current problem and post a patch that
> doesn't "break userspace" if necessary.
>
Maybe if you described "your current problem" someone could suggest a
solution...

--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat
  2006-01-16 21:08         ` Jesper Juhl
@ 2006-01-16 22:33           ` Andy Gospodarek
  2006-01-17  1:18             ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Gospodarek @ 2006-01-16 22:33 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: Lee Revell, linux-kernel, netdev, davem

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat
  2006-01-16 22:33           ` Andy Gospodarek
@ 2006-01-17  1:18             ` YOSHIFUJI Hideaki / 吉藤英明
  0 siblings, 0 replies; 8+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2006-01-17  1:18 UTC (permalink / raw)
  To: andy; +Cc: jesper.juhl, rlrevell, linux-kernel, netdev, davem, yoshfuji

In article <bdfc5d6e0601161433g1c51dd4dpbc5da4cd7581d5d6@mail.gmail.com> (at Mon, 16 Jan 2006 17:33:59 -0500), Andy Gospodarek <andy@greyhouse.net> says:

> 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
:
> 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
:
> 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].
:
> 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.

This is because we have several internal unhashed raw sockets in
kernel, which are not counted in the "raw" entry, but in "sockets."

--yoshfuji

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-01-17  1:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-16 20:04 [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat 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
2006-01-17  1:18             ` YOSHIFUJI Hideaki / 吉藤英明

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).