aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 6da13bba3e23..c61ee3451a04 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2650,6 +2650,16 @@ static inline void wake_sleeping_dependent(int this_cpu, runqueue_t *this_rq)
2650 */ 2650 */
2651} 2651}
2652 2652
2653/*
2654 * number of 'lost' timeslices this task wont be able to fully
2655 * utilize, if another task runs on a sibling. This models the
2656 * slowdown effect of other tasks running on siblings:
2657 */
2658static inline unsigned long smt_slice(task_t *p, struct sched_domain *sd)
2659{
2660 return p->time_slice * (100 - sd->per_cpu_gain) / 100;
2661}
2662
2653static inline int dependent_sleeper(int this_cpu, runqueue_t *this_rq) 2663static inline int dependent_sleeper(int this_cpu, runqueue_t *this_rq)
2654{ 2664{
2655 struct sched_domain *tmp, *sd = NULL; 2665 struct sched_domain *tmp, *sd = NULL;
@@ -2714,8 +2724,9 @@ static inline int dependent_sleeper(int this_cpu, runqueue_t *this_rq)
2714 (sd->per_cpu_gain * DEF_TIMESLICE / 100)) 2724 (sd->per_cpu_gain * DEF_TIMESLICE / 100))
2715 ret = 1; 2725 ret = 1;
2716 } else 2726 } else
2717 if (((smt_curr->time_slice * (100 - sd->per_cpu_gain) / 2727 if (smt_curr->static_prio < p->static_prio &&
2718 100) > task_timeslice(p))) 2728 !TASK_PREEMPTS_CURR(p, smt_rq) &&
2729 smt_slice(smt_curr, sd) > task_timeslice(p))
2719 ret = 1; 2730 ret = 1;
2720 2731
2721check_smt_task: 2732check_smt_task:
@@ -2737,8 +2748,8 @@ check_smt_task:
2737 (sd->per_cpu_gain * DEF_TIMESLICE / 100)) 2748 (sd->per_cpu_gain * DEF_TIMESLICE / 100))
2738 resched_task(smt_curr); 2749 resched_task(smt_curr);
2739 } else { 2750 } else {
2740 if ((p->time_slice * (100 - sd->per_cpu_gain) / 100) > 2751 if (TASK_PREEMPTS_CURR(p, smt_rq) &&
2741 task_timeslice(smt_curr)) 2752 smt_slice(p, sd) > task_timeslice(smt_curr))
2742 resched_task(smt_curr); 2753 resched_task(smt_curr);
2743 else 2754 else
2744 wakeup_busy_runqueue(smt_rq); 2755 wakeup_busy_runqueue(smt_rq);