ruby-changes:51919
From: normal <ko1@a...>
Date: Tue, 31 Jul 2018 03:53:58 +0900 (JST)
Subject: [ruby-changes:51919] normal:r64133 (trunk): thread_pthread.c (gvl_yield): do ubf wakeups when uncontended
normal 2018-07-31 03:53:46 +0900 (Tue, 31 Jul 2018) New Revision: 64133 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64133 Log: thread_pthread.c (gvl_yield): do ubf wakeups when uncontended Not having contention for GVL could mean everybody else is stuck in blocking region without GVL, so we kick the ubf list in that case. I expect this to fix test_thread_fd_close timeout: http://ci.rvm.jp/results/trunk-test@ruby-sky3/1173398 Modified files: trunk/thread_pthread.c Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 64132) +++ thread_pthread.c (revision 64133) @@ -194,6 +194,12 @@ gvl_yield(rb_vm_t *vm, rb_thread_t *th) https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L194 } else { rb_native_mutex_unlock(&vm->gvl.lock); + /* + * GVL was not contended when we released, so we have no potential + * contenders for reacquisition. Perhaps they are stuck in blocking + * region w/o GVL, too, so we kick them: + */ + ubf_wakeup_all_threads(); native_thread_yield(); rb_native_mutex_lock(&vm->gvl.lock); rb_native_cond_broadcast(&vm->gvl.switch_wait_cond); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/