Эх сурвалжийг харах

Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
 "A cputime fix and code comments/organization fix to the deadline
  scheduler"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/deadline: Fix confusing comments about selection of top pi-waiter
  sched/cputime: Don't use smp_processor_id() in preemptible context
Linus Torvalds 8 жил өмнө
parent
commit
5a77f0254b

+ 3 - 3
kernel/sched/cputime.c

@@ -683,7 +683,7 @@ static u64 vtime_delta(struct vtime *vtime)
 {
 {
 	unsigned long long clock;
 	unsigned long long clock;
 
 
-	clock = sched_clock_cpu(smp_processor_id());
+	clock = sched_clock();
 	if (clock < vtime->starttime)
 	if (clock < vtime->starttime)
 		return 0;
 		return 0;
 
 
@@ -814,7 +814,7 @@ void arch_vtime_task_switch(struct task_struct *prev)
 
 
 	write_seqcount_begin(&vtime->seqcount);
 	write_seqcount_begin(&vtime->seqcount);
 	vtime->state = VTIME_SYS;
 	vtime->state = VTIME_SYS;
-	vtime->starttime = sched_clock_cpu(smp_processor_id());
+	vtime->starttime = sched_clock();
 	write_seqcount_end(&vtime->seqcount);
 	write_seqcount_end(&vtime->seqcount);
 }
 }
 
 
@@ -826,7 +826,7 @@ void vtime_init_idle(struct task_struct *t, int cpu)
 	local_irq_save(flags);
 	local_irq_save(flags);
 	write_seqcount_begin(&vtime->seqcount);
 	write_seqcount_begin(&vtime->seqcount);
 	vtime->state = VTIME_SYS;
 	vtime->state = VTIME_SYS;
-	vtime->starttime = sched_clock_cpu(cpu);
+	vtime->starttime = sched_clock();
 	write_seqcount_end(&vtime->seqcount);
 	write_seqcount_end(&vtime->seqcount);
 	local_irq_restore(flags);
 	local_irq_restore(flags);
 }
 }

+ 8 - 6
kernel/sched/deadline.c

@@ -1392,17 +1392,19 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags)
 	struct sched_dl_entity *pi_se = &p->dl;
 	struct sched_dl_entity *pi_se = &p->dl;
 
 
 	/*
 	/*
-	 * Use the scheduling parameters of the top pi-waiter
-	 * task if we have one and its (absolute) deadline is
-	 * smaller than our one... OTW we keep our runtime and
-	 * deadline.
+	 * Use the scheduling parameters of the top pi-waiter task if:
+	 * - we have a top pi-waiter which is a SCHED_DEADLINE task AND
+	 * - our dl_boosted is set (i.e. the pi-waiter's (absolute) deadline is
+	 *   smaller than our deadline OR we are a !SCHED_DEADLINE task getting
+	 *   boosted due to a SCHED_DEADLINE pi-waiter).
+	 * Otherwise we keep our runtime and deadline.
 	 */
 	 */
-	if (pi_task && p->dl.dl_boosted && dl_prio(pi_task->normal_prio)) {
+	if (pi_task && dl_prio(pi_task->normal_prio) && p->dl.dl_boosted) {
 		pi_se = &pi_task->dl;
 		pi_se = &pi_task->dl;
 	} else if (!dl_prio(p->normal_prio)) {
 	} else if (!dl_prio(p->normal_prio)) {
 		/*
 		/*
 		 * Special case in which we have a !SCHED_DEADLINE task
 		 * Special case in which we have a !SCHED_DEADLINE task
-		 * that is going to be deboosted, but exceedes its
+		 * that is going to be deboosted, but exceeds its
 		 * runtime while doing so. No point in replenishing
 		 * runtime while doing so. No point in replenishing
 		 * it, as it's going to return back to its original
 		 * it, as it's going to return back to its original
 		 * scheduling class after this.
 		 * scheduling class after this.