Skip to content

Commit 918f3c1

Browse files
author
Trond Myklebust
committed
SUNRPC: Improve latency for interactive tasks
One of the intentions with the priority queues was to ensure that no single process can hog the transport. The field task->tk_owner therefore identifies the RPC call's origin, and is intended to allow the RPC layer to organise queues for fairness. This commit therefore modifies the transmit queue to group requests by task->tk_owner, and ensures that we round robin among those groups. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent dcbbeda commit 918f3c1

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

include/linux/sunrpc/xprt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ struct rpc_rqst {
8989
};
9090

9191
struct list_head rq_xmit; /* Send queue */
92+
struct list_head rq_xmit2; /* Send queue */
9293

9394
void *rq_buffer; /* Call XDR encode buffer */
9495
size_t rq_callsize;

net/sunrpc/xprt.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,12 +1053,21 @@ xprt_request_need_enqueue_transmit(struct rpc_task *task, struct rpc_rqst *req)
10531053
void
10541054
xprt_request_enqueue_transmit(struct rpc_task *task)
10551055
{
1056-
struct rpc_rqst *req = task->tk_rqstp;
1056+
struct rpc_rqst *pos, *req = task->tk_rqstp;
10571057
struct rpc_xprt *xprt = req->rq_xprt;
10581058

10591059
if (xprt_request_need_enqueue_transmit(task, req)) {
10601060
spin_lock(&xprt->queue_lock);
1061+
list_for_each_entry(pos, &xprt->xmit_queue, rq_xmit) {
1062+
if (pos->rq_task->tk_owner != task->tk_owner)
1063+
continue;
1064+
list_add_tail(&req->rq_xmit2, &pos->rq_xmit2);
1065+
INIT_LIST_HEAD(&req->rq_xmit);
1066+
goto out;
1067+
}
10611068
list_add_tail(&req->rq_xmit, &xprt->xmit_queue);
1069+
INIT_LIST_HEAD(&req->rq_xmit2);
1070+
out:
10621071
set_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate);
10631072
spin_unlock(&xprt->queue_lock);
10641073
}
@@ -1074,8 +1083,20 @@ xprt_request_enqueue_transmit(struct rpc_task *task)
10741083
static void
10751084
xprt_request_dequeue_transmit_locked(struct rpc_task *task)
10761085
{
1077-
if (test_and_clear_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate))
1078-
list_del(&task->tk_rqstp->rq_xmit);
1086+
struct rpc_rqst *req = task->tk_rqstp;
1087+
1088+
if (!test_and_clear_bit(RPC_TASK_NEED_XMIT, &task->tk_runstate))
1089+
return;
1090+
if (!list_empty(&req->rq_xmit)) {
1091+
list_del(&req->rq_xmit);
1092+
if (!list_empty(&req->rq_xmit2)) {
1093+
struct rpc_rqst *next = list_first_entry(&req->rq_xmit2,
1094+
struct rpc_rqst, rq_xmit2);
1095+
list_del(&req->rq_xmit2);
1096+
list_add_tail(&next->rq_xmit, &next->rq_xprt->xmit_queue);
1097+
}
1098+
} else
1099+
list_del(&req->rq_xmit2);
10791100
}
10801101

10811102
/**

0 commit comments

Comments
 (0)