Linux 7.1 将淘汰 UDP-Lite – 以清理后的代码实现更好的性能。
Linux 7.1 to Retire UDP-Lite – Allows for Better Performance with Cleansed Code

原始链接: https://www.phoronix.com/news/Linux-7.1-Retiring-UDP-Lite

Linux 7.1 内核将移除对 UDP-Lite 的支持,该协议允许传递可能损坏的数据包,历经近 20 年。UDP-Lite 最初于 Linux 2.6.20 中引入,但一直鲜有使用,并存在持续的错误,包括 2023 年发现的一个空指针引用,该错误长达七年未被发现。 亚马逊/AWS 开发者岩岛邦行发起了移除工作,理由是 2023 年弃用通知后没有用户投诉,并且有可能提高性能。从核心网络堆栈中移除 UDP-Lite 的条件代码可以提高标准 UDP 流量的性能——测试表明每秒数据包数量增加了 3-10%。 该更改已合并到 net-next 中,简化了内核并专注于积极使用的协议。移除工作计划包含在 Linux 7.1 版本中。

## Linux 7.1 将移除 UDP-Lite 即将到来的 Linux 7.1 内核将移除对 UDP-Lite 的支持,该功能多年来未得到实际应用。预计此次清理将提高其他 UDP 应用程序的性能,可能将数据包处理速度提高 3-10%。 虽然移除已弃用的代码是维护性的常见做法,但在此情况下性能提升是显著的。Hacker News 上的讨论强调了识别内核中真正未使用的代码的挑战——追踪实际使用情况可以发现更多简化和优化的机会。源代码变更可在 Git 上找到。
相关文章

原文
The upcoming Linux 7.1 kernel cycle is set to retire UDP-Lite support. The UDP-Lite protocol allowed for partial checksums where potentially damaged/corrupted packets are still delivered to the application. Since the Linux 2.6.20 days there has been UDP-Lite support but the kernel is now set to retire it given breakage that has persisted for years and cleaning up the networking code can yield a performance advantage for non-UDP-Lite users.

Kuniyuki Iwashima of Amazon/AWS took to retiring the UDP-Lite code. He explained of the issues that went unchecked for years and the performance benefit to removing UDP-Lite from the kernel:

"In 2023, syzbot found a null-ptr-deref bug triggered when UDP-Lite attempted to charge an skb after the total memory usage for UDP-Lite _and_ UDP exceeded a system-wide threshold, net.ipv4.udp_mem.

Since this threshold is shared with UDP, the bug would have been easy to trigger if any real-world applications were using UDP-Lite; however, only syzbot ever stumbled upon it.

The bug had persisted since 2016, suggesting that UDP-Lite had remained unused for 7 years at that point.

The bug was fixed in commit ad42a35bdfc6 ("udplite: Fix NULL pointer dereference in __sk_mem_raise_allocated()."), and we added another commit be28c14ac8bb ("udplite: Print deprecation notice.") to announce the deprecation plan.

Since then, no one has complained, so it is time to officially retire UDP-Lite.

This series first removes IPv6 and IPv4 UDP-Lite sockets, then gradually cleans up the remaining dead/unnecessary code within the UDP stack.

By removing a bunch of conditionals for UDP-Lite from the fast path, udp_rr with 20,000 flows sees a 10% increase in pps (13.3 Mpps -> 14.7 Mpps) on an AMD EPYC 7B12 (Zen 2) 64-Core Processor platform.

[ With FDO, the baseline is much higher and the delta was ~3%, 20.1 Mpps -> 20.7 Mpps ]"


So per that messaging, the UDP-Lite code really hasn't been used in years and doing away with it can net some measurable (+3~10% packets per second) for other UDP workloads.

It was back in 2023 that a deprecation notice was put in place for UDP-Lite calling for its removal in 2025. With no complaints and now into 2026 (and past the Linux 6.18 LTS of 2025), it's time for removal.

Linux retiring UDP-Lite


This merge now in net-next is retiring UDP-Lite with the plan to merge it for Linux 7.1.
联系我们 contact @ memedata.com