rx: Set listener pthread name 00/13600/3
authorAndrew Deason <adeason@sinenomine.net>
Sat, 8 Dec 2018 21:08:26 +0000 (15:08 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 28 Jun 2019 15:44:05 +0000 (11:44 -0400)
When running under pthreads, set the name of the rx listener thread to
"rx_Listener". This can be handy when investigating rx performance
issues, since it makes it easier to identify which thread in the rx
listener.

Don't do this for "hot threads", since in that case we could return
and stop being a listener thread. We could restore the original thread
name, but doing so could have an impact on performance and "hot
threads" should always be disabled these days, so don't bother.

Change-Id: I24aebd4d7e4266cd06bb1a4314949d85835dfbaa
Reviewed-on: https://gerrit.openafs.org/13600
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/rx/rx_pthread.c

index ba824b7..388bca8 100644 (file)
@@ -208,6 +208,12 @@ rxi_ListenerProc(osi_socket sock, int *tnop, struct rx_call **newcallp)
     u_short port;
     struct rx_packet *p = (struct rx_packet *)0;
 
+    if (!(rx_enable_hot_thread && newcallp)) {
+       /* Don't do this for hot threads, since we might stop being the
+        * listener. */
+       opr_threadname_set("rx_Listener");
+    }
+
     MUTEX_ENTER(&listener_mutex);
     while (!listeners_started) {
        CV_WAIT(&rx_listener_cond, &listener_mutex);