summaryrefslogtreecommitdiffstats
path: root/sys/nfs
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-12-20 17:39:07 +0000
committermav <mav@FreeBSD.org>2013-12-20 17:39:07 +0000
commit88262ed57f27358d620b3a57a2ee02d35ca34825 (patch)
tree7a14db28a6dfb2aead074a8a7ba69d16b538926c /sys/nfs
parentee84c03232a6594416d75d955e21679f367b07f4 (diff)
downloadFreeBSD-src-88262ed57f27358d620b3a57a2ee02d35ca34825.zip
FreeBSD-src-88262ed57f27358d620b3a57a2ee02d35ca34825.tar.gz
Remove several linear list traversals per request from RPC server code.
Do not insert active ports into pool->sp_active list if they are success- fully assigned to some thread. This makes that list include only ports that really require attention, and so traversal can be reduced to simple taking the first one. Remove idle thread from pool->sp_idlethreads list when assigning some work (port of requests) to it. That again makes possible to replace list traversals with simple taking the first element.
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/nfs_fha.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/sys/nfs/nfs_fha.c b/sys/nfs/nfs_fha.c
index dd9ee27..2290804 100644
--- a/sys/nfs/nfs_fha.c
+++ b/sys/nfs/nfs_fha.c
@@ -289,19 +289,6 @@ fha_hash_entry_add_op(struct fha_hash_entry *fhe, int locktype, int count)
fhe->num_rw += count;
}
-static SVCTHREAD *
-get_idle_thread(SVCPOOL *pool)
-{
- SVCTHREAD *st;
-
- LIST_FOREACH(st, &pool->sp_idlethreads, st_ilink) {
- if (st->st_xprt == NULL && STAILQ_EMPTY(&st->st_reqs))
- return (st);
- }
- return (NULL);
-}
-
-
/*
* Get the service thread currently associated with the fhe that is
* appropriate to handle this operation.
@@ -386,7 +373,7 @@ fha_hash_entry_choose_thread(struct fha_params *softc,
ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO,
"fha: %p(%d)t", thread, thread->st_reqcount);
#endif
- } else if ((thread = get_idle_thread(pool))) {
+ } else if ((thread = LIST_FIRST(&pool->sp_idlethreads))) {
#if 0
ITRACE_CURPROC(ITRACE_NFS, ITRACE_INFO,
"fha: %p(%d)i", thread, thread->st_reqcount);
@@ -418,7 +405,6 @@ SVCTHREAD *
fha_assign(SVCTHREAD *this_thread, struct svc_req *req,
struct fha_params *softc)
{
- SVCPOOL *pool;
SVCTHREAD *thread;
struct fha_info i;
struct fha_hash_entry *fhe;
@@ -439,7 +425,6 @@ fha_assign(SVCTHREAD *this_thread, struct svc_req *req,
if (req->rq_vers != 2 && req->rq_vers != 3)
return (this_thread);
- pool = req->rq_xprt->xp_pool;
fha_extract_info(req, &i, cb);
/*
OpenPOWER on IntegriCloud