Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp498205imw; Thu, 14 Jul 2022 05:34:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sNAqa2uZtlW33Jpegq/wUqhwbMfsvmSCldNJ0Z1HZEoeSALCjKRqNb4TXoES35gcXG5Vv/ X-Received: by 2002:aa7:c597:0:b0:43a:473b:8bae with SMTP id g23-20020aa7c597000000b0043a473b8baemr11989588edq.384.1657802069485; Thu, 14 Jul 2022 05:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657802069; cv=none; d=google.com; s=arc-20160816; b=A7MkgiB9NEdWm47Z0aeMZScEd/Wk2pobb+m47C99AIHD4H+0XnrHBqyQ/3vSWqHLRX iXBYTjRH8sSqygUvZIV6/bWW1SLbj1RR4Za3ogBE7VxDvtn26AcW1XomBrq82cM7qYUC szW5Ti2V5Iga+1HTWKnYembWWuvmBxPLFTK9SunBdIQwdei5nYJcArNI/aflS6q/Ve6Q o17k9GAbBthsyeEC+RQWA/w936tO6OHBXgxo5MtkJIgJKpPKOcgCO7IAbjt7HQEHFyAi kNZl4CslBF0g5Kjgo5YDYzxVbdOJCRiWP/RNCMVXzG0eDelUAIx3h2tWhti8dzoziaMv yl7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=H/7N6/W0+jYmhKhw+TS11MMn3X0tlvaQ/ymTPTL7Axg=; b=VZWGBYXx7OmrSqQvJBt7jebGLuwiw98LBHdxYlt3oxi6LjMLRkhbPFIeBvJ6zLIC8A YCuCtgquz04SHDmUnQur3adneEwVP3RZH8qUSAhILxGyoDqCiTlVxVIAZOmk8qEQcrzU V4tOCKwZtj1WYxzGKphPjl9KZEJe6CeO1jYZd9pYL6qEkZk9+5Bi5ExCV2M2PCT3W1gM J5hNT9WaA1vMb8Zd7SfRSu33GUgSFja3NmIsz6a6uBlk7OUcSflABbfCXdY8ET+T4t5Q RryHtnZAGZQvukzHIwbKHlP2gpvZuB36SDgcazj7fu+SK1vhrFh7STot4o2RTYNF2UgK HkyQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m13-20020a056402510d00b0043a54f78399si2335024edd.485.2022.07.14.05.34.04; Thu, 14 Jul 2022 05:34:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbiGNMcV (ORCPT + 99 others); Thu, 14 Jul 2022 08:32:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239014AbiGNMcL (ORCPT ); Thu, 14 Jul 2022 08:32:11 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AE7BF3CBD2 for ; Thu, 14 Jul 2022 05:32:10 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DA45315A1; Thu, 14 Jul 2022 05:32:10 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2B9213F792; Thu, 14 Jul 2022 05:32:09 -0700 (PDT) Message-ID: Date: Thu, 14 Jul 2022 14:31:58 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2 05/10] sched/fair: reset sched_avg last_update_time before set_task_rq() Content-Language: en-US To: Chengming Zhou , mingo@redhat.com, peterz@infradead.org, vincent.guittot@linaro.org, rostedt@goodmis.org, bsegall@google.com, vschneid@redhat.com Cc: linux-kernel@vger.kernel.org References: <20220713040430.25778-1-zhouchengming@bytedance.com> <20220713040430.25778-6-zhouchengming@bytedance.com> From: Dietmar Eggemann In-Reply-To: <20220713040430.25778-6-zhouchengming@bytedance.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/07/2022 06:04, Chengming Zhou wrote: > set_task_rq() -> set_task_rq_fair() will try to synchronize the blocked > task's sched_avg when migrate, which is not needed for already detached > task. > > task_change_group_fair() will detached the task sched_avg from prev cfs_rq > first, so reset sched_avg last_update_time before set_task_rq() to avoid that. > > Signed-off-by: Chengming Zhou Reviewed-by: Dietmar Eggemann > --- > kernel/sched/fair.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 8992ce5e73d2..171bc22bc142 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -11637,12 +11637,12 @@ void init_cfs_rq(struct cfs_rq *cfs_rq) > static void task_change_group_fair(struct task_struct *p) > { > detach_task_cfs_rq(p); > - set_task_rq(p, task_cpu(p)); > > #ifdef CONFIG_SMP > /* Tell se's cfs_rq has been changed -- migrated */ > p->se.avg.last_update_time = 0; > #endif > + set_task_rq(p, task_cpu(p)); > attach_task_cfs_rq(p); > } >