Commit 7c71a0a
committed
io_uring/net: improve recv bundles
Current recv bundles are only supported for multishot receives, and
additionally they also always post at least 2 CQEs if more data is
available than what a buffer will hold. This happens because the initial
bundle recv will do a single buffer, and then do the rest of what is in
the socket as a followup receive. As shown in a test program, if 1k
buffers are available and 32k is available to receive in the socket,
you'd get the following completions:
bundle=1, mshot=0
cqe res 1024
cqe res 1024
[...]
cqe res 1024
bundle=1, mshot=1
cqe res 1024
cqe res 31744
where bundle=1 && mshot=0 will post 32 1k completions, and bundle=1 &&
mshot=1 will post a 1k completion and then a 31k completion.
To support bundle recv without multishot, it's possible to simply retry
the recv immediately and post a single completion, rather than split it
into two completions. With the below patch, the same test looks as
follows:
bundle=1, mshot=0
cqe res 32768
bundle=1, mshot=1
cqe res 32768
where mshot=0 works fine for bundles, and both of them post just a
single 32k completion rather than split it into separate completions.
Posting fewer completions is always a nice win, and not needing
multishot for proper bundle efficiency is nice for cases that can't
necessarily use multishot.
Reported-by: Norman Maurer <norman_maurer@apple.com>
Link: https://lore.kernel.org/r/184f9f92-a682-4205-a15d-89e18f664502@kernel.dk
Fixes: 2f9c951 ("io_uring/net: support bundles for recv")
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 932de5e commit 7c71a0a
1 file changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| 191 | + | |
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
| |||
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
| 407 | + | |
405 | 408 | | |
406 | 409 | | |
407 | 410 | | |
| |||
785 | 788 | | |
786 | 789 | | |
787 | 790 | | |
| 791 | + | |
788 | 792 | | |
789 | 793 | | |
790 | 794 | | |
| |||
833 | 837 | | |
834 | 838 | | |
835 | 839 | | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
836 | 843 | | |
837 | 844 | | |
838 | 845 | | |
| |||
852 | 859 | | |
853 | 860 | | |
854 | 861 | | |
| 862 | + | |
| 863 | + | |
855 | 864 | | |
856 | 865 | | |
857 | 866 | | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
858 | 875 | | |
859 | 876 | | |
860 | 877 | | |
| |||
1233 | 1250 | | |
1234 | 1251 | | |
1235 | 1252 | | |
| 1253 | + | |
1236 | 1254 | | |
1237 | 1255 | | |
1238 | 1256 | | |
| |||
0 commit comments