From 6f9f4d37230b644062147da4e97a0a2226c88b60 Mon Sep 17 00:00:00 2001 From: Evgeniy Kochetov Date: Mon, 8 Jul 2024 10:55:45 +0300 Subject: [PATCH] lib/jsonrpc: Return busy poller state if there are oustanding requests RPC poller switches to active polling mode when something is received or sent on RPC socket. Active polling dureation is 4ms. After that RPC poller switches back to timed ppoller mode with 4ms interval. If RPC is asynchronous and its execution time is longer than 4ms, the response will be delayed because it will be sent out only on the next RPC poller cycle. When we have outstanding requests we expect to have response soon. Reporting busy from jsonrpc server in this case helps to keep RPC poller in active polling mode and avoid response delay. Signed-off-by: Evgeniy Kochetov --- lib/jsonrpc/jsonrpc_server_tcp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/jsonrpc/jsonrpc_server_tcp.c b/lib/jsonrpc/jsonrpc_server_tcp.c index 3aa450b879e..02d40ae924c 100644 --- a/lib/jsonrpc/jsonrpc_server_tcp.c +++ b/lib/jsonrpc/jsonrpc_server_tcp.c @@ -450,6 +450,10 @@ spdk_jsonrpc_server_poll(struct spdk_jsonrpc_server *server) } else if (rc > 0) { busy = 1; } + + if (!STAILQ_EMPTY(&conn->outstanding_queue)) { + busy = 1; + } } }