Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2262188pxa; Mon, 17 Aug 2020 05:32:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzSlVWuLhph93cWMQFKDwetL7vIpu91RSlOm6CMkidaSxPf6G6IPVJN7B0fpGdFKFhhiB4 X-Received: by 2002:a05:6402:1d32:: with SMTP id dh18mr14658326edb.14.1597667550729; Mon, 17 Aug 2020 05:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597667550; cv=none; d=google.com; s=arc-20160816; b=VJSRwW2u0Muuk3kElRuKObRrEkOW2yKSJP/X10sjBBlFcH82GjFz5JgMLtSQet7fSx zdo0wG2EURBlHi3Yt8tl13E3CEtDAaQe8r3F54x3PMxeVnNU/PSGc3JE0ybk1XXqVRBg AhMbrgD376WBUFzIR/YDZzcWgULgR//u+6MMOtGVdxm9U0Yk+FRafE11hy9POVzVHfxy foxCjFVpmcXj5ZbrKA0AECDWg5VLnZdgGHw4VlDE6pwUyUr9oxwuLO4wm51W57Qzg+ye LgZN6S4Qvy7PjXSatHtg5BDa6YwsFFBc9aDtBZqFImZetMcLCXnKk1EFBbd4B9fth0qv WZAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=r+bGkP+8h4hb9+jTLaJykk/68XOb5GgDX8fwDvwh0WQ=; b=Prc6HAxs5dUe3hxtCvQvJy8VghUH6198fZXsvYE767sTDEjiQEizKxALtn4JEvH6eR 7lYWogzrgqbSgmwEhOfoXAq7YPPf+bswqLTci8foACGZ++kpIYZu513hLWNxNMnbEsKJ yDAmBl5odz2ik/ae7r0rOhvm3fW9YsAyCfdv1dkslkG+My1Zmy3kZSaCcNJNsD8CTEjL u60DLeeA4YCmIRgRNGaGkogclpthwrFsrqqDA+QdlfNHm35VQlqG/78A+xy7G6TozD3d 2TYcRc3WoL6KA4YrM72iIg/0h02nO97aBYf0DeUtiiA7vTgknd//vdoLrUFNHhuZkAaI q1Kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j18si10917204edq.576.2020.08.17.05.32.06; Mon, 17 Aug 2020 05:32:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728364AbgHQM2N (ORCPT + 99 others); Mon, 17 Aug 2020 08:28:13 -0400 Received: from foss.arm.com ([217.140.110.172]:54426 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726265AbgHQM2M (ORCPT ); Mon, 17 Aug 2020 08:28:12 -0400 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 9925030E; Mon, 17 Aug 2020 05:28:11 -0700 (PDT) Received: from [192.168.178.2] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4FE223F66B; Mon, 17 Aug 2020 05:28:05 -0700 (PDT) Subject: Re: [PATCH v3] sched/fair: simplfy the work when reweighting entity To: Jiang Biao , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org Cc: rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org, Jiang Biao References: <20200811113209.34057-1-benbjiang@tencent.com> From: Dietmar Eggemann Message-ID: <4a0e414a-7662-58f5-f9ef-b1796552b9be@arm.com> Date: Mon, 17 Aug 2020 14:28:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200811113209.34057-1-benbjiang@tencent.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/08/2020 13:32, Jiang Biao wrote: > From: Jiang Biao > > The code in reweight_entity() can be simplified. > > For a sched entity on the rq, the entity accounting can be replaced by > cfs_rq instantaneous load updates currently called from within the > entity accounting. > > Even though an entity on the rq can't represent a task in > reweight_entity() (a task is always dequeued before calling this > function) and so the numa task accounting and the rq->cfs_tasks list > management of the entity accounting are never called, the redundant > cfs_rq->nr_running decrement/increment will be avoided. > > Signed-off-by: Jiang Biao > --- > v3<-v2: Amend commit log taking Dietmar's advice. Thx. > v2<-v1: Amend the commit log > > kernel/sched/fair.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 04fa8dbcfa4d..18a8fc7bd0de 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -3086,7 +3086,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, > /* commit outstanding execution time */ > if (cfs_rq->curr == se) > update_curr(cfs_rq); > - account_entity_dequeue(cfs_rq, se); > + update_load_sub(&cfs_rq->load, se->load.weight); > } > dequeue_load_avg(cfs_rq, se); > > @@ -3102,7 +3102,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, > > enqueue_load_avg(cfs_rq, se); > if (se->on_rq) > - account_entity_enqueue(cfs_rq, se); > + update_load_add(&cfs_rq->load, se->load.weight); > > } Reviewed-by: Dietmar Eggemann