[RFC][PATCH 03/10] workqueue: It is likely that WORKER_NOT_RUNNING is true

From: Steven Rostedt <srostedt@redhat.com>

Running the annotate branch profiler on three boxes, including mymain box that runs firefox, evolution, xchat, and is part of the distcc farm,showed this with the likelys in the workqueue code:

correct incorrect % Function File Line ------- --------- - -------- ---- ---- 96 996253 99 wq_worker_sleeping workqueue.c 703 96 996247 99 wq_worker_waking_up workqueue.c 677The likely()s in this case were assuming that WORKER_NOT_RUNNING willmost likely be false. But this is not the case. The reason is(and shown by adding trace_printks and testing it) that most of the timeWORKER_PREP is set.

In worker_thread() we have:

worker_clr_flags(worker, WORKER_PREP);

[ do work stuff ]

worker_set_flags(worker, WORKER_PREP, false);

(that 'false' means not to wake up an idle worker)

The wq_worker_sleeping() is called from schedule when a worker threadis putting itself to sleep. Which happens most of the time outsideof that [ do work stuff ].

The wq_worker_waking_up is called by the wakeup worker code, whichis also callod outside that [ do work stuff ].

Thus, the likely and unlikely used by those two functions are actuallybackwards.