diff options
| -rw-r--r-- | kernel/sched/cpudeadline.c | 4 | ||||
| -rw-r--r-- | kernel/sched/deadline.c | 10 | ||||
| -rw-r--r-- | kernel/sched/fair.c | 8 | ||||
| -rw-r--r-- | kernel/sched/rt.c | 8 |
4 files changed, 20 insertions, 10 deletions
diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c index 5b8838b56d1c..5b9bb42b2d47 100644 --- a/kernel/sched/cpudeadline.c +++ b/kernel/sched/cpudeadline.c | |||
| @@ -70,7 +70,7 @@ static void cpudl_heapify(struct cpudl *cp, int idx) | |||
| 70 | 70 | ||
| 71 | static void cpudl_change_key(struct cpudl *cp, int idx, u64 new_dl) | 71 | static void cpudl_change_key(struct cpudl *cp, int idx, u64 new_dl) |
| 72 | { | 72 | { |
| 73 | WARN_ON(!cpu_present(idx) || idx == IDX_INVALID); | 73 | WARN_ON(idx == IDX_INVALID || !cpu_present(idx)); |
| 74 | 74 | ||
| 75 | if (dl_time_before(new_dl, cp->elements[idx].dl)) { | 75 | if (dl_time_before(new_dl, cp->elements[idx].dl)) { |
| 76 | cp->elements[idx].dl = new_dl; | 76 | cp->elements[idx].dl = new_dl; |
| @@ -117,7 +117,7 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, | |||
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | out: | 119 | out: |
| 120 | WARN_ON(!cpu_present(best_cpu) && best_cpu != -1); | 120 | WARN_ON(best_cpu != -1 && !cpu_present(best_cpu)); |
| 121 | 121 | ||
| 122 | return best_cpu; | 122 | return best_cpu; |
| 123 | } | 123 | } |
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 15cbc17fbf84..6e79b3faa4cd 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c | |||
| @@ -135,7 +135,6 @@ static void update_dl_migration(struct dl_rq *dl_rq) | |||
| 135 | static void inc_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) | 135 | static void inc_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) |
| 136 | { | 136 | { |
| 137 | struct task_struct *p = dl_task_of(dl_se); | 137 | struct task_struct *p = dl_task_of(dl_se); |
| 138 | dl_rq = &rq_of_dl_rq(dl_rq)->dl; | ||
| 139 | 138 | ||
| 140 | if (p->nr_cpus_allowed > 1) | 139 | if (p->nr_cpus_allowed > 1) |
| 141 | dl_rq->dl_nr_migratory++; | 140 | dl_rq->dl_nr_migratory++; |
| @@ -146,7 +145,6 @@ static void inc_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) | |||
| 146 | static void dec_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) | 145 | static void dec_dl_migration(struct sched_dl_entity *dl_se, struct dl_rq *dl_rq) |
| 147 | { | 146 | { |
| 148 | struct task_struct *p = dl_task_of(dl_se); | 147 | struct task_struct *p = dl_task_of(dl_se); |
| 149 | dl_rq = &rq_of_dl_rq(dl_rq)->dl; | ||
| 150 | 148 | ||
| 151 | if (p->nr_cpus_allowed > 1) | 149 | if (p->nr_cpus_allowed > 1) |
| 152 | dl_rq->dl_nr_migratory--; | 150 | dl_rq->dl_nr_migratory--; |
| @@ -564,6 +562,8 @@ int dl_runtime_exceeded(struct rq *rq, struct sched_dl_entity *dl_se) | |||
| 564 | return 1; | 562 | return 1; |
| 565 | } | 563 | } |
| 566 | 564 | ||
| 565 | extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq); | ||
| 566 | |||
| 567 | /* | 567 | /* |
| 568 | * Update the current task's runtime statistics (provided it is still | 568 | * Update the current task's runtime statistics (provided it is still |
| 569 | * a -deadline task and has not been removed from the dl_rq). | 569 | * a -deadline task and has not been removed from the dl_rq). |
| @@ -627,11 +627,13 @@ static void update_curr_dl(struct rq *rq) | |||
| 627 | struct rt_rq *rt_rq = &rq->rt; | 627 | struct rt_rq *rt_rq = &rq->rt; |
| 628 | 628 | ||
| 629 | raw_spin_lock(&rt_rq->rt_runtime_lock); | 629 | raw_spin_lock(&rt_rq->rt_runtime_lock); |
| 630 | rt_rq->rt_time += delta_exec; | ||
| 631 | /* | 630 | /* |
| 632 | * We'll let actual RT tasks worry about the overflow here, we | 631 | * We'll let actual RT tasks worry about the overflow here, we |
| 633 | * have our own CBS to keep us inline -- see above. | 632 | * have our own CBS to keep us inline; only account when RT |
| 633 | * bandwidth is relevant. | ||
| 634 | */ | 634 | */ |
| 635 | if (sched_rt_bandwidth_account(rt_rq)) | ||
| 636 | rt_rq->rt_time += delta_exec; | ||
| 635 | raw_spin_unlock(&rt_rq->rt_runtime_lock); | 637 | raw_spin_unlock(&rt_rq->rt_runtime_lock); |
| 636 | } | 638 | } |
| 637 | } | 639 | } |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 78157099b167..9b4c4f320130 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
| @@ -7001,15 +7001,15 @@ static void switched_from_fair(struct rq *rq, struct task_struct *p) | |||
| 7001 | struct cfs_rq *cfs_rq = cfs_rq_of(se); | 7001 | struct cfs_rq *cfs_rq = cfs_rq_of(se); |
| 7002 | 7002 | ||
| 7003 | /* | 7003 | /* |
| 7004 | * Ensure the task's vruntime is normalized, so that when its | 7004 | * Ensure the task's vruntime is normalized, so that when it's |
| 7005 | * switched back to the fair class the enqueue_entity(.flags=0) will | 7005 | * switched back to the fair class the enqueue_entity(.flags=0) will |
| 7006 | * do the right thing. | 7006 | * do the right thing. |
| 7007 | * | 7007 | * |
| 7008 | * If it was on_rq, then the dequeue_entity(.flags=0) will already | 7008 | * If it's on_rq, then the dequeue_entity(.flags=0) will already |
| 7009 | * have normalized the vruntime, if it was !on_rq, then only when | 7009 | * have normalized the vruntime, if it's !on_rq, then only when |
| 7010 | * the task is sleeping will it still have non-normalized vruntime. | 7010 | * the task is sleeping will it still have non-normalized vruntime. |
| 7011 | */ | 7011 | */ |
| 7012 | if (!se->on_rq && p->state != TASK_RUNNING) { | 7012 | if (!p->on_rq && p->state != TASK_RUNNING) { |
| 7013 | /* | 7013 | /* |
| 7014 | * Fix up our vruntime so that the current sleep doesn't | 7014 | * Fix up our vruntime so that the current sleep doesn't |
| 7015 | * cause 'unlimited' sleep bonus. | 7015 | * cause 'unlimited' sleep bonus. |
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index a2740b775b45..1999021042c7 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c | |||
| @@ -538,6 +538,14 @@ static inline struct rt_bandwidth *sched_rt_bandwidth(struct rt_rq *rt_rq) | |||
| 538 | 538 | ||
| 539 | #endif /* CONFIG_RT_GROUP_SCHED */ | 539 | #endif /* CONFIG_RT_GROUP_SCHED */ |
| 540 | 540 | ||
| 541 | bool sched_rt_bandwidth_account(struct rt_rq *rt_rq) | ||
| 542 | { | ||
| 543 | struct rt_bandwidth *rt_b = sched_rt_bandwidth(rt_rq); | ||
| 544 | |||
| 545 | return (hrtimer_active(&rt_b->rt_period_timer) || | ||
| 546 | rt_rq->rt_time < rt_b->rt_runtime); | ||
| 547 | } | ||
| 548 | |||
| 541 | #ifdef CONFIG_SMP | 549 | #ifdef CONFIG_SMP |
| 542 | /* | 550 | /* |
| 543 | * We ran out of runtime, see if we can borrow some from our neighbours. | 551 | * We ran out of runtime, see if we can borrow some from our neighbours. |
