Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp4223664imw; Tue, 19 Jul 2022 02:19:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uni0K8/5J9Ehszj7EnasvLFpA7PhPSxWTuib1sag7viRgAYHF1pK7YtWKqVcI13SAcxTk9 X-Received: by 2002:a17:90b:1643:b0:1f0:2094:57db with SMTP id il3-20020a17090b164300b001f0209457dbmr36686612pjb.140.1658222344930; Tue, 19 Jul 2022 02:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658222344; cv=none; d=google.com; s=arc-20160816; b=xMhCVlYmrFYGm2noDl0Oks1MQew18q5KBHzON0PxXBui+m91s73g3Qx5gC2yLKBuAp PJQGCk+TsW2tSLby2ep5OvVKVnUsOZ3mIqZ/1d9QjLbJMVa7jbAHF2iDxPNJFcnxb7ui GvLPOE52VoZoP8vweSX/H/93hkN38jsTscHxrO7G+o+8Fj5VwhmV3ZsszTiYa0TVlMP8 +LOBIQcepCXiK5WJuBkVRgNRg2Z4MF3hXNPwijkj/JuuFy7cMSnW/UQUT/HehF1Kkj2R GKZIJFTtgWSId58xmuqN0dRUf3eKplcfeW8DQHMUU1ufxVDJ+90I13n0zQzmQUQ0rbjs KxDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3vHg8DQ2Tg8YgLGt/VZUAEDbWYI/+dfDPC1iJtL/ZaQ=; b=dd3jzUd5GN5yXC0FttpQ7l/KarloGBVORs56NWM0LAN/l3Xn2a75oHuUSfhhDsfn7l ygV3eqj05f2vURwocnHKWcJVt1d+codIkTfQGyF6lPZp1bxQuz7XzsKAjA5+sFY5i1H4 w6hPkkCKGg6iyVN3B/NDXa3Ut+g+wVvpmOZScy93XVAxfodHM3lDvZruuFLYLlFePTei t3VFZlNBTQSj0T1+p2wvPlZDofoNJUXfB7Oe7cxauztP1U0tJ168uv5AVrZWTJn/AXf1 A9Y6GC77dY4BLaN+ggEJIEl/u5bsgHv7epIYS2oDICle2DqXIHjzwh1TLl+cfSO3TNdo WkgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qoaVeQy0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l2-20020a170902f68200b001635687d6a4si21734239plg.216.2022.07.19.02.18.50; Tue, 19 Jul 2022 02:19:04 -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; dkim=pass header.i=@linaro.org header.s=google header.b=qoaVeQy0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234961AbiGSItz (ORCPT + 99 others); Tue, 19 Jul 2022 04:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230134AbiGSIty (ORCPT ); Tue, 19 Jul 2022 04:49:54 -0400 Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0112D3CBCD for ; Tue, 19 Jul 2022 01:49:53 -0700 (PDT) Received: by mail-yb1-xb29.google.com with SMTP id c131so24597259ybf.9 for ; Tue, 19 Jul 2022 01:49:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3vHg8DQ2Tg8YgLGt/VZUAEDbWYI/+dfDPC1iJtL/ZaQ=; b=qoaVeQy03AOCvYuaoC3xcs18H1fPNZnmn5ICr8KOHkg/cA4JWayA+FR4H5lRLbAH6z Sp/msF5Qj7Nd1llGVhs5AyiRQ40xdcAHpj0wRGQEIWM906TArjsdTQN6hKthyWiuMVxc 7EL5+TW+9cDh90DrbQai0900mc+k0cVg4G20NK4xtA+B2PsYf6RYERN5FWPu0sgIl7Dn njSf/zwZhtctLQYxCsurCxJDpzF/VmIcmIILeiTzPVuz5CVJEh9kemu81KOs8ObC7PSO BN4eLCEEsaal8v88eULhoS7TGRErLiiuIdnHo6lD1DYfHnmUiLbJjvROCtsLXmQcL5qY dIQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3vHg8DQ2Tg8YgLGt/VZUAEDbWYI/+dfDPC1iJtL/ZaQ=; b=Jy5sUvueiKfvZ+I+2iVRhnPVLrARrG2bZ7wXYemq/v035PM5sQDTZsoYguybPjqiqz 5WEKw1D7aWvCAHsIJfrJOMPEzJl8EyEa6S62duvgONFLIRB8k+Wbt4B8WQ4oTEPYivF4 M7Edw81fIqepKu8zg9sRcNBpVc+g+yECB0NJ/bgVCHG5Z29kXLGGDYRS9L3O/4GfE+JW A+g4H+n9IRy5sFZVuNYgqepiD4KGnfpyDuNt/8Gru2HcleSJ9WWxqAknqjfBCXSUPs0x Iz9F9XwF4mFRU8AX3T8QO1BaF/5moPZSFq8r7t0LJh1W93bn3j1b077s8s61fYU/7v5n gcfA== X-Gm-Message-State: AJIora/FSpsFaHeKGpfaEpG3PEv7Vy4H0tuPDS1ue0ACjJRxxKseYBUu UmELH/wXymsHpjUwpU99Jqae73xIjCgaJS3GVrJZVWClIPg= X-Received: by 2002:a25:76cd:0:b0:66e:c634:1047 with SMTP id r196-20020a2576cd000000b0066ec6341047mr31269332ybc.241.1658220593168; Tue, 19 Jul 2022 01:49:53 -0700 (PDT) MIME-Version: 1.0 References: <20220713040430.25778-1-zhouchengming@bytedance.com> <20220713040430.25778-6-zhouchengming@bytedance.com> In-Reply-To: <20220713040430.25778-6-zhouchengming@bytedance.com> From: Vincent Guittot Date: Tue, 19 Jul 2022 10:49:41 +0200 Message-ID: Subject: Re: [PATCH v2 05/10] sched/fair: reset sched_avg last_update_time before set_task_rq() To: Chengming Zhou Cc: mingo@redhat.com, peterz@infradead.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, vschneid@redhat.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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 Wed, 13 Jul 2022 at 06:05, 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: Vincent Guittot > --- > 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); > } > > -- > 2.36.1 >