Skip to content

Commit

Permalink
Merge tag 'sched_urgent_for_v5.15_rc1' of git://git.kernel.org/pub/sc…
Browse files Browse the repository at this point in the history
…m/linux/kernel/git/tip/tip

Pull scheduler fixes from Borislav Petkov:

 - Make sure the idle timer expires in hardirq context, on PREEMPT_RT

 - Make sure the run-queue balance callback is invoked only on the
   outgoing CPU

* tag 'sched_urgent_for_v5.15_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched: Prevent balance_push() on remote runqueues
  sched/idle: Make the idle timer expire in hard interrupt context
  • Loading branch information
torvalds committed Sep 12, 2021
2 parents 165d05d + 868ad33 commit 56c2443
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -8836,17 +8836,17 @@ static void balance_push(struct rq *rq)
struct task_struct *push_task = rq->curr;

lockdep_assert_rq_held(rq);
SCHED_WARN_ON(rq->cpu != smp_processor_id());

/*
* Ensure the thing is persistent until balance_push_set(.on = false);
*/
rq->balance_callback = &balance_push_callback;

/*
* Only active while going offline.
* Only active while going offline and when invoked on the outgoing
* CPU.
*/
if (!cpu_dying(rq->cpu))
if (!cpu_dying(rq->cpu) || rq != this_rq())
return;

/*
Expand Down
4 changes: 2 additions & 2 deletions kernel/sched/idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,10 @@ void play_idle_precise(u64 duration_ns, u64 latency_ns)
cpuidle_use_deepest_state(latency_ns);

it.done = 0;
hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
hrtimer_init_on_stack(&it.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_HARD);
it.timer.function = idle_inject_timer_fn;
hrtimer_start(&it.timer, ns_to_ktime(duration_ns),
HRTIMER_MODE_REL_PINNED);
HRTIMER_MODE_REL_PINNED_HARD);

while (!READ_ONCE(it.done))
do_idle();
Expand Down

0 comments on commit 56c2443

Please sign in to comment.