When running with nbthread=1, we still try to redistribute once, it
fails (new_tid=tid) and leaves the loop. That's just a waste for no
reason. Let's condition the redispatch to the presence of at least
another thread.
* If it's a shared task, see whether we should hand it
* to a less loaded thread.
*/
- if (task->tid < 0) {
+ if (unlikely(task->tid < 0) && global.nbthread > 1) {
int attempts = MIN(global.nbthread, 3);
while (attempts-- > 0) {
uint new_tid = statistical_prng_range(global.nbthread);