Skip to content

sched: balance callbacks

Peter Zijlstra lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 29 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14sched: Replace post_schedule with a balance callback listkernel/sched/core.c kernel/sched/deadline.c kernel/sched/rt.c +1 more+63 -380 replies
2/14sched: Use replace normalize_task() with __sched_setscheduler()kernel/sched/core.c+23 -420 replies
3/14sched: Allow balance callbacks for check_class_changed()kernel/sched/core.c+22 -30 replies
4/14sched,rt: Remove return value from pull_rt_task()kernel/sched/rt.c+11 -110 replies
5/14sched,rt: Convert switched_{from,to}_rt() / prio_changed_rt() to balance callbackskernel/sched/rt.c+19 -160 replies
6/14sched,dl: Remove return value from pull_dl_task()kernel/sched/deadline.c+10 -100 replies
7/14sched,dl: Convert switched_{from,to}_dl() / prio_changed_dl() to balance callbackskernel/sched/deadline.c+24 -210 replies
8/14hrtimer: Allow hrtimer::function() to free the timerinclude/linux/hrtimer.h kernel/time/hrtimer.c+122 -5535 replies
9/14sched,dl: Fix sched class hopping CBS holekernel/sched/deadline.c+86 -660 replies
10/14sched: Move code aroundkernel/sched/core.c+178 -1860 replies
11/14sched: Streamline the task migration locking a littlekernel/sched/core.c+34 -420 replies
12/14lockdep: Simplify lock_release()kernel/locking/lockdep.c+18 -1010 replies
13/14lockdep: Implement lock pinninginclude/linux/lockdep.h kernel/locking/lockdep.c+90 -02 replies
14/14sched,lockdep: Employ lock pinningkernel/sched/core.c kernel/sched/deadline.c kernel/sched/fair.c +2 more+71 -83 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/14] sched: balance callbacks

Mike stumbled over a cute bug where the RT/DL balancing ops caused a bug.

The exact scenario is __sched_setscheduler() changing a (runnable) task from FIFO to OTHER. In swiched_from_rt(), where we do pull_rt_task() we temporarity drop rq->lock. This gap allows regular cfs load-balancing to step in and migrate our task.

However, check_class_changed() will happily continue with switched_to_fair() which assumes our task is still on the old rq and makes the kernel go boom.

Instead of trying to patch this up and make things complicated; simply disallow these methods to drop rq->lock and extend the current post_schedule stuff into a balancing callback list, and use that.

This survives Mike's testcase.

Changes since -v2:
- reworked the hrtimer patch. -- Kirill, tglx
- added lock pinning

Changes since -v1:
- make SMP=n build,
- cured switched_from_dl()'s cancel_dl_timer().

no real tests on the new parts other than booting / building kernels.