cifs: deal with the channel loading lag while picking channels
authorShyam Prasad N <sprasad@microsoft.com>
Mon, 2 Jun 2025 17:07:12 +0000 (22:37 +0530)
committerSteve French <stfrench@microsoft.com>
Tue, 3 Jun 2025 23:42:47 +0000 (18:42 -0500)
commit66d590b828b1fd9fa337047ae58fe1c4c6f43609
treea65749c450a56ac63a5a20b27a4828e389f42253
parentcc55f65dd352bdb7bdf8db1c36fb348c294c3b66
cifs: deal with the channel loading lag while picking channels

Our current approach to select a channel for sending requests is this:
1. iterate all channels to find the min and max queue depth
2. if min and max are not the same, pick the channel with min depth
3. if min and max are same, round robin, as all channels are equally loaded

The problem with this approach is that there's a lag between selecting
a channel and sending the request (that increases the queue depth on the channel).
While these numbers will eventually catch up, there could be a skew in the
channel usage, depending on the application's I/O parallelism and the server's
speed of handling requests.

With sufficient parallelism, this lag can artificially increase the queue depth,
thereby impacting the performance negatively.

This change will change the step 1 above to start the iteration from the last
selected channel. This is to reduce the skew in channel usage even in the presence
of this lag.

Fixes: ea90708d3cf3 ("cifs: use the least loaded channel for sending requests")
Cc: <stable@vger.kernel.org>
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/transport.c