Re: [PATCH v7] sched: Consolidate cpufreq updates

From: Qais Yousef
Date: Sun Feb 09 2025 - 17:41:14 EST


On 10/11/24 10:34, Christian Loehle wrote:

> > @@ -796,7 +802,8 @@ int __sched_setscheduler(struct task_struct *p,
> > __setscheduler_params(p, attr);
> > __setscheduler_prio(p, newprio);
> > }
> > - __setscheduler_uclamp(p, attr);
> > +
> > + update_cpufreq = __setscheduler_uclamp(p, attr);
> >
> > if (queued) {
> > /*
> > @@ -811,7 +818,18 @@ int __sched_setscheduler(struct task_struct *p,
> > if (running)
> > set_next_task(rq, p);
> >
> > - check_class_changed(rq, p, prev_class, oldprio);
> > + update_cpufreq |= check_class_changed(rq, p, prev_class, oldprio);
> > +
> > + /*
> > + * Changing class or uclamp value implies requiring to send cpufreq
> > + * update.
> > + */
> > + if (update_cpufreq) {
> > + if (running)
> > + update_cpufreq_current(rq);
> > + else if (queued)
> > + cpufreq_update_util(rq, SCHED_CPUFREQ_TASK_ENQUEUED);
> > + }
>
> cpufreq_update_util() -> sugov_should_update_freq() -> cpufreq_this_cpu_can_update()
> relies on smp_processor_id(), should this move this below the
> preempt_disable() to avoid sending an update from an illegal CPU?

We are holding the task_rq_lock() with interrupts disabled, we should be okay
no?

Did you see an actual warning from LOCKDEP?