]> git.hungrycats.org Git - linux/commit
[NET] generalise per protocol slab cache handling
authorArnaldo Carvalho de Melo <acme@conectiva.com.br>
Mon, 13 Sep 2004 17:05:28 +0000 (14:05 -0300)
committerArnaldo Carvalho de Melo <acme@conectiva.com.br>
Mon, 13 Sep 2004 17:05:28 +0000 (14:05 -0300)
commitc531454e26c39d77c721ee59d04bbe1dc0cca119
tree5d1f1042f0d31e8b1e0bab2da3d27c160f7d8d15
parent664d4fca1f6637331b8d3c7ad51b38e626b0a9ab
[NET] generalise per protocol slab cache handling

With this patch we get two new slabcaches, for sctp socks, that previously
were being allocated on the default, that was tcp[6]_sock, i.e. wasting 288
bytes per sock in the IPv4 case and 256 bytes for the IPv6 version, this is in
preparation for DCCP (or any other new protocol :) ).

With this in place another nice side effect that is easier to achieve is to
get rid of struct sock sk->sk_slab, and instead use sk->sk_prot->slab, saving
sizeof(void *) on every struct sock instance, but this unfortunatly has to
wait for the conversion of all protocols that use per socket slabcaches to
use sk->sk_prot, AF_UNIX is the only one AFAIK, so I'll try to convert it to
use sk->sk_prot and then get rid of sk->sk_slab.

As for the protocols that don't use per socket slabcaches its just a matter
of defaulting to sk_cachep at sk_free time if sk->sk_prot is NULL.

[root@qemu ~]# modprobe sctp
[root@qemu ~]# grep _sock /proc/slabinfo
sctpv6_sock            9      9    864    9    2 : tunables   54   27    0 :
sctp_sock              0      0    736    5    1 : tunables   54   27    0 :
rawv6_sock             3      6    640    6    1 : tunables   54   27    0 :
udpv6_sock             0      0    608    6    1 : tunables   54   27    0 :
tcpv6_sock             1      7   1120    7    2 : tunables   24   12    0 :
unix_sock              6     10    384   10    1 : tunables   54   27    0 :
raw_sock               2      8    480    8    1 : tunables   54   27    0 :
udp_sock               0      0    512    7    1 : tunables   54   27    0 :
tcp_sock               0      0   1024    4    1 : tunables   54   27    0 :

Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
Signed-off-by: David S. Miller <davem@redhat.com>
17 files changed:
include/linux/ipv6.h
include/net/sctp/sctp.h
include/net/sock.h
include/net/tcp.h
net/core/sock.c
net/ipv4/af_inet.c
net/ipv4/raw.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_minisocks.c
net/ipv4/udp.c
net/ipv6/af_inet6.c
net/ipv6/raw.c
net/ipv6/tcp_ipv6.c
net/ipv6/udp.c
net/sctp/ipv6.c
net/sctp/protocol.c
net/sctp/socket.c