@@ -266,28 +266,15 @@ enum {
RQ_DATA, /* request has data */
};
-/**
- * svc_thread_set_busy - mark a thread as busy
- * @rqstp: the thread which is now busy
- *
- * By convention a thread is busy if rq_idle.next points to rq_idle.
- * This will never be the case for threads on the idle list.
- */
-static inline void svc_thread_set_busy(struct svc_rqst *rqstp)
-{
- rqstp->rq_idle.next = &rqstp->rq_idle;
-}
-
/**
* svc_thread_busy - check if a thread as busy
* @rqstp: the thread which might be busy
*
- * By convention a thread is busy if rq_idle.next points to rq_idle.
- * This will never be the case for threads on the idle list.
+ * A thread is only busy when it is not an the idle list.
*/
static inline bool svc_thread_busy(const struct svc_rqst *rqstp)
{
- return rqstp->rq_idle.next == &rqstp->rq_idle;
+ return !llist_on_list(&rqstp->rq_idle);
}
#define SVC_NET(rqst) (rqst->rq_xprt ? rqst->rq_xprt->xpt_net : rqst->rq_bc_net)
@@ -642,7 +642,7 @@ svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node)
folio_batch_init(&rqstp->rq_fbatch);
- svc_thread_set_busy(rqstp);
+ init_llist_node(&rqstp->rq_idle);
rqstp->rq_server = serv;
rqstp->rq_pool = pool;
@@ -705,11 +705,10 @@ void svc_pool_wake_idle_thread(struct svc_pool *pool)
rcu_read_lock();
spin_lock_bh(&pool->sp_lock);
- ln = llist_del_first(&pool->sp_idle_threads);
+ ln = llist_del_first_init(&pool->sp_idle_threads);
spin_unlock_bh(&pool->sp_lock);
if (ln) {
rqstp = llist_entry(ln, struct svc_rqst, rq_idle);
- svc_thread_set_busy(rqstp);
WRITE_ONCE(rqstp->rq_qtime, ktime_get());
wake_up_process(rqstp->rq_task);
Use init_llist_node, llist_on_list etc for checking if a node is on a llist. Discard svc_thread_set_busy() completely and simplify svc_thread_busy() This can only be squashed if the patch to llist is moved earlier in the topic. Signed-off-by: NeilBrown <neilb@suse.de> --- include/linux/sunrpc/svc.h | 17 ++--------------- net/sunrpc/svc.c | 5 ++--- 2 files changed, 4 insertions(+), 18 deletions(-)