Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mtelka authored and Dan McDonald committed Aug 8, 2014
1 parent 647f62b commit eaf32bf
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions usr/src/uts/common/rpc/svc.c
Expand Up @@ -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.
*/

/*
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit eaf32bf

Please sign in to comment.