net/udp: Change conn->readahead to I/O buffer chain

When using IOB queue to store readahead data, we use one IOB for each
UDP packet. Then if the packets are very small, like 10Bytes per packet,
we'll use ~1600 IOBs just for 16KB recv buffer size, which is wasteful
and dangerous. So change conn->readahead to a single IOB chain like TCP.

Benefits:
- Using memory and IOBs more efficiently (small packets are common in
  UDP)

Side effects:
- UDP recv buffer size may count the overhead
- A little bit drop in performance (<1%, more seek & copy)

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng
2023-07-04 13:24:51 +08:00
committed by Xiang Xiao
parent 4b7604cf81
commit 075eb6a6d2
9 changed files with 115 additions and 62 deletions
+1 -1
View File
@@ -76,7 +76,7 @@ int udp_readahead_notifier_setup(worker_t worker,
* setting up the notification.
*/
if (conn->readahead.qh_head != NULL)
if (conn->readahead != NULL)
{
return 0;
}