• Arnaldo Carvalho de Melo's avatar
    [NET] generalise per protocol slab cache handling · c531454e
    Arnaldo Carvalho de Melo authored
    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: default avatarArnaldo Carvalho de Melo <acme@conectiva.com.br>
    Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
    c531454e
af_inet6.c 18.9 KB