aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJeff Layton <jlayton@primarydata.com>2014-11-19 07:51:21 -0500
committerJ. Bruce Fields <bfields@redhat.com>2014-12-09 11:22:21 -0500
commitceff739c53a1734d820d013d7d98f932994674d2 (patch)
tree5e7989100d2fdf4e9793f8c0f151c49100dbecbf /net
parent4d5db3f536ae3886ac86877742e6f8ce69a5de06 (diff)
sunrpc: have svc_wake_up only deal with pool 0
The way that svc_wake_up works is a bit inefficient. It walks all of the available pools for a service and either wakes up a task in each one or sets the SP_TASK_PENDING flag in each one. When svc_wake_up is called, there is no need to wake up more than one thread to do this work. In practice, only lockd currently uses this function and it's single threaded anyway. Thus, this just boils down to doing a wake up of a thread in pool 0 or setting a single flag. Eliminate the for loop in this function and change it to just operate on pool 0. Also update the comments that sit above it and get rid of some code that has been commented out for years now. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/svc_xprt.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 37446046f4bf..b2676e597fc4 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -484,34 +484,29 @@ static void svc_xprt_release(struct svc_rqst *rqstp)
484} 484}
485 485
486/* 486/*
487 * External function to wake up a server waiting for data 487 * Some svc_serv's will have occasional work to do, even when a xprt is not
488 * This really only makes sense for services like lockd 488 * waiting to be serviced. This function is there to "kick" a task in one of
489 * which have exactly one thread anyway. 489 * those services so that it can wake up and do that work. Note that we only
490 * bother with pool 0 as we don't need to wake up more than one thread for
491 * this purpose.
490 */ 492 */
491void svc_wake_up(struct svc_serv *serv) 493void svc_wake_up(struct svc_serv *serv)
492{ 494{
493 struct svc_rqst *rqstp; 495 struct svc_rqst *rqstp;
494 unsigned int i;
495 struct svc_pool *pool; 496 struct svc_pool *pool;
496 497
497 for (i = 0; i < serv->sv_nrpools; i++) { 498 pool = &serv->sv_pools[0];
498 pool = &serv->sv_pools[i];
499 499
500 spin_lock_bh(&pool->sp_lock); 500 spin_lock_bh(&pool->sp_lock);
501 if (!list_empty(&pool->sp_threads)) { 501 if (!list_empty(&pool->sp_threads)) {
502 rqstp = list_entry(pool->sp_threads.next, 502 rqstp = list_entry(pool->sp_threads.next,
503 struct svc_rqst, 503 struct svc_rqst,
504 rq_list); 504 rq_list);
505 dprintk("svc: daemon %p woken up.\n", rqstp); 505 dprintk("svc: daemon %p woken up.\n", rqstp);
506 /* 506 wake_up_process(rqstp->rq_task);
507 svc_thread_dequeue(pool, rqstp); 507 } else
508 rqstp->rq_xprt = NULL; 508 set_bit(SP_TASK_PENDING, &pool->sp_flags);
509 */ 509 spin_unlock_bh(&pool->sp_lock);
510 wake_up_process(rqstp->rq_task);
511 } else
512 set_bit(SP_TASK_PENDING, &pool->sp_flags);
513 spin_unlock_bh(&pool->sp_lock);
514 }
515} 510}
516EXPORT_SYMBOL_GPL(svc_wake_up); 511EXPORT_SYMBOL_GPL(svc_wake_up);
517 512