Skip to content

Commit 86aeee0

Browse files
author
Trond Myklebust
committed
SUNRPC: Enqueue swapper tagged RPCs at the head of the transmit queue
Avoid memory starvation by giving RPCs that are tagged with the RPC_TASK_SWAPPER flag the highest priority. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 75891f5 commit 86aeee0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

net/sunrpc/xprt.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1112,6 +1112,17 @@ xprt_request_enqueue_transmit(struct rpc_task *task)
11121112
INIT_LIST_HEAD(&req->rq_xmit2);
11131113
goto out;
11141114
}
1115+
} else if (RPC_IS_SWAPPER(task)) {
1116+
list_for_each_entry(pos, &xprt->xmit_queue, rq_xmit) {
1117+
if (pos->rq_cong || pos->rq_bytes_sent)
1118+
continue;
1119+
if (RPC_IS_SWAPPER(pos->rq_task))
1120+
continue;
1121+
/* Note: req is added _before_ pos */
1122+
list_add_tail(&req->rq_xmit, &pos->rq_xmit);
1123+
INIT_LIST_HEAD(&req->rq_xmit2);
1124+
goto out;
1125+
}
11151126
} else {
11161127
list_for_each_entry(pos, &xprt->xmit_queue, rq_xmit) {
11171128
if (pos->rq_task->tk_owner != task->tk_owner)

0 commit comments

Comments
 (0)