[PATCH 1/3] sched: check WAKEUP_PREEMPT feature before preemting anything

From: Stephan Baerwolf
Date: Wed Jul 20 2011 - 08:37:56 EST


The function "check_preempt_wakeup" (kernel/sched_fair.c:1885)
will preempt idle-task (for non-idle task), even if WAKEUP_PREEMPT
is not featured (because of a too late checking the feature).
This patches moves the checking of WAKEUP_PREEMT in front of
idle-preemtion.

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@xxxxxxxxxxxxx>
---
kernel/sched_fair.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 433491c..e092e72 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1905,6 +1905,9 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
if (test_tsk_need_resched(curr))
return;

+ if (!sched_feat(WAKEUP_PREEMPT))
+ return;
+
/* Idle tasks are by definition preempted by non-idle tasks. */
if (unlikely(curr->policy == SCHED_IDLE) &&
likely(p->policy != SCHED_IDLE))
@@ -1918,9 +1921,6 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_
return;


- if (!sched_feat(WAKEUP_PREEMPT))
- return;
-
update_curr(cfs_rq);
find_matching_se(&se, &pse);
BUG_ON(!pse);
--
1.7.3.4


--------------080702030304070707090308--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/