sched: Remove unlikely() from rt_policy() in sched.c
authorSteven Rostedt <srostedt@redhat.com>
Mon, 6 Dec 2010 19:48:10 +0000 (14:48 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 14 Dec 2010 00:56:40 +0000 (19:56 -0500)
The rt_policy() has an unlikely() that the policy it is checking is
of RT priority (SCHED_FIFO or SCHED_RR).

According to the annotate branch profiler it is incorrect most of the time:

 correct incorrect  %        Function                  File              Line
 ------- ---------  -        --------                  ----              ----
   36667   654674  94 rt_policy                      sched.c              126

This makes sense because the rt_policy() is used by the sched_set_scheduler()
and nice(). Although users may use sys_nice a bit, all RT users use
the sched_set_scheduler() to set their RT priority, including kernel
threads.

The above numbers were from a normal desktop computer running
firefox, evolution, xchat and was part of a distcc compile farm.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/sched.c

index dc91a4d09ac3b71a3c347187ff2a1691c952cebd..269a0450281c3b967fb2c8bbccaabc124cba3ffa 100644 (file)
 
 static inline int rt_policy(int policy)
 {
-       if (unlikely(policy == SCHED_FIFO || policy == SCHED_RR))
+       if (policy == SCHED_FIFO || policy == SCHED_RR)
                return 1;
        return 0;
 }