title: Why is a thread's status running but it doesn't use any CPU?
body: <p>Today I found a very strange problem.
  I ran Redhat Enterprise Linux 6, and the CPU was Intel E31275 (4 cores, 8 threads). I found one kernel thread (I called it as my_thread) didn't work correctly.
  With "ps" command, I found the status of my_thread was always running:</p>
  
  <pre><code>ps ax
  5545 ?        R      3:14 [my_thread]
  15774 ttyS0    Ss     0:00 -bash
  ...
  </code></pre>
  
  <p>But its running time was always 3:14. Since it ws running, why didn't the total time increase?
  From the proc file /proc/5545/sched, I found the all statistics including wakeups count (se.nr_wakeups) for this thread was always the same, too.</p>
  
  <p>From /proc/5545/stack, I found this thread called this function and never returned:</p>
  
  <pre><code>interruptible_sleep_on_timeout(&amp;q, 3*HZ);
  </code></pre>
  
  <p>In theory this function would return every 3 seconds if no other threads woke up the thread. Each time after the function returned, se.nr_wakeups in /proc/5545/sched would be increased by 1. But this never happened after I found the thread had some problems.</p>
  
  <p>Does any one have some ideas? Is it possible that interruptible_sleep_on_timeout() never returns?</p>
  
  <p>Update:
  I find the problem won't occur if I set CPU affinity for this thread. If I pin it to a dedicated core, then everything is OK. Are there any problems with SMP scheduling?</p>
  
  <p>Update again:
  After I disalbe hyperthread in BIOS, I have not seen such a problem until now.</p>