Files
scoutfs/kmod
Zach Brown e82e127435 Search messages in rbtree instead of lists
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>
2026-01-08 10:58:50 -08:00
..