• Paolo Abeni's avatar
    udp: try to avoid 2 cache miss on dequeue · b65ac446
    Paolo Abeni authored
    when udp_recvmsg() is executed, on x86_64 and other archs, most skb
    fields are on cold cachelines.
    If the skb are linear and the kernel don't need to compute the udp
    csum, only a handful of skb fields are required by udp_recvmsg().
    Since we already use skb->dev_scratch to cache hot data, and
    there are 32 bits unused on 64 bit archs, use such field to cache
    as much data as we can, and try to prefetch on dequeue the relevant
    fields that are left out.
    
    This can save up to 2 cache miss per packet.
    
    v1 -> v2:
      - changed udp_dev_scratch fields types to u{32,16} variant,
        replaced bitfiled with bool
    Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    Acked-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    b65ac446
udp.c 72.8 KB