Skip to contentSkip to conversation

scheduler changes for v5.3

GIT PULL Merged Ingo Molnar 5 participants 7 messages Jul 8, 2019 – Jul 13, 2019 Scheduler

lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest sched-core-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-core-for-linus

# HEAD: af24bde8df2029f067dc46aff0393c8f18ff6e2f sched/uclamp: Add uclamp support to energy_compute()

The main changes in this cycle were:

- Remove the unused per rq load array and all its infrastructure, by Dietmar Eggemann.

- Add utilization clamping support by Patrick Bellasi. This is a refinement of the energy aware scheduling framework with support for boosting of interactive and capping of background workloads: to make sure critical GUI threads get maximum frequency ASAP, and to make sure background processing doesn't unnecessarily move to cpufreq governor to higher frequencies and less energy efficient CPU modes.

- Add the bare minimum of tracepoints required for LISA EAS regression testing, by Qais Yousef - which allows automated testing of various power management features, including energy aware scheduling.

- Restructure the former tsk_nr_cpus_allowed() facility that the -rt kernel used to modify the scheduler's CPU affinity logic such as migrate_disable() - introduce the task->cpus_ptr value instead of taking the address of &task->cpus_allowed directly - by Sebastian Andrzej Siewior.

- Misc optimizations, fixes, cleanups and small enhancements - see the Git log for details.

Thanks,

Ingo

------------------>
Dietmar Eggemann (8):

      sched/fair: Remove rq->load
      sched/fair: Remove the rq->cpu_load[] update code
      sched/fair: Replace source_load() & target_load() with weighted_cpuload()
      sched/debug: Remove sd->*_idx range on sysctl
      sched/core: Remove rq->cpu_load[]
      sched/core: Remove sd->*_idx
      sched/fair: Remove sgs->sum_weighted_load
      sched/fair: Rename weighted_cpuload() to cpu_runnable_load()

Gao Xiang (1):
sched/core: Add __sched tag for io_schedule()

Patrick Bellasi (11):
sched/uclamp: Add CPU's clamp buckets refcounting sched/uclamp: Add bucket local max tracking sched/uclamp: Enforce last task's UCLAMP_MAX sched/uclamp: Add system default clamps
sched/core: Allow sched_setattr() to use the current policy sched/uclamp: Extend sched_setattr() to support utilization clamping sched/uclamp: Reset uclamp values on RESET_ON_FORK sched/uclamp: Set default clamps for RT tasks sched/cpufreq, sched/uclamp: Add clamps for FAIR and RT tasks sched/uclamp: Add uclamp_util_with()
sched/uclamp: Add uclamp support to energy_compute()

Pavel Begunkov (1):
sched/wait: Deduplicate code with do-while

Peter Zijlstra (1):
sched/core: Optimize try_to_wake_up() for local wakeups

Qais Yousef (6):
sched/autogroup: Make autogroup_path() always available sched/debug: Add a new sched_trace_*() helper functions sched/debug: Add new tracepoints to track PELT at rq level sched/debug: Add new tracepoint to track PELT at se level sched/debug: Add sched_overutilized tracepoint sched/debug: Export the newly added tracepoints

Qian Cai (1):
sched/fair: Fix "runnable_avg_yN_inv" not used warnings

Sebastian Andrzej Siewior (1):
sched/core: Provide a pointer to the valid CPU mask

Valentin Schneider (1):
sched/fair: Clean up definition of NOHZ blocked load functions

Vincent Guittot (1):
sched/topology: Remove unused 'sd' parameter from arch_scale_cpu_capacity()

[email protected] (1):
sched/fair: Don't push cfs_bandwith slack timers forward

 Documentation/scheduler/sched-pelt.c       |   3 +-
 arch/arm/kernel/topology.c                 |   2 +-
 arch/ia64/kernel/mca.c                     |   2 +-
 arch/mips/include/asm/switch_to.h          |   4 +-
 arch/mips/kernel/mips-mt-fpaff.c           |   2 +-
 arch/mips/kernel/traps.c                   |   6 +-
 arch/powerpc/platforms/cell/spufs/sched.c  |   2 +-
 arch/x86/kernel/cpu/resctrl/pseudo_lock.c  |   2 +-
 drivers/base/arch_topology.c               |   6 +-
 drivers/infiniband/hw/hfi1/affinity.c      |   6 +-
 drivers/infiniband/hw/hfi1/sdma.c          |   3 +-
 drivers/infiniband/hw/qib/qib_file_ops.c   |   7 +-
 fs/proc/array.c                            |   4 +-
 include/linux/arch_topology.h              |   2 +-
 include/linux/energy_model.h               |   2 +-
 include/linux/log2.h                       |  34 ++
 include/linux/sched.h                      |  79 +++-
 include/linux/sched/nohz.h                 |   8 -
 include/linux/sched/sysctl.h               |  11 +
 include/linux/sched/topology.h             |  25 +-
 include/trace/events/sched.h               |  31 ++
 include/uapi/linux/sched.h                 |  14 +-
 include/uapi/linux/sched/types.h           |  66 ++-
 init/Kconfig                               |  53 +++
 init/init_task.c                           |   3 +-
 kernel/cgroup/cpuset.c                     |   2 +-
 kernel/fork.c                              |   2 +
 kernel/power/energy_model.c                |   2 +-
 kernel/sched/autogroup.c                   |   2 -
 kernel/sched/core.c                        | 533 ++++++++++++++++++++++--
 kernel/sched/cpudeadline.c                 |   4 +-
 kernel/sched/cpufreq_schedutil.c           |  24 +-
 kernel/sched/cpupri.c                      |   4 +-
 kernel/sched/deadline.c                    |   8 +-
 kernel/sched/debug.c                       |  43 +-
 kernel/sched/fair.c                        | 623 ++++++++++-------------------
 kernel/sched/features.h                    |   1 -
 kernel/sched/pelt.c                        |  13 +-
 kernel/sched/pelt.h                        |   2 +-
 kernel/sched/rt.c                          |   8 +-
 kernel/sched/sched-pelt.h                  |   2 +-
 kernel/sched/sched.h                       | 134 +++++--
 kernel/sched/topology.c                    |  18 +-
 kernel/sched/wait.c                        |   8 +-
 kernel/sysctl.c                            |  16 +
 kernel/time/tick-sched.c                   |   2 -
 kernel/trace/trace_hwlat.c                 |   2 +-
 lib/smp_processor_id.c                     |   2 +-
 samples/trace_events/trace-events-sample.c |   2 +-
 49 files changed, 1216 insertions(+), 618 deletions(-)
merge bot Merged
#1 lore raw
The pull request you sent on Mon, 8 Jul 2019 13:53:49 +0200:

The pull request you sent on Mon, 8 Jul 2019 13:53:49 +0200:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-core-for-linus

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/dad1c12ed831a7a89cc01e5582cd0b81a4be7f19

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
#2 lore raw
In reply to Ingo Molnar
Quoted 3 lines · Ingo Molnar

Please pull the latest sched-core-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-core-for-linus

....

Quoted 2 lines

Peter Zijlstra (1):
sched/core: Optimize try_to_wake_up() for local wakeups

Hey Peter, Ingo,
Since this change landed in Linus' tree, I've been seeing a lot of
the following dmesg noise when running AOSP on the HiKey960 board.

[  173.162712] CPU: 2 PID: 731 Comm: ndroid.systemui Tainted: G S
          5.2.0-rc5-00110-g6751c43d94d6 #447
[  173.162721] Hardware name: HiKey960 (DT)
[  173.171194] caller is try_to_wake_up+0x3e4/0x788
[  173.179605] Call trace:
[  173.179617]  dump_backtrace+0x0/0x140
[  173.179626]  show_stack+0x14/0x20
[  173.179638]  dump_stack+0x9c/0xc4
[  173.179649]  debug_smp_processor_id+0x148/0x150
[  173.179659]  try_to_wake_up+0x3e4/0x788
[  173.179669]  wake_up_q+0x5c/0x98
[  173.179681]  futex_wake+0x170/0x1a8
[  173.179696]  do_futex+0x560/0xf30
[  173.284541]  __arm64_sys_futex+0xfc/0x148
[  173.288570]  el0_svc_common.constprop.0+0x64/0x188
[  173.293371]  el0_svc_handler+0x28/0x78
[  173.297131]  el0_svc+0x8/0xc
[  173.300045] CPU: 0 PID: 1258 Comm: Binder:363_5 Tainted: G S
        5.2.0-rc5-00110-g6751c43d94d6 #447
[  173.301130] BUG: using smp_processor_id() in preemptible [00000000]
code: ndroid.systemui/731
[  173.310074] Hardware name: HiKey960 (DT)
[  173.310084] Call trace:
[  173.310112]  dump_backtrace+0x0/0x140
[  173.310131]  show_stack+0x14/0x20
[  173.318685] caller is try_to_wake_up+0x3e4/0x788
[  173.322583]  dump_stack+0x9c/0xc4
[  173.322595]  debug_smp_processor_id+0x148/0x150
[  173.322605]  try_to_wake_up+0x3e4/0x788
[  173.322615]  wake_up_q+0x5c/0x98
[  173.322628]  futex_wake+0x170/0x1a8
[  173.322641]  do_futex+0x560/0xf30
[  173.358367]  __arm64_sys_futex+0xfc/0x148
[  173.362397]  el0_svc_common.constprop.0+0x64/0x188
[  173.367199]  el0_svc_handler+0x28/0x78
[  173.370956]  el0_svc+0x8/0xc

Reverting aacedf26fb76 ("sched/core: Optimize try_to_wake_up() for local wakeups") seems to quiet down these warnings.

I've just bisected this down (and am about to crash for the night), so I've not had much time to look at what a fix might be, but I wanted to raise it with you.

If you have suggestions for patches to try, I'll happily do so in the morning!

thanks
-john

maintainer
#3 lore raw
Quoted 40 lines · John Stultz
Quoted 3 lines · Ingo Molnar

Please pull the latest sched-core-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git sched-core-for-linus

....

Quoted 2 lines

Peter Zijlstra (1):
sched/core: Optimize try_to_wake_up() for local wakeups

Hey Peter, Ingo,
Since this change landed in Linus' tree, I've been seeing a lot of
the following dmesg noise when running AOSP on the HiKey960 board.

[  173.162712] CPU: 2 PID: 731 Comm: ndroid.systemui Tainted: G S
          5.2.0-rc5-00110-g6751c43d94d6 #447
[  173.162721] Hardware name: HiKey960 (DT)
[  173.171194] caller is try_to_wake_up+0x3e4/0x788
[  173.179605] Call trace:
[  173.179617]  dump_backtrace+0x0/0x140
[  173.179626]  show_stack+0x14/0x20
[  173.179638]  dump_stack+0x9c/0xc4
[  173.179649]  debug_smp_processor_id+0x148/0x150
[  173.179659]  try_to_wake_up+0x3e4/0x788
[  173.179669]  wake_up_q+0x5c/0x98
[  173.179681]  futex_wake+0x170/0x1a8
[  173.179696]  do_futex+0x560/0xf30
[  173.284541]  __arm64_sys_futex+0xfc/0x148
[  173.288570]  el0_svc_common.constprop.0+0x64/0x188
[  173.293371]  el0_svc_handler+0x28/0x78
[  173.297131]  el0_svc+0x8/0xc
[  173.300045] CPU: 0 PID: 1258 Comm: Binder:363_5 Tainted: G S
        5.2.0-rc5-00110-g6751c43d94d6 #447
[  173.301130] BUG: using smp_processor_id() in preemptible [00000000]
code: ndroid.systemui/731
[  173.310074] Hardware name: HiKey960 (DT)
[  173.310084] Call trace:
[  173.310112]  dump_backtrace+0x0/0x140
[  173.310131]  show_stack+0x14/0x20
[  173.318685] caller is try_to_wake_up+0x3e4/0x788
[  173.322583]  dump_stack+0x9c/0xc4
[  173.322595]  debug_smp_processor_id+0x148/0x150
Quoted 9 lines
[  173.322605]  try_to_wake_up+0x3e4/0x788
[  173.322615]  wake_up_q+0x5c/0x98
[  173.322628]  futex_wake+0x170/0x1a8
[  173.322641]  do_futex+0x560/0xf30
[  173.358367]  __arm64_sys_futex+0xfc/0x148
[  173.362397]  el0_svc_common.constprop.0+0x64/0x188
[  173.367199]  el0_svc_handler+0x28/0x78
[  173.370956]  el0_svc+0x8/0xc

Urgh.. however didn't we find that before :/ stupid stats.

Something like the below ought to fix, but let me see if I can come up with something saner...

kernel/sched/core.c +3 -1
index 108449526f11..0b22e55cebe8 100644
@@ -2399,6 +2399,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 	unsigned long flags;
 	int cpu, success = 0;
 
+	preempt_disable();
 	if (p == current) {
 		/*
 		 * We're waking current, this means 'p->on_rq' and 'task_cpu(p)
@@ -2412,7 +2413,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 		 *    it disabling IRQs (this allows not taking ->pi_lock).
 		 */
 		if (!(p->state & state))
-			return false;
+			goto out;
 
 		success = 1;
 		cpu = task_cpu(p);
@@ -2526,6 +2527,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 out:
 	if (success)
 		ttwu_stat(p, cpu, wake_flags);
+	preempt_enable();
 
 	return success;
 }
#4 lore raw
Quoted 5 lines · Peter Zijlstra

Urgh.. however didn't we find that before :/ stupid stats.

Something like the below ought to fix, but let me see if I can come up with something saner...

Yep. This works for me, but let me know if you have anything else you want me to test as well.

thanks again!
-john

#5 lore raw
Quoted 9 lines · John Stultz
Quoted 5 lines · Peter Zijlstra

Urgh.. however didn't we find that before :/ stupid stats.

Something like the below ought to fix, but let me see if I can come up with something saner...

Yep. This works for me, but let me know if you have anything else you want me to test as well.

No, that's perfect, will get this fix to Linus ASAP, thanks for the help!

Ingo

#6 lore raw

[tip:sched/urgent] sched/core: Fix preempt warning in ttwu

In reply to Peter Zijlstra
sched/core: Fix preempt warning in ttwu
Commit-ID:  e3d85487fba42206024bc3ed32e4b581c7cb46db
Gitweb:     https://git.kernel.org/tip/e3d85487fba42206024bc3ed32e4b581c7cb46db
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Wed, 10 Jul 2019 12:57:36 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sat, 13 Jul 2019 11:23:27 +0200

sched/core: Fix preempt warning in ttwu

John reported a DEBUG_PREEMPT warning caused by commit:

aacedf26fb76 ("sched/core: Optimize try_to_wake_up() for local wakeups")

I overlooked that ttwu_stat() requires preemption disabled.

Cc Andrew Morton <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Fixes aacedf26fb76 ("sched/core: Optimize try_to_wake_up() for local wakeups")
---
 kernel/sched/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/sched/core.c +3 -1
index fa43ce3962e7..2b037f195473 100644
@@ -2399,6 +2399,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 	unsigned long flags;
 	int cpu, success = 0;
 
+	preempt_disable();
 	if (p == current) {
 		/*
 		 * We're waking current, this means 'p->on_rq' and 'task_cpu(p)
@@ -2412,7 +2413,7 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
 		 *    it disabling IRQs (this allows not taking ->pi_lock).
 		 */
 		if (!(p->state & state))
-			return false;
+			goto out;
 
 		success = 1;
 		cpu = task_cpu(p);
@@ -2526,6 +2527,7 @@ unlock:
 out:
 	if (success)
 		ttwu_stat(p, cpu, wake_flags);
+	preempt_enable();
 
 	return success;
 }