Skip to content

Single RunQueue Proxy Execution (v19)

John Stultz lkml 9 versions – Applied

Status from this message: The following commit has been merged into the sched/core branch of tip:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v19 Latest8 patches 3 repliesApplied
  2. v18 posting 2/28 patches 9 repliesSuperseded
  3. v18 posting 1/28 patches 1 replySuperseded
Earlier versions · 6
VersionPostedPatchesRepliesStatus
v17 posting 2/28 patches0 repliesSuperseded
v17 posting 1/28 patches0 repliesSuperseded
v167 patches20 repliesSuperseded
v15 RFC7 patches28 repliesSuperseded
v14 RFC7 patches15 repliesSuperseded
v13 RFC7 patches0 repliesSuperseded

Patches in v19 Applied

#Subject and filesSizeRepliesApplied
1/8sched: Add CONFIG_SCHED_PROXY_EXEC & boot argument to enable/disableDocumentation/admin-guide/kernel-parameters.txt include/linux/sched.h init/Kconfig +2 more+71 -01 reply
2/8locking/mutex: Rework task_struct::blocked_oninclude/linux/sched.h kernel/fork.c kernel/locking/mutex-debug.c +2 more+45 -120 replies
3/8locking/mutex: Add p->blocked_on wrappers for correctness checksinclude/linux/sched.h kernel/locking/mutex-debug.c kernel/locking/mutex.c +1 more+81 -270 replies
4/8sched: Move update_curr_task logic into update_curr_sekernel/sched/fair.c+9 -170 replies
5/8sched: Fix runtime accounting w/ split exec & sched contextskernel/sched/fair.c+28 -140 replies
6/8sched: Add an initial sketch of the find_proxy_task() functionkernel/sched/core.c kernel/sched/sched.h+121 -60 replies
7/8sched: Fix proxy/current (push,pull)abilitykernel/sched/core.c kernel/sched/deadline.c kernel/sched/rt.c+37 -00 replies
8/8sched: Start blocked_on chain processing in find_proxy_task()kernel/locking/mutex.h kernel/sched/core.c kernel/sched/fair.c+135 -260 replies

Reviews trailers per patch

None of the 8 patches has a Reviewed-by or Acked-by.

PatchK Prateek Nayak
1/8T-b
2/8T-b
3/8T-b
4/8T-b
5/8T-b
6/8T-b
7/8T-b
8/8T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v19 thread

Cover letter [PATCH v19 0/8] Single RunQueue Proxy Execution (v19)

Hey All,

This is just a quick update to the v18 series, to address some smaller nits Peter had as well as a few build issues uncovered with !SMP and PREEMPT_RT that K Prateek Nayak highlighted.

So here is v19 of the Proxy Execution series, a generalized form of priority inheritance.

As I’m trying to submit this work in smallish digestible pieces, in this series, I’m only submitting for review the logic that allows us to do the proxying if the lock owner is on the same runqueue as the blocked waiter. Introducing the CONFIG_SCHED_PROXY_EXEC option and boot-argument, reworking the task_struct::blocked_on pointer and wrapper functions, the initial sketch of the find_proxy_task() logic, some fixes for using split contexts, and finally same-runqueue proxying.

As I mentioned above, for the series I’m submitting here, it has only minor changes from v18. With the majority of the change being slight reworks to address build issues with different configs.

Specifically:
* Build fixup for PREEMPT_RT suggested by K Prateek Nayak
* Slight re-arrangement of functions to clean up later patches
* Slight tweak further simplifying update_curr_common() suggested by Peter
* Rename try_to_block_task() arguments and add additional comments suggested by Peter
* Push proxy_resched_idle() returning rq->idle to a later patch in the series, as suggested by Peter.

In the full series, some of the slight reworks for build issues propagated and needed to be tweaked, as well as some fixes for !CONFIG_SMP were needed.

You can find the full series here:
https://github.com/johnstultz-work/linux-dev/commits/proxy-exec-v19-6.16-rc5/
https://github.com/johnstultz-work/linux-dev.git proxy-exec-v19-6.16-rc5

Issues still to address with the full series:
* I spent some more time thinking about Peter’s suggestion to avoid using the blocked_on_state == BO_WAKING check to protect against running proxy-migrated tasks on cpus out of their affinity mask. His suggestion to just dequeue the task prior to the wakeup in the unlock-wakeup path is more elegant, but this would be insufficient to protect from other wakeup paths that don’t dequeue. I’m still thinking if there is a clean way around this, but I’ve not yet found it.
* Need to sort out what is needed for sched_ext to be ok with proxy-execution enabled.
* K Prateek Nayak did some testing about a bit over a year ago with an earlier version of the series and saw ~3-5% regressions in some cases. Need to re-evaluate this with the proxy-migration avoidance optimization Suleiman suggested now implemented.
* The chain migration functionality needs further iterations and better validation to ensure it truly maintains the RT/DL load balancing invariants (despite this being broken in vanilla upstream with RT_PUSH_IPI currently)

I’d really appreciate any feedback or review thoughts on the full series as well. I’m trying to keep the chunks small, reviewable and iteratively testable, but if you have any suggestions on how to improve the series, I’m all ears.

Credit/Disclaimer:
—--------------------
As always, this Proxy Execution series has a long history with lots of developers that deserve credit:

First described in a paper[1] by Watkins, Straub, Niehaus, then from patches from Peter Zijlstra, extended with lots of work by Juri Lelli, Valentin Schneider, and Connor O'Brien. (and thank you to Steven Rostedt for providing additional details here!)

So again, many thanks to those above, as all the credit for this series really is due to them - while the mistakes are likely mine.

Thanks so much!
-john

[1] https://static.lwn.net/images/conf/rtlws11/papers/proc/p38.pdf

Cc Joel Fernandes <[email protected]>
Cc Qais Yousef <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Juri Lelli <[email protected]>
Cc Vincent Guittot <[email protected]>
Cc Dietmar Eggemann <[email protected]>
Cc Valentin Schneider <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Ben Segall <[email protected]>
Cc Zimuzo Ezeozue <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Will Deacon <[email protected]>
Cc Waiman Long <[email protected]>
Cc Boqun Feng <[email protected]>
Cc "Paul E. McKenney" <[email protected]>
Cc Metin Kaya <[email protected]>
Cc Xuewen Yan <[email protected]>
Cc K Prateek Nayak <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Daniel Lezcano <[email protected]>
Cc Suleiman Souhlal <[email protected]>
Cc kuyo chang <[email protected]>

John Stultz (4):
sched: Add CONFIG_SCHED_PROXY_EXEC & boot argument to enable/disable
sched: Move update_curr_task logic into update_curr_se
sched: Fix runtime accounting w/ split exec & sched contexts
sched: Add an initial sketch of the find_proxy_task() function

Peter Zijlstra (2):
locking/mutex: Rework task_struct::blocked_on
sched: Start blocked_on chain processing in find_proxy_task()

Valentin Schneider (2):
locking/mutex: Add p->blocked_on wrappers for correctness checks
sched: Fix proxy/current (push,pull)ability

 .../admin-guide/kernel-parameters.txt         |   5 +
 include/linux/sched.h                         |  82 +++++-
 init/Kconfig                                  |  12 +
 kernel/fork.c                                 |   3 +-
 kernel/locking/mutex-debug.c                  |   9 +-
 kernel/locking/mutex.c                        |  18 ++
 kernel/locking/mutex.h                        |   3 +-
 kernel/locking/ww_mutex.h                     |  16 +-
 kernel/sched/core.c                           | 275 +++++++++++++++++-
 kernel/sched/deadline.c                       |   7 +
 kernel/sched/fair.c                           |  68 +++--
 kernel/sched/rt.c                             |   5 +
 kernel/sched/sched.h                          |  22 +-
 13 files changed, 475 insertions(+), 50 deletions(-)
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog