Commit 5324953
Peter Zijlstra
sched/core: Fix wakeup_preempt's next_class tracking
Kernel test robot reported that
tools/testing/selftests/kvm/hardware_disable_test was failing due to
commit 7040696 ("sched/core: Rework sched_class::wakeup_preempt()
and rq_modified_*()")
It turns out there were two related problems that could lead to a
missed preemption:
- when hitting newidle balance from the idle thread, it would elevate
rb->next_class from &idle_sched_class to &fair_sched_class, causing
later wakeup_preempt() calls to not hit the sched_class_above()
case, and not issue resched_curr().
Notably, this modification pattern should only lower the
next_class, and never raise it. Create two new helper functions to
wrap this.
- when doing schedule_idle(), it was possible to miss (re)setting
rq->next_class to &idle_sched_class, leading to the very same
problem.
Cc: Sean Christopherson <seanjc@google.com>
Fixes: 7040696 ("sched/core: Rework sched_class::wakeup_preempt() and rq_modified_*()")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202602122157.4e861298-lkp@intel.com
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260218163329.GQ1395416@noisy.programming.kicks-ass.net1 parent 4c652a4 commit 5324953
4 files changed
Lines changed: 16 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6830 | 6830 | | |
6831 | 6831 | | |
6832 | 6832 | | |
| 6833 | + | |
6833 | 6834 | | |
6834 | 6835 | | |
6835 | 6836 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2460 | 2460 | | |
2461 | 2461 | | |
2462 | 2462 | | |
2463 | | - | |
| 2463 | + | |
2464 | 2464 | | |
2465 | 2465 | | |
2466 | 2466 | | |
| |||
2475 | 2475 | | |
2476 | 2476 | | |
2477 | 2477 | | |
2478 | | - | |
| 2478 | + | |
2479 | 2479 | | |
2480 | 2480 | | |
2481 | 2481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12982 | 12982 | | |
12983 | 12983 | | |
12984 | 12984 | | |
12985 | | - | |
| 12985 | + | |
12986 | 12986 | | |
12987 | 12987 | | |
12988 | 12988 | | |
| |||
13049 | 13049 | | |
13050 | 13050 | | |
13051 | 13051 | | |
13052 | | - | |
| 13052 | + | |
13053 | 13053 | | |
13054 | 13054 | | |
13055 | 13055 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2748 | 2748 | | |
2749 | 2749 | | |
2750 | 2750 | | |
| 2751 | + | |
| 2752 | + | |
| 2753 | + | |
| 2754 | + | |
| 2755 | + | |
| 2756 | + | |
| 2757 | + | |
| 2758 | + | |
| 2759 | + | |
| 2760 | + | |
| 2761 | + | |
2751 | 2762 | | |
2752 | 2763 | | |
2753 | 2764 | | |
| |||
0 commit comments