From c531454e26c39d77c721ee59d04bbe1dc0cca119 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 13 Sep 2004 14:05:28 -0300 Subject: [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 Signed-off-by: David S. Miller --- include/linux/ipv6.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/linux') diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index ccc084d370cd..55aba976aba6 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -282,6 +282,10 @@ static inline struct raw6_opt * raw6_sk(const struct sock *__sk) return &((struct raw6_sock *)__sk)->raw6; } +struct ipv6_sk_offset { + int offset; +}; + #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) -- cgit v1.2.3