sched: remove branch hints within context_switch()
PATCH 1/1 sched: remove branch hints within context_switch()
From: Heiko Carstens <[email protected]>
With 710390d9 "sched: Optimize branch hint in context_switch()" the branch hint logic within context_switch() got inversed.
In fact the hints "if (likely(!mm))" and "if (likely(!prev->mm))" mean that it is likely that the previous and next task are kernel threads. That assumption is certainly counter intuitive, but Tim has shown that at least with his workload this is true.
Nevertheless the truth is: it depends on the current workload. So just remove the annotations which also improves readability.
--- kernel/sched.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/sched.c +2 -2
@@ -2852,14 +2852,14 @@ context_switch(struct rq *rq, struct task_struct *prev,*/ arch_start_context_switch (prev); -if (likely (!mm)) { +if (!mm) { next->active_mm = oldmm;atomic_inc (&oldmm->mm_count);enter_lazy_tlb (oldmm, next); }else switch_mm (oldmm, mm, next); -if (likely (!prev->mm)) { +if (!prev->mm) { prev->active_mm =NULL ; rq->prev_mm = oldmm; }
[tip:sched/core] sched: Remove branch hints within context_switch()
Commit-ID: 31915ab4cbf507aadab40847cf9989da5e88b090 Gitweb: http://git.kernel.org/tip/31915ab4cbf507aadab40847cf9989da5e88b090 Author: Heiko Carstens <[email protected]> AuthorDate: Thu, 16 Sep 2010 14:42:25 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Thu, 16 Sep 2010 16:38:34 +0200
sched: Remove branch hints within context_switch()
With 710390d9 "sched: Optimize branch hint in context_switch()" the branch hint logic within context_switch() got inversed.
In fact the hints "if (likely(!mm))" and "if (likely(!prev->mm))" mean that it is likely that the previous and next task are kernel threads.
That assumption is certainly counter intuitive, but Tim has shown that at least with his workload this is true. Nevertheless the truth is: it depends on the current workload. So just remove the annotations which also improves readability.
LKML-Reference: <[email protected]>
--- kernel/sched.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
kernel/sched.c +2 -2
@@ -2845,14 +2845,14 @@ context_switch(struct rq *rq, struct task_struct *prev,*/ arch_start_context_switch (prev); -if (likely (!mm)) { +if (!mm) { next->active_mm = oldmm;atomic_inc (&oldmm->mm_count);enter_lazy_tlb (oldmm, next); }else switch_mm (oldmm, mm, next); -if (likely (!prev->mm)) { +if (!prev->mm) { prev->active_mm =NULL ; rq->prev_mm = oldmm; }