From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752641AbcFFTcx (ORCPT ); Mon, 6 Jun 2016 15:32:53 -0400 Received: from foss.arm.com ([217.140.101.70]:39157 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751085AbcFFTcw (ORCPT ); Mon, 6 Jun 2016 15:32:52 -0400 Subject: Re: [PATCH v3] sched: fix first task of a task group is attached twice To: Vincent Guittot References: <1464623541-25429-1-git-send-email-vincent.guittot@linaro.org> <574EFFBD.5060803@arm.com> Cc: Peter Zijlstra , Ingo Molnar , linux-kernel , Yuyang Du From: Dietmar Eggemann Message-ID: <5755CFE1.4020005@arm.com> Date: Mon, 6 Jun 2016 20:32:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/06/16 16:54, Vincent Guittot wrote: > On 1 June 2016 at 17:31, Dietmar Eggemann 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 ...