• Willem de Bruijn's avatar
    packet: rollover only to socket with headroom · 9954729b
    Willem de Bruijn authored
    Only migrate flows to sockets that have sufficient headroom, where
    sufficient is defined as having at least 25% empty space.
    
    The kernel has three different buffer types: a regular socket, a ring
    with frames (TPACKET_V[12]) or a ring with blocks (TPACKET_V3). The
    latter two do not expose a read pointer to the kernel, so headroom is
    not computed easily. All three needs a different implementation to
    estimate free space.
    
    Tested:
      Ran bench_rollover for 10 sec with 1.5 Mpps of single flow input.
    
      bench_rollover has as many sockets as there are NIC receive queues
      in the system. Each socket is owned by a process that is pinned to
      one of the receive cpus. RFS is disabled. RPS is enabled with an
      identity mapping (cpu x -> cpu x), to count drops with softnettop.
    
        lpbb5:/export/hda3/willemb# ./bench_rollover -r -l 1000 -s
        Press [Enter] to exit
    
        cpu         rx       rx.k     drop.k   rollover     r.huge   r.failed
          0         16         16          0          0          0          0
          1         21         21          0          0          0          0
          2    5227502    5227502          0          0          0          0
          3         18         18          0          0          0          0
          4    6083289    6083289          0    5227496          0          0
          5         22         22          0          0          0          0
          6         21         21          0          0          0          0
          7          9          9          0          0          0          0
    Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    9954729b
af_packet.c 99 KB