diff options
author | Marcel Telka <marcel.telka@nexenta.com> | 2014-08-05 20:17:05 +0200 |
---|---|---|
committer | Dan McDonald <danmcd@omniti.com> | 2014-08-07 22:06:12 -0400 |
commit | eaf32bf722e82dc74e90279e12e48f66891ef46a (patch) | |
tree | bf5212eb3bcf6a37c7f1b7cf9cab782cbd31bcad | |
parent | 647f62b3ed7123887134000e51e941611b5445ac (diff) | |
download | illumos-joyent-eaf32bf722e82dc74e90279e12e48f66891ef46a.tar.gz |
5070 svc_queueclose() could wake up too much threads
Reviewed by: Rick Mesta <rick.mesta@nexenta.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Tony Nguyen <tony.nguyen@nexenta.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Dan McDonald <danmcd@omniti.com>
-rw-r--r-- | usr/src/uts/common/rpc/svc.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/usr/src/uts/common/rpc/svc.c b/usr/src/uts/common/rpc/svc.c index 19810bc6b4..250b5984c6 100644 --- a/usr/src/uts/common/rpc/svc.c +++ b/usr/src/uts/common/rpc/svc.c @@ -24,7 +24,7 @@ * Use is subject to license terms. */ /* - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2014 Nexenta Systems, Inc. All rights reserved. */ /* @@ -2290,8 +2290,8 @@ svc_queueclean(queue_t *q) * * - clear xp_wq to mark the master server transport handle as closing * - if there are no more threads on this transport close/destroy it - * - otherwise, broadcast threads sleeping in svc_poll(); the last - * thread will close/destroy the transport. + * - otherwise, leave the linked threads to close/destroy the transport + * later. */ void svc_queueclose(queue_t *q) @@ -2337,12 +2337,17 @@ svc_queueclose(queue_t *q) mutex_exit(&pool->p_thread_lock); } else { /* - * Wakeup threads sleeping in svc_poll() so that they - * unlink from the transport + * There are still some threads linked to the transport. They + * are very likely sleeping in svc_poll(). We could wake up + * them by broadcasting on the p_req_cv condition variable, but + * that might give us a performance penalty if there are too + * many sleeping threads. + * + * Instead, we do nothing here. The linked threads will unlink + * themselves and destroy the transport once they are woken up + * on timeout, or by new request. There is no reason to hurry + * up now with the thread wake up. */ - mutex_enter(&xprt->xp_pool->p_req_lock); - cv_broadcast(&xprt->xp_pool->p_req_cv); - mutex_exit(&xprt->xp_pool->p_req_lock); /* * NOTICE: No references to the master transport structure |