axboe / liburing

Library providing helpers for the Linux kernel io_uring support
MIT License
2.83k stars 402 forks source link

Dynamic pickup of multiple provided buffers #1096

Closed pyhd closed 5 days ago

pyhd commented 6 months ago

A big buffer (i.e. 64K) must be allocated to receive a single UDP_GRO, but in many cases only a small part of it would be used, especiall for small ACK flood. My idea is to allocate a large continuous pool (e.g. 4K-aligned buffer * 128), then for each time io_uring_prep_recvmsg_multishot can pickup multiple buffers to fit a single UDP_GRO.

Secondly, as I read the mail archive, provided buffers will be supported for the send() operation, so I guess UDP_GSO could be in the same logic.

isilence commented 6 months ago

A big buffer (i.e. 64K) must be allocated to receive a single UDP_GRO, but in many cases only a small part of it would be used, especiall for small ACK flood. My idea is to allocate a large continuous pool (e.g. 4K-aligned buffer * 128), then for each time io_uring_prep_recvmsg_multishot can pickup multiple buffers to fit a single UDP_GRO.

That's what Jens was proposing in a recent patch in the mailing list, I believe

Secondly, as I read the mail archive, provided buffers will be supported for the send() operation, so I guess UDP_GSO could be in the same logic.

sends shouldn't have the problem you describe here, as you know how many bytes you're sending and so can pack them into a single request with a multi entry iov, i.e. struct msghdr :: msg_iov