mirror of
https://github.com/versity/scoutfs.git
synced 2026-01-10 13:47:27 +00:00
The net layer was initially built around send queue lists with the presumption that there wouldn't be many messages in flight and that responses would be sent roughly in order. Then many years passed. In the modern era, we can have 10s of thousands of lock request messages in flight. This lead to o(n^2) processing in quite a few places as recv processing searched for either requests to complete or responses to free. This adds messages to two rbtrees, indexing either requests by their id or responses by their send sequence. Recv processing can find messages in o(log n). Then we add a specific list that the send worker uses to free dead messages, rather than abusing the send queue. It doesn't make a huge functional difference but it's less messy and only costs the list_head per message. The end result is that, on a single node, with ~40k lock shrink attempts in flight, we go from processing ~800 total request/grant request/response pairs per second to ~60,000 per second. Signed-off-by: Zach Brown <zab@versity.com>