On 01/06/16 16:54, Vincent Guittot wrote: > On 1 June 2016 at 17:31, Dietmar Eggemann <dietmar.eggem...@arm.com> wrote: >> On 30/05/16 16:52, Vincent Guittot wrote: >>> The cfs_rq->avg.last_update_time is initialize to 0 with the main effect >>> that the 1st sched_entity that will be attached, will keep its >> >> attached in .task_move_group ? >> >> I'm not sure if we can have a .switched_to() directly followed by a >> .enqueue_task() into a cfs_rq with avg.last_update_time = 0. > > I think it can happen as well if the task is not queued during the > change of scheduling class because when we attach the task in > switched_to, the task->se.avg.last_update_time will stay to 0. So when > the task will be enqueued, it will be attached one more time
You're right. So I started msc_test as an rt task in task group tg_1 (css.id=2) (1) and when it slept I changed it to become a cfs task (2). (1) # chrt -r 99 ./cg.sh /tg_1 ./msc_test (2) # chrt -o -p 0 2093 ... ---> busy [ 84.336570] dequeue_task_rt: cpu=2 comm=msc_test pid=2093 tg_css_id=2 [ 84.342948] enqueue_task_rt: cpu=1 comm=msc_test pid=2093 tg_css_id=2 ---> sleep [ 86.548655] dequeue_task_rt: cpu=1 comm=msc_test pid=2093 tg_css_id=2 [ 91.008457] switched_from_rt: cpu=1 comm=msc_test pid=2093 [ 91.013896] switched_to_fair: cpu=1 comm=msc_test pid=2093 [ 91.019336] attach_entity_load_avg: cpu=1 comm=msc_test pid=2093 last_update_time=0 tg->css.id=2 [ 91.028499] do_sched_setscheduler comm=msc_test pid=2093 policy=0 rv=0 [ 91.548807] enqueue_task_fair: cpu=1 comm=msc_test pid=2093 tg_css_id=2 [ 91.555363] attach_entity_load_avg: cpu=1 comm=msc_test pid=2093 last_update_time=91548795220 tg->css.id=2 ---> busy ...