Re: [RESEND][PATCH v2 3/3] schedutil: trace: Add tracing to capture filter out requests
From: Qais Yousef
Date: Wed May 31 2023 - 14:31:24 EST
On 05/22/23 15:57, Lukasz Luba wrote:
> Some of the frequency update requests coming form the task scheduler
> might be filter out. It can happen when the previous request was served
> not that long ago (in a period smaller than provided by the cpufreq driver
> as minimum for frequency update). In such case, we want to know if some of
> the frequency updates cannot make through.
> Export the new tracepoint as well. That would allow to handle it by a
> toolkit for trace analyzes.
>
> Reported-by: kernel test robot <lkp@xxxxxxxxx> # solved tricky build
> Signed-off-by: Lukasz Luba <lukasz.luba@xxxxxxx>
> ---
> include/trace/events/sched.h | 4 ++++
> kernel/sched/cpufreq_schedutil.c | 10 ++++++++--
> 2 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> index dbfb30809f15..e34b7cd5de73 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -739,6 +739,10 @@ DECLARE_TRACE(uclamp_update_tsk_tp,
> TP_PROTO(struct task_struct *tsk, int uclamp_id, unsigned int value),
> TP_ARGS(tsk, uclamp_id, value));
>
> +DECLARE_TRACE(schedutil_update_filtered_tp,
> + TP_PROTO(int cpu),
> + TP_ARGS(cpu));
> +
> #endif /* _TRACE_SCHED_H */
>
> /* This part must be outside protection */
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index f462496e5c07..4f9daf258a65 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -6,6 +6,8 @@
> * Author: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> */
>
> +EXPORT_TRACEPOINT_SYMBOL_GPL(schedutil_update_filtered_tp);
> +
> #define IOWAIT_BOOST_MIN (SCHED_CAPACITY_SCALE / 8)
>
> struct sugov_tunables {
> @@ -318,8 +320,10 @@ static inline bool sugov_update_single_common(struct sugov_cpu *sg_cpu,
>
> ignore_dl_rate_limit(sg_cpu);
>
> - if (!sugov_should_update_freq(sg_cpu->sg_policy, time))
> + if (!sugov_should_update_freq(sg_cpu->sg_policy, time)) {
> + trace_schedutil_update_filtered_tp(sg_cpu->cpu);
> return false;
> + }
Can't we have something more generic here too? Are you interested to count
these events? How do you plan to use it?
I think this will be a very noisy event by the way.
Thanks
--
Qais Yousef
>
> sugov_get_util(sg_cpu);
> sugov_iowait_apply(sg_cpu, time, max_cap);
> @@ -446,8 +450,10 @@ sugov_update_shared(struct update_util_data *hook, u64 time, unsigned int flags)
>
> ignore_dl_rate_limit(sg_cpu);
>
> - if (!sugov_should_update_freq(sg_policy, time))
> + if (!sugov_should_update_freq(sg_policy, time)) {
> + trace_schedutil_update_filtered_tp(sg_cpu->cpu);
> goto unlock;
> + }
>
> next_f = sugov_next_freq_shared(sg_cpu, time);
>
> --
> 2.25.1
>