• Jesper Dangaard Brouer's avatar
    pktgen: avoid expensive set_current_state() call in loop · baac167b
    Jesper Dangaard Brouer authored
    Avoid calling set_current_state() inside the busy-loop in
    pktgen_thread_worker().  In case of pkt_dev->delay, then it is still
    used/enabled in pktgen_xmit() via the spin() call.
    
    The set_current_state(TASK_INTERRUPTIBLE) uses a xchg, which implicit
    is LOCK prefixed.  I've measured the asm LOCK operation to take approx
    8ns on this E5-2630 CPU.  Performance increase corrolate with this
    measurement.
    
    Performance data with CLONE_SKB==100000, rx-usecs=30:
     (single CPU performance, ixgbe 10Gbit/s, E5-2630)
     * Prev:  5454050 pps --> 183.35ns (1/5454050*10^9)
     * Now:   5684009 pps --> 175.93ns (1/5684009*10^9)
     * Diff:  +229959 pps -->  -7.42ns
    Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    baac167b
pktgen.c 93.1 KB