]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
tun: rx batching
authorJason Wang <jasowang@redhat.com>
Wed, 18 Jan 2017 07:02:03 +0000 (15:02 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Jan 2017 21:35:30 +0000 (16:35 -0500)
commit5503fcecd49f599e52d10f82057fe0c9d53c8f03
tree6c9f4290fb1780ea3ce98985934f4c504c95a744
parent0ed005ce02fa0a88e5e6b7b5f7ff452171881610
tun: rx batching

We can only process 1 packet at one time during sendmsg(). This often
lead bad cache utilization under heavy load. So this patch tries to do
some batching during rx before submitting them to host network
stack. This is done through accepting MSG_MORE as a hint from
sendmsg() caller, if it was set, batch the packet temporarily in a
linked list and submit them all once MSG_MORE were cleared.

Tests were done by pktgen (burst=128) in guest over mlx4(noqueue) on host:

                                 Mpps  -+%
    rx-frames = 0                0.91  +0%
    rx-frames = 4                1.00  +9.8%
    rx-frames = 8                1.00  +9.8%
    rx-frames = 16               1.01  +10.9%
    rx-frames = 32               1.07  +17.5%
    rx-frames = 48               1.07  +17.5%
    rx-frames = 64               1.08  +18.6%
    rx-frames = 64 (no MSG_MORE) 0.91  +0%

User were allowed to change per device batched packets through
ethtool -C rx-frames. NAPI_POLL_WEIGHT were used as upper limitation
to prevent bh from being disabled too long.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c