OSDN Git Service

SUNRPC: Add cond_resched() at the appropriate point in __rpc_execute()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 12 Jul 2021 13:57:08 +0000 (09:57 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 4 Oct 2021 00:49:05 +0000 (20:49 -0400)
Allow tasks that need to pre-empt rpciod/xprtiod to do so when it is
safe.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
net/sunrpc/sched.c

index c045f63..dc46130 100644 (file)
@@ -903,8 +903,10 @@ static void __rpc_execute(struct rpc_task *task)
                /*
                 * Lockless check for whether task is sleeping or not.
                 */
-               if (!RPC_IS_QUEUED(task))
+               if (!RPC_IS_QUEUED(task)) {
+                       cond_resched();
                        continue;
+               }
 
                /*
                 * Signalled tasks should exit rather than sleep.