Messages in this thread | | | Date | Mon, 16 Jan 2006 17:33:59 -0500 | From | Andy Gospodarek <> | Subject | Re: [patch] networking ipv4: remove total socket usage count from /proc/net/sockstat |
| |
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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |