Re: [RFC PATCH 24/24] sched/time: Introduce CLOCK_THREAD_DVFS_ID

Christian Loehle
2024-08-19T11:11:09Z

On 7/27/24 11:27, Peter Zijlstra wrote:
> In order to measure thread time in a DVFS world, introduce
> CLOCK_THREAD_DVFS_ID -- a copy of CLOCK_THREAD_CPUTIME_ID that slows
> down with both DVFS scaling and CPU capacity.
>
> The clock does *NOT* support setting timers.
>
> Useful for both SCHED_DEADLINE and the newly introduced
> sched_attr::sched_runtime usage for SCHED_NORMAL.
>

How will this look like in practice then?
Is it up to userspace to adjust sched_runtime to capacity/dvfs
accordingly every time it changes? I guess not.
Will sched_attr::sched_runtime be for CPUCLOCK_DVFS by default?
I assume that would be a uapi change?
Do we need an additional flag in sched_attr to specify the clock
to be measured against?

> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> include/linux/posix-timers_types.h | 5 ++--
> include/linux/sched.h | 1
> include/linux/sched/cputime.h | 3 ++
> include/uapi/linux/time.h | 1
> kernel/sched/core.c | 40 +++++++++++++++++++++++++++++++++++++
> kernel/sched/fair.c | 8 +++++--
> kernel/time/posix-cpu-timers.c | 16 +++++++++++++-
> kernel/time/posix-timers.c | 1
> kernel/time/posix-timers.h | 1
> 9 files changed, 71 insertions(+), 5 deletions(-)
>
> --- a/include/linux/posix-timers_types.h
> +++ b/include/linux/posix-timers_types.h
> @@ -13,9 +13,9 @@
> *
> * Bit 2 indicates whether a cpu clock refers to a thread or a process.
> *
> - * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3.
> + * Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or DVSF=3

s/DVSF/DVFS

> [snip]