Message ID | 20200712165917.9168-3-valentin.schneider@arm.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
Series | sched, arch_topology: Thermal pressure configuration cleanup | expand |
On Sun, Jul 12, 2020 at 05:59:16PM +0100, Valentin Schneider wrote: > 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/20200603173150.GB1551@shell.armlinux.org.uk > > Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> > --- > init/Kconfig | 15 ++++++++++++++- > 1 file changed, 14 insertions(+), 1 deletion(-) > > diff --git a/init/Kconfig b/init/Kconfig > index 0498af567f70..0a97d85568b2 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -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" > -- 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]
On 27/07/2020 16:18, Qian Cai wrote: > On Sun, Jul 12, 2020 at 05:59:16PM +0100, Valentin Schneider wrote: >> 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/20200603173150.GB1551@shell.armlinux.org.uk >> >> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> >> --- >> init/Kconfig | 15 ++++++++++++++- >> 1 file changed, 14 insertions(+), 1 deletion(-) >> >> diff --git a/init/Kconfig b/init/Kconfig >> index 0498af567f70..0a97d85568b2 100644 >> --- a/init/Kconfig >> +++ b/init/Kconfig >> @@ -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" >> -- > > 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] 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? diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 2d4abbc9f8d0..baffe8b66da2 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -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 diff --git a/init/Kconfig b/init/Kconfig index 37b089f87804..8b36e07fb230 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -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$ make scripts/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).
Hi, On 27/07/20 18:45, Dietmar Eggemann wrote: > On 27/07/2020 16:18, Qian Cai wrote: >> On Sun, Jul 12, 2020 at 05:59:16PM +0100, Valentin Schneider wrote: >>> 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/20200603173150.GB1551@shell.armlinux.org.uk >>> >>> Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> >>> --- >>> init/Kconfig | 15 ++++++++++++++- >>> 1 file changed, 14 insertions(+), 1 deletion(-) >>> >>> diff --git a/init/Kconfig b/init/Kconfig >>> index 0498af567f70..0a97d85568b2 100644 >>> --- a/init/Kconfig >>> +++ b/init/Kconfig >>> @@ -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" >>> -- >> >> 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] > > 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? > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index 2d4abbc9f8d0..baffe8b66da2 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -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 > diff --git a/init/Kconfig b/init/Kconfig > index 37b089f87804..8b36e07fb230 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -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$ make > scripts/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). 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?
On 28/07/2020 18:16, Valentin Schneider wrote: > > Hi, > > On 27/07/20 18:45, Dietmar Eggemann wrote: >> On 27/07/2020 16:18, Qian Cai wrote: >>> On Sun, Jul 12, 2020 at 05:59:16PM +0100, Valentin Schneider wrote: [...] > 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? The warning when disabling CPU_FREQ_THERMAL after make defconfig disappears, so this should be OK. diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 939c4d6bbc2e..a677e71b3d5f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -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 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index c403e6f5db86..59ae16f8b941 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -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
On Tuesday 28 Jul 2020 at 17:16:57 (+0100), Valentin Schneider wrote: > 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? How about something like this (totally untested): ---8<--- diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 939c4d6bbc2e..2ac74904a3ce 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -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 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index c403e6f5db86..66dc41fd49f2 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -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 diff --git a/init/Kconfig b/init/Kconfig index 0a97d85568b2..c2e1f3ac527e 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -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
On 29/07/20 14:09, Quentin Perret wrote: > On Tuesday 28 Jul 2020 at 17:16:57 (+0100), Valentin Schneider wrote: >> 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? > > How about something like this (totally untested): > > ---8<--- > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > index 939c4d6bbc2e..2ac74904a3ce 100644 > --- a/arch/arm/Kconfig > +++ b/arch/arm/Kconfig > @@ -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 > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > index c403e6f5db86..66dc41fd49f2 100644 > --- a/arch/arm64/Kconfig > +++ b/arch/arm64/Kconfig > @@ -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 > diff --git a/init/Kconfig b/init/Kconfig > index 0a97d85568b2..c2e1f3ac527e 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -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! > Thanks, > Quentin
diff --git a/init/Kconfig b/init/Kconfig index 0498af567f70..0a97d85568b2 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -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"
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/20200603173150.GB1551@shell.armlinux.org.uk Signed-off-by: Valentin Schneider <valentin.schneider@arm.com> --- init/Kconfig | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)