sched: Document capacity aware scheduling
Subsystems (2)
cover sched: Document capacity aware scheduling
Hi,
This stems from John Mathew et al's documentation efforts; see the brief exchange between Dietmar and I at [1].
This is written as a standalone documentation bit, the emphasis here being on the "why" and "what" rather than the "how". I can try to rebase that on top of John's series, but I think this could go in on its own.
[1]: https://lkml.kernel.org/r/[email protected]
Cheers,
Valentin
Valentin Schneider (3):
sched: Document arch_scale_*_capacity() sched/doc: Document capacity aware scheduling sched/doc: Factorize bits between sched-energy.rst &
sched-capacity.rst
Documentation/scheduler/index.rst | 1 + Documentation/scheduler/sched-capacity.rst | 439 +++++++++++++++++++++ Documentation/scheduler/sched-energy.rst | 12 +- include/linux/sched/topology.h | 10 + kernel/sched/sched.h | 10 + 5 files changed, 462 insertions(+), 10 deletions(-) create mode 100644 Documentation/scheduler/sched-capacity.rst
Signature · 1 line
2.27.0
PATCH 1/3 sched: Document arch_scale_*_capacity()
Rather that hide their purpose in some dark, damp corner of Documentation/, add some documentation to the default implementations.
--- include/linux/sched/topology.h | 10 ++++++++++ kernel/sched/sched.h | 10 ++++++++++ 2 files changed, 20 insertions(+)
include/linux/sched/topology.h +10 -0
@@ -217,6 +217,16 @@ static inline bool cpus_share_cache(int this_cpu, int that_cpu)#endif /* !CONFIG_SMP */ #ifndef arch_scale_cpu_capacity +/** +* arch_scale_cpu_capacity - get the capacity scale factor of a given CPU. +* @cpu: the CPU in question. +* +* Return: the CPU scale factor normalized against SCHED_CAPACITY_SCALE, i.e. +* +* max_perf(cpu) +* ----------------------------- * SCHED_CAPACITY_SCALE +* max(max_perf(c) : c \in CPUs) +*/ static __always_inline unsigned long arch_scale_cpu_capacity (int cpu) {
kernel/sched/sched.h +10 -0
@@ -2049,6 +2049,16 @@ void arch_scale_freq_tick(void)#endif #ifndef arch_scale_freq_capacity +/** +* arch_scale_freq_capacity - get the frequency scale factor of a given CPU. +* @cpu: the CPU in question. +* +* Return: the frequency scale factor normalized against SCHED_CAPACITY_SCALE, i.e. +* +* f_curr +* ------ * SCHED_CAPACITY_SCALE +* f_max +*/ static __always_inline unsigned long arch_scale_freq_capacity (int cpu) {
Signature · 1 line
2.27.0
PATCH 2/3 sched/doc: Document capacity aware scheduling
In reply to Valentin SchneiderAdd some documentation detailing the concepts, requirements and implementation of capacity aware scheduling across the different scheduler classes.
--- Documentation/scheduler/index.rst | 1 + Documentation/scheduler/sched-capacity.rst | 439 +++++++++++++++++++++ 2 files changed, 440 insertions(+) create mode 100644 Documentation/scheduler/sched-capacity.rst
Documentation/scheduler/index.rst +1 -0
@@ -12,6 +12,7 @@ Linux Scheduler sched-deadline sched-design-CFS sched-domains + sched-capacity sched-energy sched-nice-design sched-rt-group
Documentation/scheduler/sched-capacity.rst new file +439 -0
439 lines not on this page · raw message
Signature · 1 line
2.27.0
[email protected]
maintainerRe: [PATCH 2/3] sched/doc: Document capacity aware scheduling
Quoted 8 lines · Valentin Schneider
Add some documentation detailing the concepts, requirements and implementation of capacity aware scheduling across the different scheduler classes.
Signed-off-by Valentin Schneider <[email protected]>--- Documentation/scheduler/index.rst | 1 + Documentation/scheduler/sched-capacity.rst | 439 +++++++++++++++++++++
How about I make this a .txt file and remove all that unreadable rst nonsense?
Re: [PATCH 2/3] sched/doc: Document capacity aware scheduling
Quoted 5 lines · On 04/08/20 12:26, [email protected] wrote:
Quoted 4 lines · Valentin Schneider
Add some documentation detailing the concepts, requirements and implementation of capacity aware scheduling across the different scheduler classes.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Valentin Schneider <[email protected]>--- Documentation/scheduler/index.rst | 1 + Documentation/scheduler/sched-capacity.rst | 439 +++++++++++++++++++++How about I make this a .txt file and remove all that unreadable rst nonsense?
I wouldn't mind *too* much, all diagrams are ASCII-based and the rest would just be plain text.
I get that the whole backtick thing is a bit annoying, but it's only there for symbols that aren't functions (since "foo()" gets automagically detected as a C reference), and because they aren't functions I would've gone for some other form of emphasis anyway (quotes or asterisks or something).
That said, Ingo picked it up early and it's already gone in via the sched/core PR.
PATCH 3/3 sched/doc: Factorize bits between sched-energy.rst & sched-capacity.rst
In reply to Valentin SchneiderDocumentation/scheduler/sched-capacity.rst ought to be the canonical place to blabber about SD_ASYM_CPUCAPACITY, so remove its explanation from sched-energy.rst and point to sched-capacity.rst instead.
--- Documentation/scheduler/sched-energy.rst | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
Documentation/scheduler/sched-energy.rst +2 -10
@@ -331,16 +331,8 @@ asymmetric CPU topologies for now. This requirement is checked at run-time by looking for the presence of the SD_ASYM_CPUCAPACITY flag when the scheduling domains are built. -The flag is set/cleared automatically by the scheduler topology code whenever -there are CPUs with different capacities in a root domain. The capacities of -CPUs are provided by arch-specific code through the arch_scale_cpu_capacity() -callback. As an example, arm and arm64 share an implementation of this callback -which uses a combination of CPUFreq data and device-tree bindings to compute the -capacity of CPUs (see drivers/base/arch_topology.c for more details). - -So, in order to use EAS on your platform your architecture must implement the -arch_scale_cpu_capacity() callback, and some of the CPUs must have a lower -capacity than others. +See Documentation/sched/sched-capacity.rst for requirements to be met for this +flag to be set in the sched_domain hierarchy. Please note that EAS is not fundamentally incompatible with SMP, but no significant savings on SMP platforms have been observed yet. This restriction
Signature · 1 line
2.27.0