[前][次][番号順一覧][スレッド一覧]

ruby-changes:51978

From: normal <ko1@a...>
Date: Sun, 5 Aug 2018 17:56:58 +0900 (JST)
Subject: [ruby-changes:51978] normal:r64193 (trunk): thread_pthread.c (native_sleep): reduce ppoll sleeps

normal	2018-08-05 17:56:52 +0900 (Sun, 05 Aug 2018)

  New Revision: 64193

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64193

  Log:
    thread_pthread.c (native_sleep): reduce ppoll sleeps
    
    By holding into sigwait_fd until after we acquire GVL, we can
    hit the faster native_cond_sleep path instead of ppoll when
    another thread wants to start sleeping.  ppoll-ing on sigwait_fd
    isn't really useful in program where GVL is contended
    
    This also allows reducing vm->gvl.lock mutex contention on
    waitpid sleep migrations.
    
                             r64170        this patch
    vm_thread_condvar1        0.921        1.356

  Modified files:
    trunk/thread_pthread.c
Index: thread_pthread.c
===================================================================
--- thread_pthread.c	(revision 64192)
+++ thread_pthread.c	(revision 64193)
@@ -1716,9 +1716,9 @@ native_sleep(rb_thread_t *th, struct tim https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L1716
             check_signals_nogvl(th, sigwait_fd);
         }
         unblock_function_clear(th);
+        GVL_UNLOCK_END(th);
         rb_sigwait_fd_put(th, sigwait_fd);
         rb_sigwait_fd_migrate(th->vm);
-        GVL_UNLOCK_END(th);
     }
     else {
         native_cond_sleep(th, timeout_rel);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]