diff options
author | Xi Wang <xii@google.com> | 2014-05-16 22:11:48 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-05-21 19:50:28 (GMT) |
commit | 9e641bdcfa4ef4d6e2fbaa59c1be0ad5d1551fd5 (patch) | |
tree | 1ca90255fbf39a91fb6e7a6ee27fec86fb56ac87 /net | |
parent | f98f89a0104454f35a62d681683c844f6dbf4043 (diff) | |
download | linux-9e641bdcfa4ef4d6e2fbaa59c1be0ad5d1551fd5.tar.xz |
net-tun: restructure tun_do_read for better sleep/wakeup efficiency
tun_do_read always adds current thread to wait queue, even if a packet
is ready to read. This is inefficient because both sleeper and waker
want to acquire the wait queue spin lock when packet rate is high.
We restructure the read function and use common kernel networking
routines to handle receive, sleep and wakeup. With the change
available packets are checked first before the reading thread is added
to the wait queue.
Ran performance tests with the following configuration:
- my packet generator -> tap1 -> br0 -> tap0 -> my packet consumer
- sender pinned to one core and receiver pinned to another core
- sender send small UDP packets (64 bytes total) as fast as it can
- sandy bridge cores
- throughput are receiver side goodput numbers
The results are
baseline: 731k pkts/sec, cpu utilization at 1.50 cpus
changed: 783k pkts/sec, cpu utilization at 1.53 cpus
The performance difference is largely determined by packet rate and
inter-cpu communication cost. For example, if the sender and
receiver are pinned to different cpu sockets, the results are
baseline: 558k pkts/sec, cpu utilization at 1.71 cpus
changed: 690k pkts/sec, cpu utilization at 1.67 cpus
Co-authored-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Xi Wang <xii@google.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
0 files changed, 0 insertions, 0 deletions