Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1384148

Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real rt/deadline tasks running

From Wanpeng Li <kernellwp@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real rt/deadline tasks running
Date 2016-04-21 14:30 +0200
Message-ID <rqlU7-EL-31@gated-at.bofh.it> (permalink)
References (3 earlier) <rq8Nc-71F-37@gated-at.bofh.it> <rq8Nc-71F-35@gated-at.bofh.it> <rqbi2-Ai-3@gated-at.bofh.it> <rqkOm-8hw-15@gated-at.bofh.it> <rqlKp-zM-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


2016-04-21 20:12 GMT+08:00 Wanpeng Li <kernellwp@gmail.com>:
> 2016-04-21 19:11 GMT+08:00 Rafael J. Wysocki <rafael.j.wysocki@intel.com>:
>> On 4/21/2016 3:09 AM, Wanpeng Li wrote:
>>>
>>> 2016-04-21 6:28 GMT+08:00 Rafael J. Wysocki <rafael.j.wysocki@intel.com>:
>>>>
>>>> On 4/21/2016 12:24 AM, Wanpeng Li wrote:
>>>>>
>>>>> 2016-04-20 22:01 GMT+08:00 Peter Zijlstra <peterz@infradead.org>:
>>>>>>
>>>>>> On Wed, Apr 20, 2016 at 02:32:35AM +0200, Rafael J. Wysocki wrote:
>>>>>>>
>>>>>>> On Monday, April 18, 2016 01:51:24 PM Wanpeng Li wrote:
>>>>>>>>
>>>>>>>> Sometimes update_curr() is called w/o tasks actually running, it is
>>>>>>>> captured by:
>>>>>>>>       u64 delta_exec = rq_clock_task(rq) - curr->se.exec_start;
>>>>>>>> We should not trigger cpufreq update in this case for rt/deadline
>>>>>>>> classes, and this patch fix it.
>>>>>>>>
>>>>>>>> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
>>>>>>>
>>>>>>> The signed-off-by tag should agree with the From: header.  One way to
>>>>>>> achieve
>>>>>>> that is to add an extra From: line at the start of the changelog.
>>>>>>>
>>>>>>> That said, this looks like a good catch that should go into 4.6 to me.
>>>>>>>
>>>>>>> Peter, what do you think?
>>>>>>
>>>>>> I'm confused by the Changelog. *what* ?
>>>>>
>>>>> Sometimes .update_curr hook is called w/o tasks actually running, it is
>>>>> captured by:
>>>>>
>>>>>           u64 delta_exec = rq_clock_task(rq) - curr->se.exec_start;
>>>>>
>>>>> We should not trigger cpufreq update in this case for rt/deadline
>>>>> classes, and this patch fix it.
>>>>
>>>>
>>>> That's what you wrote in the changelog, no need to repeat that.
>>>>
>>>> I guess Peter is asking for more details, though.  I actually would like
>>>> to
>>>> get some more details here too.  Like an example of when the situation in
>>>> question actually happens.
>>>
>>> I add a print to print when delta_exec is zero for rt class, something
>>> like below:
>>>
>>>        watchdog/5-48    [005] d...   568.449095: update_curr_rt: rt
>>> delta_exec is zero
>>>        watchdog/5-48    [005] d...   568.449104: <stack trace>
>>>   => pick_next_task_rt
>>>   => __schedule
>>>   => schedule
>>>   => smpboot_thread_fn
>>>   => kthread
>>>   => ret_from_fork
>>>        watchdog/5-48    [005] d...   568.449105: update_curr_rt: rt
>>> delta_exec is zero
>>>        watchdog/5-48    [005] d...   568.449111: <stack trace>
>>>   => put_prev_task_rt
>>>   => pick_next_task_idle
>>>   => __schedule
>>>   => schedule
>>>   => smpboot_thread_fn
>>>   => kthread
>>>   => ret_from_fork
>>>        watchdog/6-56    [006] d...   568.510094: update_curr_rt: rt
>>> delta_exec is zero
>>>        watchdog/6-56    [006] d...   568.510103: <stack trace>
>>>   => pick_next_task_rt
>>>   => __schedule
>>>   => schedule
>>>   => smpboot_thread_fn
>>>   => kthread
>>>   => ret_from_fork
>>>        watchdog/6-56    [006] d...   568.510105: update_curr_rt: rt
>>> delta_exec is zero
>>>        watchdog/6-56    [006] d...   568.510111: <stack trace>
>>>   => put_prev_task_rt
>>>   => pick_next_task_idle
>>>   => __schedule
>>>   => schedule
>>>   => smpboot_thread_fn
>>>   => kthread
>>>   => ret_from_fork
>>> [...]
>>
>>
>> And the statement in your changelog follows from this I suppose. How does it
>> follow, exactly?
>
> For example, rt task A will go to sleep, an rt task B is the next
> candidate to run.
>
> __schedule()
>     -> deactivate_task(A, DEQUEUE_SLEEP)
>         -> dequeue_task_rt()
>             -> update_curr_rt()
>                 -> cpufreq_trigger_update()
>                 -> delta_exec = rq_clock_task(rq) - curr->se.exec_start;
>     [...]
>     -> pick_next_task_rt()
>         -> update_curr_rt()          =>   rq->curr is still A currently
>             -> cpufreq_trigger_update()
>             -> delta_exec = rq_clock_task(rq) - curr->se.exec_start;
>   => delta == 0, actually A is not running between these two updates
>     if (likely(prev != next)) {
>         rq->curr = B;
>        [...]
>      }

Actually I suspect that there is another cpufreq update w/ delta == 0
due to pick_next_task_rt() currently implementation:

if (prev->sched_class == &rt_sched_class)
    update_curr(rq);    =>   rq->curr is still A currently
[...]
put_prev_task(rq, prev);
    -> update_curr(rq);    =>   rq->curr is still A currently

Regards,
Wanpeng Li

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] sched/cpufreq: don't trigger cpufreq update w/o real rt/deadline tasks running Wanpeng Li <kernellwp@gmail.com> - 2016-04-18 08:00 +0200
  Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real rt/deadline tasks running "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-04-20 02:30 +0200
    Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running Wanpeng Li <kernellwp@gmail.com> - 2016-04-20 02:50 +0200
    Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running Peter Zijlstra <peterz@infradead.org> - 2016-04-20 16:10 +0200
      Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> - 2016-04-21 00:30 +0200
        Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running Wanpeng Li <kernellwp@gmail.com> - 2016-04-21 03:10 +0200
          Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running "Rafael J. Wysocki" <rafael.j.wysocki@intel.com> - 2016-04-21 13:20 +0200
            Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running Wanpeng Li <kernellwp@gmail.com> - 2016-04-21 14:20 +0200
              Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running Wanpeng Li <kernellwp@gmail.com> - 2016-04-21 14:30 +0200
          Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running Peter Zijlstra <peterz@infradead.org> - 2016-04-21 14:40 +0200
            Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running Wanpeng Li <kernellwp@gmail.com> - 2016-04-21 15:40 +0200
            Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running "Rafael J. Wysocki" <rafael@kernel.org> - 2016-04-21 19:10 +0200
              Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running Peter Zijlstra <peterz@infradead.org> - 2016-04-21 19:20 +0200
      Re: [PATCH] sched/cpufreq: don't trigger cpufreq update w/o real  rt/deadline tasks running Wanpeng Li <kernellwp@gmail.com> - 2016-04-21 00:30 +0200

csiph-web