add udp-dont-frag option to support force setting DF bit - #242
Open
dust-li wants to merge 1 commit into
Open
Conversation
When measuring maximum packets-per-second (PPS) on Linux using multiple
sockperf processes to stress UDP throughput, the kernel’s per-packet atomic
operation for generating IP ID becomes a bottleneck.
Setting the Don’t Fragment (DF) bit in IP headers allows the kernel to
skip this atomic IP ID assignment (as DF packets can use a constant or
zero ID), reducing contention and improving scalability under high load.
- Testing:
```
for((i=0;i<64;i++)); do
taskset -c $i sockperf tp -i 200.16.10.2 -t 100 --udp-dont-frag
done
```
- perf top without udp-dont-frag
56.56% [kernel] [k] ip_idents_reserve
5.98% [kernel] [k] __dev_xmit_skb
3.73% [kernel] [k] skb_set_owner_w
2.37% [kernel] [k] mlx5e_xmit
2.08% [kernel] [k] mlx5e_consume_skb
1.63% [kernel] [k] mlx5e_poll_tx_cq
1.43% [kernel] [k] mlx5e_handle_tx_dim
1.28% [kernel] [k] sock_wfree
1.12% [kernel] [k] __slab_free
0.64% [kernel] [k] build_detached_freelist
0.61% [kernel] [k] fib_table_lookup
0.59% sockperf [.] client_handler<IoRecvfrom, SwitchOff, PongModeNever>
0.57% [kernel] [k] pfifo_fast_dequeue
0.51% [kernel] [k] udp_sendmsg
0.50% libpthread-2.32.so [.] __libc_sendto
0.50% [kernel] [k] __ip_append_data
- Without this option:
05:23:49 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
05:23:50 PM lo 22.00 22.00 8.61 8.61 0.00 0.00 0.00 0.00
05:23:50 PM eth0 2.00 7958649.00 0.20 466327.09 0.00 0.00 1.00 1.91
05:23:50 PM eth1 1.00 6588679.00 0.12 386055.41 0.00 0.00 1.00 1.58
05:23:50 PM bond0 3.00 14547313.00 0.32 852381.62 0.00 0.00 2.00 1.75
- With this option:
Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: eth0 1.00 12339901.50 0.10 723041.10 0.00 0.00 0.50 2.96
Average: eth1 1.00 13850533.00 0.10 811554.67 0.00 0.00 0.50 3.32
Average: bond0 2.00 26190604.50 0.20 1534605.73 0.00 0.00 1.00 3.14
Signed-off-by: Dust Li <dust.li@linux.alibaba.com>
|
Can one of the admins verify this patch? |
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When measuring maximum packets-per-second (PPS) on Linux using multiple sockperf processes to stress UDP throughput, the kernel’s per-packet atomic operation for generating IP ID becomes a bottleneck.
Setting the Don’t Fragment (DF) bit in IP headers allows the kernel to skip this atomic IP ID assignment (as DF packets can use a constant or zero ID), reducing contention and improving scalability under high load.
perf top without udp-dont-frag
56.56% [kernel] [k] ip_idents_reserve
5.98% [kernel] [k] __dev_xmit_skb
3.73% [kernel] [k] skb_set_owner_w
2.37% [kernel] [k] mlx5e_xmit
2.08% [kernel] [k] mlx5e_consume_skb
1.63% [kernel] [k] mlx5e_poll_tx_cq
1.43% [kernel] [k] mlx5e_handle_tx_dim
1.28% [kernel] [k] sock_wfree
1.12% [kernel] [k] __slab_free
0.64% [kernel] [k] build_detached_freelist
0.61% [kernel] [k] fib_table_lookup
0.59% sockperf [.] client_handler<IoRecvfrom, SwitchOff, PongModeNever>
0.57% [kernel] [k] pfifo_fast_dequeue
0.51% [kernel] [k] udp_sendmsg
0.50% libpthread-2.32.so [.] __libc_sendto
0.50% [kernel] [k] __ip_append_data
Without this option:
05:23:49 PM IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
05:23:50 PM lo 22.00 22.00 8.61 8.61 0.00 0.00 0.00 0.00
05:23:50 PM eth0 2.00 7958649.00 0.20 466327.09 0.00 0.00 1.00 1.91
05:23:50 PM eth1 1.00 6588679.00 0.12 386055.41 0.00 0.00 1.00 1.58
05:23:50 PM bond0 3.00 14547313.00 0.32 852381.62 0.00 0.00 2.00 1.75
With this option:
Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Average: eth0 1.00 12339901.50 0.10 723041.10 0.00 0.00 0.50 2.96
Average: eth1 1.00 13850533.00 0.10 811554.67 0.00 0.00 0.50 3.32
Average: bond0 2.00 26190604.50 0.20 1534605.73 0.00 0.00 1.00 3.14