* [PATCH 0/4] [GIT PULL] sched: Remove unlikely likelys
@ 2010-12-14 1:28 Steven Rostedt
2010-12-14 1:28 ` [PATCH 1/4] sched: Cleanup pre_schedule_rt Steven Rostedt
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Steven Rostedt @ 2010-12-14 1:28 UTC (permalink / raw)
To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Peter Zijlstra, Gregory Haskins
Ingo,
Please pull the latest unlikely/sched tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
unlikely/sched
Steven Rostedt (3):
sched: Change pick_next_task_rt from unlikely to likely
sched: Remove unlikely() from rt_policy() in sched.c
sched: Remove unlikely() from ttwu_post_activation
Yong Zhang (1):
sched: Cleanup pre_schedule_rt
----
kernel/sched.c | 4 ++--
kernel/sched_rt.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] sched: Cleanup pre_schedule_rt
2010-12-14 1:28 [PATCH 0/4] [GIT PULL] sched: Remove unlikely likelys Steven Rostedt
@ 2010-12-14 1:28 ` Steven Rostedt
2010-12-14 1:28 ` [PATCH 2/4] sched: Change pick_next_task_rt from unlikely to likely Steven Rostedt
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2010-12-14 1:28 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Peter Zijlstra, Gregory Haskins,
Yong Zhang, Rusty Russell
[-- Attachment #1: 0001-sched-Cleanup-pre_schedule_rt.patch --]
[-- Type: text/plain, Size: 1036 bytes --]
From: Yong Zhang <yong.zhang0@gmail.com>
Since [commit 9a897c5a:
sched: RT-balance, replace hooks with pre/post schedule and wakeup methods]
we must call pre_schedule_rt if prev is rt task.
So condition rt_task(prev) is always true and the 'unlikely' declaration is
simply incorrect.
Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/sched_rt.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index bea7d79..1ab66a2 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1474,7 +1474,7 @@ skip:
static void pre_schedule_rt(struct rq *rq, struct task_struct *prev)
{
/* Try to pull RT tasks here if we lower this rq's prio */
- if (unlikely(rt_task(prev)) && rq->rt.highest_prio.curr > prev->prio)
+ if (rq->rt.highest_prio.curr > prev->prio)
pull_rt_task(rq);
}
--
1.7.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] sched: Change pick_next_task_rt from unlikely to likely
2010-12-14 1:28 [PATCH 0/4] [GIT PULL] sched: Remove unlikely likelys Steven Rostedt
2010-12-14 1:28 ` [PATCH 1/4] sched: Cleanup pre_schedule_rt Steven Rostedt
@ 2010-12-14 1:28 ` Steven Rostedt
2010-12-14 1:28 ` [PATCH 3/4] sched: Remove unlikely() from rt_policy() in sched.c Steven Rostedt
2010-12-14 1:28 ` [PATCH 4/4] sched: Remove unlikely() from ttwu_post_activation Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2010-12-14 1:28 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Peter Zijlstra, Gregory Haskins,
Peter Zijlstra
[-- Attachment #1: 0002-sched-Change-pick_next_task_rt-from-unlikely-to-like.patch --]
[-- Type: text/plain, Size: 1430 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The if (unlikely(!rt_rq->rt_nr_running)) test in pick_next_task_rt()
tests if there is another rt task ready to run. If so, then pick it.
In most systems, only one RT task runs at a time most of the time.
Running the branch unlikely annotator profiler on a system doing average
work "running firefox, evolution, xchat, distcc builds, etc", it showed the
following:
correct incorrect % Function File Line
------- --------- - -------- ---- ----
324344 135104992 99 _pick_next_task_rt sched_rt.c 1064
99% of the time the condition is true. When an RT task schedules out,
it is unlikely that another RT task is waiting to run on that same run queue.
Simply remove the unlikely() condition.
Acked-by: Gregory Haskins <ghaskins@novell.com>
Cc:Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/sched_rt.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 1ab66a2..c2266c4 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1062,7 +1062,7 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq)
rt_rq = &rq->rt;
- if (unlikely(!rt_rq->rt_nr_running))
+ if (!rt_rq->rt_nr_running)
return NULL;
if (rt_rq_throttled(rt_rq))
--
1.7.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] sched: Remove unlikely() from rt_policy() in sched.c
2010-12-14 1:28 [PATCH 0/4] [GIT PULL] sched: Remove unlikely likelys Steven Rostedt
2010-12-14 1:28 ` [PATCH 1/4] sched: Cleanup pre_schedule_rt Steven Rostedt
2010-12-14 1:28 ` [PATCH 2/4] sched: Change pick_next_task_rt from unlikely to likely Steven Rostedt
@ 2010-12-14 1:28 ` Steven Rostedt
2010-12-14 1:28 ` [PATCH 4/4] sched: Remove unlikely() from ttwu_post_activation Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2010-12-14 1:28 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Peter Zijlstra, Gregory Haskins,
Peter Zijlstra
[-- Attachment #1: 0003-sched-Remove-unlikely-from-rt_policy-in-sched.c.patch --]
[-- Type: text/plain, Size: 1331 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
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 | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index dc91a4d..269a045 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -123,7 +123,7 @@
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;
}
--
1.7.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] sched: Remove unlikely() from ttwu_post_activation
2010-12-14 1:28 [PATCH 0/4] [GIT PULL] sched: Remove unlikely likelys Steven Rostedt
` (2 preceding siblings ...)
2010-12-14 1:28 ` [PATCH 3/4] sched: Remove unlikely() from rt_policy() in sched.c Steven Rostedt
@ 2010-12-14 1:28 ` Steven Rostedt
3 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2010-12-14 1:28 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Peter Zijlstra, Gregory Haskins,
Peter Zijlstra
[-- Attachment #1: 0004-sched-Remove-unlikely-from-ttwu_post_activation.patch --]
[-- Type: text/plain, Size: 1396 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
The unlikely() used in ttwu_post_activation() tests if the rq->idle_stamp
is set. But since this is for a wakeup, and wakeups happen when tasks
block on IO, and blocking tasks on IO may put the system into idle,
this can actually be a common occurence.
Running the annotated branch profiler on an average desktop running
firefox, evolution, xchat and distcc, the report shows:
correct incorrect % Function File Line
------- --------- - -------- ---- ----
34884862 146110926 80 ttwu_post_activation sched.c 2309
80% of the time, this unlikely is incorrect. Best not to assume what the
result is, and just remove the branch annotation.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/sched.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/kernel/sched.c b/kernel/sched.c
index 269a045..6d24b2e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2458,7 +2458,7 @@ static inline void ttwu_post_activation(struct task_struct *p, struct rq *rq,
if (p->sched_class->task_woken)
p->sched_class->task_woken(rq, p);
- if (unlikely(rq->idle_stamp)) {
+ if (rq->idle_stamp) {
u64 delta = rq->clock - rq->idle_stamp;
u64 max = 2*sysctl_sched_migration_cost;
--
1.7.2.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-12-14 1:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-14 1:28 [PATCH 0/4] [GIT PULL] sched: Remove unlikely likelys Steven Rostedt
2010-12-14 1:28 ` [PATCH 1/4] sched: Cleanup pre_schedule_rt Steven Rostedt
2010-12-14 1:28 ` [PATCH 2/4] sched: Change pick_next_task_rt from unlikely to likely Steven Rostedt
2010-12-14 1:28 ` [PATCH 3/4] sched: Remove unlikely() from rt_policy() in sched.c Steven Rostedt
2010-12-14 1:28 ` [PATCH 4/4] sched: Remove unlikely() from ttwu_post_activation Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox