2022-02-09 18:37:31

by Vincent Donnefort

[permalink] [raw]
Subject: Re: [PATCH] sched/uclamp: New sysctl to tweak boost for uclamp tasks

[...]

> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 634d571e39d77..55019eb9c83c5 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1269,6 +1269,14 @@ unsigned int sysctl_sched_uclamp_util_max = SCHED_CAPACITY_SCALE;
> */
> unsigned int sysctl_sched_uclamp_util_min_rt_default = SCHED_CAPACITY_SCALE;
>
> +/* UCLAMP_MIN knob clamps the util_value within uclamp_min & max. By default,
> + * these uclamped tasks are also boosted to bigger cores which can impact power.
> + *
> + * This knob provides an option to turn-off 'boosting to gold cores' and
> + * just restrict to 'clamping util value' job.
> + */
> +unsigned int sysctl_sched_uclamp_util_min_to_boost = 1;
> +
> /* All clamps are required to be less or equal than these values */
> static struct uclamp_se uclamp_default[UCLAMP_CNT];
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 7cd316793f4e3..44adcbfa9eb32 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6829,7 +6829,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu, int sy
> goto unlock;
>
> latency_sensitive = uclamp_latency_sensitive(p);

I don't think this is the right tree.


> - boosted = uclamp_boosted(p);
> + boosted = sysctl_sched_uclamp_util_min_to_boost && uclamp_boosted(p);
> target_cap = boosted ? 0 : ULONG_MAX;
>
> for (; pd; pd = pd->next) {
> diff --git a/kernel/sysctl.c b/kernel/sysctl.c
> index 8f196ed2ec065..6463d60fed84e 100644
> --- a/kernel/sysctl.c
> +++ b/kernel/sysctl.c
> @@ -1882,6 +1882,15 @@ static struct ctl_table kern_table[] = {
> .mode = 0644,
> .proc_handler = sysctl_sched_uclamp_handler,
> },
> + {
> + .procname = "sched_util_clamp_min_to_boost",
> + .data = &sysctl_sched_uclamp_util_min_to_boost,
> + .maxlen = sizeof(unsigned int),
> + .mode = 0644,
> + .proc_handler = proc_dointvec_minmax,
> + .extra1 = SYSCTL_ZERO,
> + .extra2 = SYSCTL_ONE,
> + },
> #endif
> #ifdef CONFIG_SCHED_AUTOGROUP
> {
> --
> 2.17.1
>