Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection
From: Rafael J. Wysocki
Date: Thu Feb 25 2016 - 06:02:32 EST
On Thursday, February 25, 2016 04:55:57 AM Rafael J. Wysocki wrote:
> Hi,
>
[cut]
> > + while (true) {
> > + set_current_state(TASK_INTERRUPTIBLE);
> > + if (kthread_should_stop()) {
> > + set_current_state(TASK_RUNNING);
> > + break;
> > + }
> > + new_request = gd->requested_freq;
> > + if (!gd->enabled || new_request == last_request) {
>
> This generally is a mistake.
>
> You can't assume that if you had requested a CPU to enter a specific P-state,
> that state was actually entered. In the platform-coordinated case the hardware
> (or firmware) may choose to ignore your request and you won't be told about
> that.
>
> For this reason, you generally need to make the request every time even if it
> is identical to the previous one. Even in the one-CPU-per-policy case there
> may be HW coordination you don't know about.
Please scratch this bit, actually (and analogous comments below).
It is reasonable to expect that the platform will remember your last request,
so you don't have to repeat it.
Which means that I can optimize the schedutil thing somewhat. :-)
Thanks,
Rafael