sched, arch_topology: Thermal pressure configuration cleanup
Subsystems (5)
v2 cover sched, arch_topology: Thermal pressure configuration cleanup
Hi folks,
This stems from this thread [1] on the list. TL;DR: the thermal pressure config has no helpful documentation, and figuring out if the right dependencies are in place is not easy for a regular user.
The current landscape also paints an odd picture: arch_set_thermal_pressure() is hardcoded in sched/core.c, and is *not* architecture-definable, while arch_get_thermal_pressure() is. Patch 1 is tackling this, the rest is Kconfig stuff.
Cheers,
Valentin
[1]: https://lkml.kernel.org/r/[email protected]
Revisions
=========
v1 -> v2
--------
o Remove cpufreq_cooling.c weak function; use #define stub in sched/topology.h (Vincent)
o Hinge arm SCHED_THERMAL_PRESSURE selection on ARM_CPU_TOPOLOGY
Valentin Schneider (3):
arch_topology, sched/core: Cleanup thermal pressure definition
sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry arm, arm64: Select CONFIG_SCHED_THERMAL_PRESSURE
arch/arm/Kconfig | 1 + arch/arm/include/asm/topology.h | 3 ++- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/topology.h | 3 ++- drivers/base/arch_topology.c | 11 +++++++++++ include/linux/arch_topology.h | 4 ++-- include/linux/sched/topology.h | 7 +++++++ init/Kconfig | 15 ++++++++++++++- kernel/sched/core.c | 11 ----------- 9 files changed, 40 insertions(+), 16 deletions(-)
--
2.27.0
PATCH v2 1/3 arch_topology, sched/core: Cleanup thermal pressure definition
The following commit:
14533a16c46d ("thermal/cpu-cooling, sched/core: Move the arch_set_thermal_pressure() API to generic scheduler code")
moved the definition of arch_set_thermal_pressure() to sched/core.c, but kept its declaration in linux/arch_topology.h. When building e.g. an x86 kernel with CONFIG_SCHED_THERMAL_PRESSURE=y, cpufreq_cooling.c ends up getting the declaration of arch_set_thermal_pressure() from include/linux/arch_topology.h, which is somewhat awkward.
On top of this, sched/core.c unconditionally defines
o The thermal_pressure percpu variable
o arch_set_thermal_pressure()
while arch_scale_thermal_pressure() does nothing unless redefined by the architecture.
arch_*() functions are meant to be defined by architectures, so revert the aforementioned commit and re-implement it in a way that keeps arch_set_thermal_pressure() architecture-definable, and doesn't define the thermal pressure percpu variable for kernels that don't need it (CONFIG_SCHED_THERMAL_PRESSURE=n).
--- arch/arm/include/asm/topology.h | 3 ++- arch/arm64/include/asm/topology.h | 3 ++- drivers/base/arch_topology.c | 11 +++++++++++ include/linux/arch_topology.h | 4 ++-- include/linux/sched/topology.h | 7 +++++++ kernel/sched/core.c | 11 ----------- 6 files changed, 24 insertions(+), 15 deletions(-)
arch/arm/include/asm/topology.h +2 -1
@@ -16,8 +16,9 @@/* Enable topology flag updates */ #define arch_update_cpu_topology topology_update_cpu_topology -/* Replace task scheduler's default thermal pressure retrieve API */ +/* Replace task scheduler's default thermal pressure API */ #define arch_scale_thermal_pressure topology_get_thermal_pressure +#define arch_set_thermal_pressure topology_set_thermal_pressure#else
arch/arm64/include/asm/topology.h +2 -1
@@ -34,8 +34,9 @@ void topology_scale_freq_tick(void);/* Enable topology flag updates */ #define arch_update_cpu_topology topology_update_cpu_topology -/* Replace task scheduler's default thermal pressure retrieve API */ +/* Replace task scheduler's default thermal pressure API */ #define arch_scale_thermal_pressure topology_get_thermal_pressure +#define arch_set_thermal_pressure topology_set_thermal_pressure#include <asm-generic/topology.h>
drivers/base/arch_topology.c +11 -0
@@ -54,6 +54,17 @@ void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity)per_cpu (cpu_scale, cpu) = capacity; } +DEFINE_PER_CPU(unsigned long, thermal_pressure); + +void arch_set_thermal_pressure (const struct cpumask *cpus, +unsigned long th_pressure) +{ +int cpu; + +for_each_cpu (cpu, cpus) +WRITE_ONCE (per_cpu (thermal_pressure, cpu), th_pressure); +} +static ssize_t cpu_capacity_show (struct device *dev,struct device_attribute *attr,char *buf)
include/linux/arch_topology.h +2 -2
@@ -39,8 +39,8 @@ static inline unsigned long topology_get_thermal_pressure(int cpu)return per_cpu (thermal_pressure, cpu); } -void arch_set_thermal_pressure (struct cpumask *cpus, -unsigned long th_pressure); +void topology_set_thermal_pressure (const struct cpumask *cpus, +unsigned long th_pressure);struct cpu_topology {int thread_id;
include/linux/sched/topology.h +7 -0
@@ -232,6 +232,13 @@ unsigned long arch_scale_thermal_pressure(int cpu) }#endif +#ifndef arch_set_thermal_pressure +static __always_inline +void arch_set_thermal_pressure(const struct cpumask *cpus, +unsigned long th_pressure) +{ } +#endif +static inline int task_node (const struct task_struct *p) {return cpu_to_node (task_cpu (p));
kernel/sched/core.c +0 -11
@@ -3731,17 +3731,6 @@ unsigned long long task_sched_runtime(struct task_struct *p)return ns; } -DEFINE_PER_CPU(unsigned long, thermal_pressure); - -void arch_set_thermal_pressure (struct cpumask *cpus, -unsigned long th_pressure) -{ -int cpu; - -for_each_cpu (cpu, cpus) -WRITE_ONCE (per_cpu (thermal_pressure, cpu), th_pressure); -} -/* * This function gets called by the timer code, with HZ frequency. * We call it with interrupts disabled.
Signature · 1 line
2.27.0
Re: [PATCH v2 1/3] arch_topology, sched/core: Cleanup thermal pressure definition
Quoted 17 lines · Valentin Schneider
The following commit:
14533a16c46d("thermal/cpu-cooling, sched/core: Move thearch_set_thermal_pressure()API to generic scheduler code")moved the definition of
arch_set_thermal_pressure()tosched/core.c, but kept its declaration inlinux/arch_topology.h. When building e.g. an x86 kernel withCONFIG_SCHED_THERMAL_PRESSURE=y,cpufreq_cooling.cends up getting the declaration ofarch_set_thermal_pressure()frominclude/linux/arch_topology.h, which is somewhat awkward.On top of this,
sched/core.cunconditionally defines
o Thethermal_pressurepercpu variable
oarch_set_thermal_pressure()while
arch_scale_thermal_pressure()does nothing unless redefined by the architecture.
Quoted 8 lines
arch_*() functions are meant to be defined by architectures, so revert the aforementioned commit and re-implement it in a way that keeps
arch_set_thermal_pressure()architecture-definable, and doesn't define the thermal pressure percpu variable for kernels that don't need it (CONFIG_SCHED_THERMAL_PRESSURE=n).Signed-off-by Valentin Schneider <[email protected]>---
Quoted 116 lines
arch/arm/include/asm/topology.h | 3 ++- arch/arm64/include/asm/topology.h | 3 ++- drivers/base/arch_topology.c | 11 +++++++++++ include/linux/arch_topology.h | 4 ++-- include/linux/sched/topology.h | 7 +++++++ kernel/sched/core.c | 11 ----------- 6 files changed, 24 insertions(+), 15 deletions(-)arch/arm/include/asm/topology.h +2
-1@@ -16,8 +16,9 @@/* Enable topology flag updates */ #define arch_update_cpu_topology topology_update_cpu_topology -/* Replace task scheduler's default thermal pressure retrieve API */ +/* Replace task scheduler's default thermal pressure API */ #define arch_scale_thermal_pressure topology_get_thermal_pressure +#define arch_set_thermal_pressure topology_set_thermal_pressure#else arch/arm64/include/asm/topology.h +2
-1@@ -34,8 +34,9 @@ void topology_scale_freq_tick(void);/* Enable topology flag updates */ #define arch_update_cpu_topology topology_update_cpu_topology -/* Replace task scheduler's default thermal pressure retrieve API */ +/* Replace task scheduler's default thermal pressure API */ #define arch_scale_thermal_pressure topology_get_thermal_pressure +#define arch_set_thermal_pressure topology_set_thermal_pressure#include <asm-generic/topology.h> drivers/base/arch_topology.c +11
-0@@ -54,6 +54,17 @@ void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity)per_cpu (cpu_scale, cpu) = capacity; } +DEFINE_PER_CPU(unsigned long, thermal_pressure); + +void arch_set_thermal_pressure (const struct cpumask *cpus, +unsigned long th_pressure) +{ +int cpu; + +for_each_cpu (cpu, cpus) +WRITE_ONCE (per_cpu (thermal_pressure, cpu), th_pressure); +} +static ssize_t cpu_capacity_show (struct device *dev,struct device_attribute *attr,char *buf)include/linux/arch_topology.h +2
-2@@ -39,8 +39,8 @@ static inline unsigned long topology_get_thermal_pressure(int cpu)return per_cpu (thermal_pressure, cpu); } -void arch_set_thermal_pressure (struct cpumask *cpus, -unsigned long th_pressure); +void topology_set_thermal_pressure (const struct cpumask *cpus, +unsigned long th_pressure);struct cpu_topology {int thread_id;include/linux/sched/topology.h +7
-0@@ -232,6 +232,13 @@ unsigned long arch_scale_thermal_pressure(int cpu) }#endif +#ifndef arch_set_thermal_pressure +static __always_inline +void arch_set_thermal_pressure(const struct cpumask *cpus, +unsigned long th_pressure) +{ } +#endif +static inline int task_node (const struct task_struct *p) {return cpu_to_node (task_cpu (p));kernel/sched/core.c +0
-11@@ -3731,17 +3731,6 @@ unsigned long long task_sched_runtime(struct task_struct *p)return ns; } -DEFINE_PER_CPU(unsigned long, thermal_pressure); - -void arch_set_thermal_pressure (struct cpumask *cpus, -unsigned long th_pressure) -{ -int cpu; - -for_each_cpu (cpu, cpus) -WRITE_ONCE (per_cpu (thermal_pressure, cpu), th_pressure); -} -/* * This function gets called by the timer code, with HZ frequency. * We call it with interrupts disabled.
Signature · 2 lines
Warm Regards Thara
[tip: sched/core] arch_topology, sched/core: Cleanup thermal pressure definition
In reply to Valentin SchneiderThe following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 25980c7a79af42f2daa73e2f475ebf4cbac8253e Gitweb: https://git.kernel.org/tip/25980c7a79af42f2daa73e2f475ebf4cbac8253e Author: Valentin Schneider <[email protected]> AuthorDate: Sun, 12 Jul 2020 17:59:15 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 22 Jul 2020 10:22:05 +02:00
arch_topology, sched/core: Cleanup thermal pressure definition
The following commit:
14533a16c46d ("thermal/cpu-cooling, sched/core: Move the arch_set_thermal_pressure() API to generic scheduler code")
moved the definition of arch_set_thermal_pressure() to sched/core.c, but kept its declaration in linux/arch_topology.h. When building e.g. an x86 kernel with CONFIG_SCHED_THERMAL_PRESSURE=y, cpufreq_cooling.c ends up getting the declaration of arch_set_thermal_pressure() from include/linux/arch_topology.h, which is somewhat awkward.
On top of this, sched/core.c unconditionally defines
o The thermal_pressure percpu variable
o arch_set_thermal_pressure()
while arch_scale_thermal_pressure() does nothing unless redefined by the architecture.
arch_*() functions are meant to be defined by architectures, so revert the aforementioned commit and re-implement it in a way that keeps arch_set_thermal_pressure() architecture-definable, and doesn't define the thermal pressure percpu variable for kernels that don't need it (CONFIG_SCHED_THERMAL_PRESSURE=n).
--- arch/arm/include/asm/topology.h | 3 ++- arch/arm64/include/asm/topology.h | 3 ++- drivers/base/arch_topology.c | 11 +++++++++++ include/linux/arch_topology.h | 4 ++-- include/linux/sched/topology.h | 7 +++++++ kernel/sched/core.c | 11 ----------- 6 files changed, 24 insertions(+), 15 deletions(-)
arch/arm/include/asm/topology.h +2 -1
@@ -16,8 +16,9 @@/* Enable topology flag updates */ #define arch_update_cpu_topology topology_update_cpu_topology -/* Replace task scheduler's default thermal pressure retrieve API */ +/* Replace task scheduler's default thermal pressure API */ #define arch_scale_thermal_pressure topology_get_thermal_pressure +#define arch_set_thermal_pressure topology_set_thermal_pressure#else
arch/arm64/include/asm/topology.h +2 -1
@@ -34,8 +34,9 @@ void topology_scale_freq_tick(void);/* Enable topology flag updates */ #define arch_update_cpu_topology topology_update_cpu_topology -/* Replace task scheduler's default thermal pressure retrieve API */ +/* Replace task scheduler's default thermal pressure API */ #define arch_scale_thermal_pressure topology_get_thermal_pressure +#define arch_set_thermal_pressure topology_set_thermal_pressure#include <asm-generic/topology.h>
drivers/base/arch_topology.c +11 -0
@@ -54,6 +54,17 @@ void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity)per_cpu (cpu_scale, cpu) = capacity; } +DEFINE_PER_CPU(unsigned long, thermal_pressure); + +void topology_set_thermal_pressure (const struct cpumask *cpus, +unsigned long th_pressure) +{ +int cpu; + +for_each_cpu (cpu, cpus) +WRITE_ONCE (per_cpu (thermal_pressure, cpu), th_pressure); +} +static ssize_t cpu_capacity_show (struct device *dev,struct device_attribute *attr,char *buf)
include/linux/arch_topology.h +2 -2
@@ -39,8 +39,8 @@ static inline unsigned long topology_get_thermal_pressure(int cpu)return per_cpu (thermal_pressure, cpu); } -void arch_set_thermal_pressure (struct cpumask *cpus, -unsigned long th_pressure); +void topology_set_thermal_pressure (const struct cpumask *cpus, +unsigned long th_pressure);struct cpu_topology {int thread_id;
include/linux/sched/topology.h +7 -0
@@ -232,6 +232,13 @@ unsigned long arch_scale_thermal_pressure(int cpu) }#endif +#ifndef arch_set_thermal_pressure +static __always_inline +void arch_set_thermal_pressure(const struct cpumask *cpus, +unsigned long th_pressure) +{ } +#endif +static inline int task_node (const struct task_struct *p) {return cpu_to_node (task_cpu (p));
kernel/sched/core.c +0 -11
@@ -3869,17 +3869,6 @@ unsigned long long task_sched_runtime(struct task_struct *p)return ns; } -DEFINE_PER_CPU(unsigned long, thermal_pressure); - -void arch_set_thermal_pressure (struct cpumask *cpus, -unsigned long th_pressure) -{ -int cpu; - -for_each_cpu (cpu, cpus) -WRITE_ONCE (per_cpu (thermal_pressure, cpu), th_pressure); -} -/* * This function gets called by the timer code, with HZ frequency. * We call it with interrupts disabled.
PATCH v2 2/3 sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry
In reply to Valentin SchneiderAs Russell pointed out [1], this option is severely lacking in the documentation department, and figuring out if one has the required dependencies to benefit from turning it on is not straightforward.
Make it non user-visible, and add a bit of help to it. While at it, make it depend on CPU_FREQ_THERMAL.
[1]: https://lkml.kernel.org/r/[email protected]
--- init/Kconfig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
init/Kconfig +14 -1
@@ -492,8 +492,21 @@ config HAVE_SCHED_AVG_IRQ depends on SMP config SCHED_THERMAL_PRESSURE - bool "Enable periodic averaging of thermal pressure" + bool depends on SMP + depends on CPU_FREQ_THERMAL + help + Select this option to enable thermal pressure accounting in the + scheduler. Thermal pressure is the value conveyed to the scheduler + that reflects the reduction in CPU compute capacity resulted from + thermal throttling. Thermal throttling occurs when the performance of + a CPU is capped due to high operating temperatures. + + If selected, the scheduler will be able to balance tasks accordingly, + i.e. put less load on throttled CPUs than on non/less throttled ones. + + This requires the architecture to implement + arch_set_thermal_pressure() and arch_get_thermal_pressure(). config BSD_PROCESS_ACCT bool "BSD Process Accounting"
Signature · 1 line
2.27.0
[tip: sched/core] sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 98eb401d09301d8a38c31cc8851ba95ac9385c8f Gitweb: https://git.kernel.org/tip/98eb401d09301d8a38c31cc8851ba95ac9385c8f Author: Valentin Schneider <[email protected]> AuthorDate: Sun, 12 Jul 2020 17:59:16 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 22 Jul 2020 10:22:06 +02:00
sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry
As Russell pointed out [1], this option is severely lacking in the documentation department, and figuring out if one has the required dependencies to benefit from turning it on is not straightforward.
Make it non user-visible, and add a bit of help to it. While at it, make it depend on CPU_FREQ_THERMAL.
[1]: https://lkml.kernel.org/r/[email protected]
--- init/Kconfig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
init/Kconfig +14 -1
@@ -492,8 +492,21 @@ config HAVE_SCHED_AVG_IRQ depends on SMP config SCHED_THERMAL_PRESSURE - bool "Enable periodic averaging of thermal pressure" + bool depends on SMP + depends on CPU_FREQ_THERMAL + help + Select this option to enable thermal pressure accounting in the + scheduler. Thermal pressure is the value conveyed to the scheduler + that reflects the reduction in CPU compute capacity resulted from + thermal throttling. Thermal throttling occurs when the performance of + a CPU is capped due to high operating temperatures. + + If selected, the scheduler will be able to balance tasks accordingly, + i.e. put less load on throttled CPUs than on non/less throttled ones. + + This requires the architecture to implement + arch_set_thermal_pressure() and arch_get_thermal_pressure(). config BSD_PROCESS_ACCT bool "BSD Process Accounting"
Re: [PATCH v2 2/3] sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry
In reply to Valentin SchneiderQuoted 32 lines · Valentin Schneider
As Russell pointed out [1], this option is severely lacking in the documentation department, and figuring out if one has the required dependencies to benefit from turning it on is not straightforward.
Make it non user-visible, and add a bit of help to it. While at it, make it depend on
CPU_FREQ_THERMAL.[1]: https://lkml.kernel.org/r/[email protected]
Signed-off-by Valentin Schneider <[email protected]>--- init/Kconfig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)init/Kconfig +7
-1@@ -492,8 +492,21 @@ config HAVE_SCHED_AVG_IRQ depends on SMP config SCHED_THERMAL_PRESSURE - bool "Enable periodic averaging of thermal pressure" + bool depends on SMP + depends on CPU_FREQ_THERMAL + help + Select this option to enable thermal pressure accounting in the + scheduler. Thermal pressure is the value conveyed to the scheduler + that reflects the reduction in CPU compute capacity resulted from + thermal throttling. Thermal throttling occurs when the performance of
init/Kconfig config HAVE_SCHED_AVG_IRQ · line 512
Quoted 10 lines
init/Kconfig +7
-0+ a CPU is capped due to high operating temperatures. + + If selected, the scheduler will be able to balance tasks accordingly, + i.e. put less load on throttled CPUs than on non/less throttled ones. + + This requires the architecture to implement + arch_set_thermal_pressure() and arch_get_thermal_pressure(). config BSD_PROCESS_ACCT bool "BSD Process Accounting"
On arm64 linux-next (20200727),
https://gitlab.com/cailca/linux-mm/-/blob/master/arm64.config
WARNING: unmet direct dependencies detected for SCHED_THERMAL_PRESSURE
Depends on [n]: SMP [=y] && CPU_FREQ_THERMAL [=n] Selected by [y]:
- ARM64 [=y]
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Dietmar Eggemann
reviewerRe: [PATCH v2 2/3] sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry
Quoted 46 lines · Qian Cai
Quoted 32 lines · Valentin Schneider
As Russell pointed out [1], this option is severely lacking in the documentation department, and figuring out if one has the required dependencies to benefit from turning it on is not straightforward.
Make it non user-visible, and add a bit of help to it. While at it, make it depend on
CPU_FREQ_THERMAL.[1]: https://lkml.kernel.org/r/[email protected]
Signed-off-by Valentin Schneider <[email protected]>--- init/Kconfig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)init/Kconfig +7
-1@@ -492,8 +492,21 @@ config HAVE_SCHED_AVG_IRQ depends on SMP config SCHED_THERMAL_PRESSURE - bool "Enable periodic averaging of thermal pressure" + bool depends on SMP + depends on CPU_FREQ_THERMAL + help + Select this option to enable thermal pressure accounting in the + scheduler. Thermal pressure is the value conveyed to the scheduler + that reflects the reduction in CPU compute capacity resulted from + thermal throttling. Thermal throttling occurs when the performance ofinit/Kconfig config HAVE_SCHED_AVG_IRQ · line 512
Quoted 10 lines
init/Kconfig +7
-0+ a CPU is capped due to high operating temperatures. + + If selected, the scheduler will be able to balance tasks accordingly, + i.e. put less load on throttled CPUs than on non/less throttled ones. + + This requires the architecture to implement + arch_set_thermal_pressure() and arch_get_thermal_pressure(). config BSD_PROCESS_ACCT bool "BSD Process Accounting"On arm64 linux-next (20200727),
Quoted 6 lines
https://gitlab.com/cailca/linux-mm/-/blob/master/arm64.config
WARNING: unmet direct dependencies detected for
SCHED_THERMAL_PRESSURE
Depends on [n]: SMP [=y] &&CPU_FREQ_THERMAL[=n] Selected by [y]:
- ARM64 [=y]
Not sure, but:
(1) do we wan to let people enable SCHED_THERMAL_PRESSURE for arm64 so arm64 can potentially run w/o a CPU freq cooling device?
arch/arm64/Kconfig +0 -1
@@ -192,7 +192,6 @@ config ARM64 select PCI_SYSCALL if PCI select POWER_RESET select POWER_SUPPLY - select SCHED_THERMAL_PRESSURE select SPARSE_IRQ select SWIOTLB select SYSCTL_EXCEPTION_TRACE
init/Kconfig +1 -1
@@ -492,7 +492,7 @@ config HAVE_SCHED_AVG_IRQ depends on SMP config SCHED_THERMAL_PRESSURE - bool + bool "Thermal pressure accounting" depends on SMP depends on CPU_FREQ_THERMAL help
Or
(2) should SCHED_THERMAL_PRESSURE for arm64 be enabled by default?
But then it makes no sense to allow the removal of CONFIG_CPU_FREQ_THERMAL.
linux-next/master$ make ARCH=arm64 defconfig
// Remove CONFIG_CPU_FREQ_THERMAL
linux-next/master$ grep CPU_FREQ_THERMAL .config
# CONFIG_CPU_FREQ_THERMAL is not set
linux-next/master$ makescripts/kconfig/conf --syncconfig Kconfig
WARNING: unmet direct dependencies detected for SCHED_THERMAL_PRESSURE
Depends on [n]: SMP [=y] && CPU_FREQ_THERMAL [=n] Selected by [y]:
- ARM64 [=y]
WARNING: unmet direct dependencies detected for SCHED_THERMAL_PRESSURE
Depends on [n]: SMP [=y] && CPU_FREQ_THERMAL [=n] Selected by [y]:
- ARM64 [=y]
WARNING: unmet direct dependencies detected for SCHED_THERMAL_PRESSURE
Depends on [n]: SMP [=y] && CPU_FREQ_THERMAL [=n] Selected by [y]:
- ARM64 [=y]
HOSTCC scripts/dtc/dtc.o
---
There is a similar issue with arm.
I would prefer for (1).
Re: [PATCH v2 2/3] sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry
Hi,
Quoted 116 lines · Dietmar Eggemann
Quoted 46 lines · Qian Cai
Quoted 32 lines · Valentin Schneider
As Russell pointed out [1], this option is severely lacking in the documentation department, and figuring out if one has the required dependencies to benefit from turning it on is not straightforward.
Make it non user-visible, and add a bit of help to it. While at it, make it depend on
CPU_FREQ_THERMAL.[1]: https://lkml.kernel.org/r/[email protected]
Signed-off-by Valentin Schneider <[email protected]>--- init/Kconfig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)init/Kconfig +8
-1@@ -492,8 +492,21 @@ config HAVE_SCHED_AVG_IRQ depends on SMP config SCHED_THERMAL_PRESSURE - bool "Enable periodic averaging of thermal pressure" + bool depends on SMP + depends on CPU_FREQ_THERMAL + help + Select this option to enable thermal pressure accounting in the + scheduler. Thermal pressure is the value conveyed to the scheduler + that reflects the reduction in CPU compute capacity resulted from + thermal throttling. Thermal throttling occurs when the performance of + a CPU is capped due to high operating temperatures.init/Kconfig config HAVE_SCHED_AVG_IRQ
Quoted 10 lines
init/Kconfig +6
-1+ + If selected, the scheduler will be able to balance tasks accordingly, + i.e. put less load on throttled CPUs than on non/less throttled ones. + + This requires the architecture to implement + arch_set_thermal_pressure() and arch_get_thermal_pressure(). config BSD_PROCESS_ACCT bool "BSD Process Accounting" --On arm64 linux-next (20200727),
Quoted 6 lines
https://gitlab.com/cailca/linux-mm/-/blob/master/arm64.config
WARNING: unmet direct dependencies detected for
SCHED_THERMAL_PRESSURE
Depends on [n]: SMP [=y] &&CPU_FREQ_THERMAL[=n] Selected by [y]:
- ARM64 [=y]Not sure, but:
(1) do we wan to let people enable
SCHED_THERMAL_PRESSUREfor arm64 so arm64 can potentially run w/o a CPU freq cooling device?arch/arm64/Kconfig +0
-1@@ -192,7 +192,6 @@ config ARM64 select PCI_SYSCALL if PCI select POWER_RESET select POWER_SUPPLY - select SCHED_THERMAL_PRESSURE select SPARSE_IRQ select SWIOTLB select SYSCTL_EXCEPTION_TRACEinit/Kconfig +1
-1@@ -492,7 +492,7 @@ config HAVE_SCHED_AVG_IRQ depends on SMP config SCHED_THERMAL_PRESSURE - bool + bool "Thermal pressure accounting" depends on SMP depends on CPU_FREQ_THERMAL helpOr
(2) should
SCHED_THERMAL_PRESSUREfor arm64 be enabled by default?But then it makes no sense to allow the removal of
CONFIG_CPU_FREQ_THERMAL.linux-next/master$ make ARCH=arm64 defconfig
// Remove
CONFIG_CPU_FREQ_THERMAL
linux-next/master$ grepCPU_FREQ_THERMAL.config
#CONFIG_CPU_FREQ_THERMALis not setlinux-next/master$ make
scripts/kconfig/conf--syncconfigKconfigWARNING: unmet direct dependencies detected for
SCHED_THERMAL_PRESSURE
Depends on [n]: SMP [=y] &&CPU_FREQ_THERMAL[=n] Selected by [y]:
- ARM64 [=y]WARNING: unmet direct dependencies detected for
SCHED_THERMAL_PRESSURE
Depends on [n]: SMP [=y] &&CPU_FREQ_THERMAL[=n] Selected by [y]:
- ARM64 [=y]WARNING: unmet direct dependencies detected for
SCHED_THERMAL_PRESSURE
Depends on [n]: SMP [=y] &&CPU_FREQ_THERMAL[=n] Selected by [y]:
- ARM64 [=y]
HOSTCCscripts/dtc/dtc.o
Quoted 5 lines
---
There is a similar issue with arm.
I would prefer for (1).
I went for having SCHED_THERMAL_PRESSURE in arm64/Kconfig because of where the discussion went in the original thread ([1] in the changelog).
One point is that selecting this option requires having the right infrastructure in place (arch_{set, scale}_thermal_pressure() must be redefined by the architecture), which cannot be easily expressed in Kconfig terms. Russell's point was that this is difficult for a lambda user to make sense of, and Vincent argued that this option should simply be selected at architecture level, which, given the context, makes sense IMO.
We could change the arch Kconfig into
select SCHED_THERMAL_PRESSURE if CPU_FREQ_THERMAL
but that seems redundant; this dependency is already expressed in SCHED_THERMAL_PRESSURE's definition. Is there a proper pattern to select some Kconfig option only if all of its dependencies are met?
Dietmar Eggemann
reviewerRe: [PATCH v2 2/3] sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry
Quoted 6 lines · Valentin Schneider
Hi,
Quoted 2 lines · Dietmar Eggemann
Quoted 1 line · Qian Cai
On Sun, Jul 12, 2020 at 05:59:16PM +0100, Valentin Schneider wrote:
[...]
Quoted 10 lines
I went for having
SCHED_THERMAL_PRESSUREin arm64/Kconfig because of where the discussion went in the original thread ([1] in the changelog).One point is that selecting this option requires having the right infrastructure in place (arch_{set, scale}_thermal_pressure() must be redefined by the architecture), which cannot be easily expressed in
Kconfigterms. Russell's point was that this is difficult for a lambda user to make sense of, and Vincent argued that this option should simply be selected at architecture level, which, given the context, makes sense IMO.
Quoted 7 lines
We could change the arch
Kconfigintoselect
SCHED_THERMAL_PRESSUREifCPU_FREQ_THERMALbut that seems redundant; this dependency is already expressed in SCHED_THERMAL_PRESSURE's definition. Is there a proper pattern to select some
Kconfigoption only if all of its dependencies are met?
The warning when disabling CPU_FREQ_THERMAL after make defconfig disappears, so this should be OK.
arch/arm/Kconfig +1 -1
@@ -46,7 +46,7 @@ config ARM select EDAC_ATOMIC_SCRUB select GENERIC_ALLOCATOR select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY - select SCHED_THERMAL_PRESSURE if ARM_CPU_TOPOLOGY + select SCHED_THERMAL_PRESSURE if ARM_CPU_TOPOLOGY && CPU_FREQ_THERMAL select GENERIC_ATOMIC64 if CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_CPU_AUTOPROBE
arch/arm64/Kconfig +1 -1
@@ -192,7 +192,7 @@ config ARM64 select PCI_SYSCALL if PCI select POWER_RESET select POWER_SUPPLY - select SCHED_THERMAL_PRESSURE + select SCHED_THERMAL_PRESSURE if CPU_FREQ_THERMAL select SPARSE_IRQ select SWIOTLB select SYSCTL_EXCEPTION_TRAC
Re: [PATCH v2 2/3] sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry
In reply to Valentin SchneiderQuoted 7 lines · Valentin Schneider
We could change the arch
Kconfigintoselect
SCHED_THERMAL_PRESSUREifCPU_FREQ_THERMALbut that seems redundant; this dependency is already expressed in SCHED_THERMAL_PRESSURE's definition. Is there a proper pattern to select some
Kconfigoption only if all of its dependencies are met?
How about something like this (totally untested):
---8<---
arch/arm/Kconfig +0 -1
@@ -46,7 +46,6 @@ config ARM select EDAC_ATOMIC_SCRUB select GENERIC_ALLOCATOR select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY - select SCHED_THERMAL_PRESSURE if ARM_CPU_TOPOLOGY select GENERIC_ATOMIC64 if CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_CPU_AUTOPROBE
arch/arm64/Kconfig +0 -1
@@ -192,7 +192,6 @@ config ARM64 select PCI_SYSCALL if PCI select POWER_RESET select POWER_SUPPLY - select SCHED_THERMAL_PRESSURE select SPARSE_IRQ select SWIOTLB select SYSCTL_EXCEPTION_TRACE
init/Kconfig +1 -0
@@ -493,6 +493,7 @@ config HAVE_SCHED_AVG_IRQ config SCHED_THERMAL_PRESSURE bool + default y if ARM64 || ARM_CPU_TOPOLOGY depends on SMP depends on CPU_FREQ_THERMAL help
--->8---
Thanks,
Quentin
Re: [PATCH v2 2/3] sched: Cleanup SCHED_THERMAL_PRESSURE kconfig entry
Quoted 42 lines · Quentin Perret
Quoted 7 lines · Valentin Schneider
We could change the arch
Kconfigintoselect
SCHED_THERMAL_PRESSUREifCPU_FREQ_THERMALbut that seems redundant; this dependency is already expressed in SCHED_THERMAL_PRESSURE's definition. Is there a proper pattern to select some
Kconfigoption only if all of its dependencies are met?How about something like this (totally untested):
---8<---
arch/arm/Kconfig +0
-1@@ -46,7 +46,6 @@ config ARM select EDAC_ATOMIC_SCRUB select GENERIC_ALLOCATOR select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY - select SCHED_THERMAL_PRESSURE if ARM_CPU_TOPOLOGY select GENERIC_ATOMIC64 if CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_CPU_AUTOPROBEarch/arm64/Kconfig +0
-1@@ -192,7 +192,6 @@ config ARM64 select PCI_SYSCALL if PCI select POWER_RESET select POWER_SUPPLY - select SCHED_THERMAL_PRESSURE select SPARSE_IRQ select SWIOTLB select SYSCTL_EXCEPTION_TRACEinit/Kconfig +0
-0
init/Kconfig config HAVE_SCHED_AVG_IRQ
Quoted 8 lines
init/Kconfig +1
-1@@ -493,6 +493,7 @@ config HAVE_SCHED_AVG_IRQ config SCHED_THERMAL_PRESSURE bool + default y if ARM64 || ARM_CPU_TOPOLOGY depends on SMP depends on CPU_FREQ_THERMAL help --->8---
That does seem to do just what I was looking for, thanks!
Quoted 2 lines
Thanks,
Quentin
PATCH v2 3/3 arm, arm64: Select CONFIG_SCHED_THERMAL_PRESSURE
In reply to Valentin SchneiderThis option now correctly depends on CPU_FREQ_THERMAL, so select it on the architectures that implement the required functions, arch_set_thermal_pressure() and arch_get_thermal_pressure().
--- arch/arm/Kconfig | 1 + arch/arm64/Kconfig | 1 + 2 files changed, 2 insertions(+)
arch/arm/Kconfig +1 -0
@@ -46,6 +46,7 @@ config ARM select EDAC_ATOMIC_SCRUB select GENERIC_ALLOCATOR select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY + select SCHED_THERMAL_PRESSURE if ARM_CPU_TOPOLOGY select GENERIC_ATOMIC64 if CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_CPU_AUTOPROBE
arch/arm64/Kconfig +1 -0
@@ -100,6 +100,7 @@ config ARM64 select FRAME_POINTER select GENERIC_ALLOCATOR select GENERIC_ARCH_TOPOLOGY + select SCHED_THERMAL_PRESSURE select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS_BROADCAST select GENERIC_CPU_AUTOPROBE
Signature · 1 line
2.27.0
Re: [PATCH v2 3/3] arm, arm64: Select CONFIG_SCHED_THERMAL_PRESSURE
arch/arm64/Kconfig config ARM64 · line 106
Quoted 12 lines · Valentin Schneider
arch/arm64/Kconfig +1
-0@@ -100,6 +100,7 @@ config ARM64 select FRAME_POINTER select GENERIC_ALLOCATOR select GENERIC_ARCH_TOPOLOGY + select SCHED_THERMAL_PRESSURE select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS_BROADCAST select GENERIC_CPU_AUTOPROBE
We tend to keep these in alphabetical order. Otherwise,
Re: [PATCH v2 3/3] arm, arm64: Select CONFIG_SCHED_THERMAL_PRESSURE
Quoted 16 lines · Catalin Marinas
arch/arm64/Kconfig config ARM64 · line 106
Quoted 12 lines · Valentin Schneider
arch/arm64/Kconfig +1
-0@@ -100,6 +100,7 @@ config ARM64 select FRAME_POINTER select GENERIC_ALLOCATOR select GENERIC_ARCH_TOPOLOGY + select SCHED_THERMAL_PRESSURE select GENERIC_CLOCKEVENTS select GENERIC_CLOCKEVENTS_BROADCAST select GENERIC_CPU_AUTOPROBEWe tend to keep these in alphabetical order. Otherwise,
Quoted 1 line
Acked-by Catalin Marinas <[email protected]>
Thanks! Will reorder that in v3.
[tip: sched/core] arm, arm64: Select CONFIG_SCHED_THERMAL_PRESSURE
In reply to Valentin SchneiderThe following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: e17ae7fea8714caa743aa0d5e446a25a999ad726 Gitweb: https://git.kernel.org/tip/e17ae7fea8714caa743aa0d5e446a25a999ad726 Author: Valentin Schneider <[email protected]> AuthorDate: Sun, 12 Jul 2020 17:59:17 +01:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Wed, 22 Jul 2020 10:22:06 +02:00
arm, arm64: Select CONFIG_SCHED_THERMAL_PRESSURE
This option now correctly depends on CPU_FREQ_THERMAL, so select it on the architectures that implement the required functions, arch_set_thermal_pressure() and arch_get_thermal_pressure().
--- arch/arm/Kconfig | 1 + arch/arm64/Kconfig | 1 + 2 files changed, 2 insertions(+)
arch/arm/Kconfig +1 -0
@@ -46,6 +46,7 @@ config ARM select EDAC_ATOMIC_SCRUB select GENERIC_ALLOCATOR select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY + select SCHED_THERMAL_PRESSURE if ARM_CPU_TOPOLOGY select GENERIC_ATOMIC64 if CPU_V7M || CPU_V6 || !CPU_32v6K || !AEABI select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_CPU_AUTOPROBE
arch/arm64/Kconfig +1 -0
@@ -192,6 +192,7 @@ config ARM64 select PCI_SYSCALL if PCI select POWER_RESET select POWER_SUPPLY + select SCHED_THERMAL_PRESSURE select SPARSE_IRQ select SWIOTLB select SYSCTL_EXCEPTION_TRACE
Peter Zijlstra
maintainerQuoted 4 lines · Valentin Schneider
Valentin Schneider (3):
arch_topology, sched/core: Cleanup thermal pressure definition
sched: CleanupSCHED_THERMAL_PRESSUREkconfig entry arm, arm64: SelectCONFIG_SCHED_THERMAL_PRESSURE
Thanks!
Quoted 17 lines · Valentin Schneider
Hi folks,
This stems from this thread [1] on the list. TL;DR: the thermal pressure config has no helpful documentation, and figuring out if the right dependencies are in place is not easy for a regular user.
The current landscape also paints an odd picture:
arch_set_thermal_pressure()is hardcoded insched/core.c, and is *not* architecture-definable, whilearch_get_thermal_pressure()is. Patch 1 is tackling this, the rest isKconfigstuff.Cheers,
Valentin
Quoted 8 lines
Revisions
=========v1 -> v2
--------o Remove
cpufreq_cooling.cweak function; use #define stub insched/topology.h(Vincent)
Looks good to me.
Quoted 21 lines
o Hinge arm
SCHED_THERMAL_PRESSUREselection onARM_CPU_TOPOLOGYValentin Schneider (3):
arch_topology, sched/core: Cleanup thermal pressure definition
sched: CleanupSCHED_THERMAL_PRESSUREkconfig entry arm, arm64: SelectCONFIG_SCHED_THERMAL_PRESSUREarch/arm/Kconfig | 1 + arch/arm/include/asm/topology.h | 3 ++- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/topology.h | 3 ++- drivers/base/arch_topology.c | 11 +++++++++++ include/linux/arch_topology.h | 4 ++-- include/linux/sched/topology.h | 7 +++++++ init/Kconfig | 15 ++++++++++++++- kernel/sched/core.c | 11 ----------- 9 files changed, 40 insertions(+), 16 deletions(-)--
2.27.0