From patchwork Mon Sep 26 12:19:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 77023 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1145926qgf; Mon, 26 Sep 2016 05:20:39 -0700 (PDT) X-Received: by 10.66.164.227 with SMTP id yt3mr38599670pab.117.1474892439566; Mon, 26 Sep 2016 05:20:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e79si25017307pfb.162.2016.09.26.05.20.38; Mon, 26 Sep 2016 05:20:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941400AbcIZMUY (ORCPT + 27 others); Mon, 26 Sep 2016 08:20:24 -0400 Received: from mail-pf0-f176.google.com ([209.85.192.176]:33157 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933347AbcIZMUU (ORCPT ); Mon, 26 Sep 2016 08:20:20 -0400 Received: by mail-pf0-f176.google.com with SMTP id 21so65448527pfy.0 for ; Mon, 26 Sep 2016 05:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oVZ19vRnw1wizvKyZSdVWMl0caYgjCsCFZsSZ2iiOJU=; b=XgHWba2jythDQGWfqE1idU4iwMxMbXPkvjrfrrxOqu1VDSOYvWQNReIrK58YegLby2 7U5wP8Ibts6vUIl0x6rbB5GAUpW+2zH9P6tsya7Im890bIkShT1gujOjKFaoB/Pn0Y1z O+n6ucB6r8B4pdrLK21VcY/SzVt4OsCkCETCM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oVZ19vRnw1wizvKyZSdVWMl0caYgjCsCFZsSZ2iiOJU=; b=E2JbncrEFkdordPL5FLDHvPkQFHrX22+ihgLBUHydzxhQqU54U1BlgUOSv7ZnR5gJs YRkynE57BhviI9BiyClwiRBsQWJ2hd5zE57g8zVp4hPOygLjUxIYF/LNzDg4AGC6RNdK cFlRMkVjRICQ5RY1FGESVqdmKvMNB1l7g7tnWPFf3/RjgvzXYgGKQGMhbz5xIZ4TEg64 dOnI1dBp5egfSA1a/N4zacZyGE6UO1B7nVZoByKG6r9dO1InopxVPnlOv3yBnaX7yA1d aCCfJAugKuvravzxLnA83rX6W+6CoSi+9ifLZQV6e4Q0Dalc7OqQzy/WuG+UDOVkHWgN ZGJQ== X-Gm-Message-State: AE9vXwMTGKlaCvr4lLhLXJkL2M9pG9bndd+BpKXEdY8zBXWbUEQpf9j0cEVrkt4iL0QBCoFB X-Received: by 10.98.74.142 with SMTP id c14mr37684858pfj.29.1474892419457; Mon, 26 Sep 2016 05:20:19 -0700 (PDT) Received: from localhost.localdomain ([67.238.99.186]) by smtp.gmail.com with ESMTPSA id i62sm30773860pfg.89.2016.09.26.05.20.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Sep 2016 05:20:18 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com, kernellwp@gmail.com Cc: yuyang.du@intel.com, Morten.Rasmussen@arm.com, linaro-kernel@lists.linaro.org, pjt@google.com, bsegall@google.com, Vincent Guittot Subject: [PATCH 1/7 v4] sched: factorize attach entity Date: Mon, 26 Sep 2016 14:19:47 +0200 Message-Id: <1474892393-5095-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474892393-5095-1-git-send-email-vincent.guittot@linaro.org> References: <1474892393-5095-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Factorize post_init_entity_util_avg and part of attach_task_cfs_rq in one function attach_entity_cfs_rq Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) -- 1.9.1 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 986c10c..e8ed8d1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -697,9 +697,7 @@ void init_entity_runnable_average(struct sched_entity *se) } static inline u64 cfs_rq_clock_task(struct cfs_rq *cfs_rq); -static int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq, bool update_freq); -static void update_tg_load_avg(struct cfs_rq *cfs_rq, int force); -static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se); +static void attach_entity_cfs_rq(struct sched_entity *se); /* * With new tasks being created, their initial util_avgs are extrapolated @@ -764,9 +762,7 @@ void post_init_entity_util_avg(struct sched_entity *se) } } - update_cfs_rq_load_avg(now, cfs_rq, false); - attach_entity_load_avg(cfs_rq, se); - update_tg_load_avg(cfs_rq, false); + attach_entity_cfs_rq(se); } #else /* !CONFIG_SMP */ @@ -8501,9 +8497,8 @@ static void detach_task_cfs_rq(struct task_struct *p) update_tg_load_avg(cfs_rq, false); } -static void attach_task_cfs_rq(struct task_struct *p) +static void attach_entity_cfs_rq(struct sched_entity *se) { - struct sched_entity *se = &p->se; struct cfs_rq *cfs_rq = cfs_rq_of(se); u64 now = cfs_rq_clock_task(cfs_rq); @@ -8519,6 +8514,14 @@ static void attach_task_cfs_rq(struct task_struct *p) update_cfs_rq_load_avg(now, cfs_rq, false); attach_entity_load_avg(cfs_rq, se); update_tg_load_avg(cfs_rq, false); +} + +static void attach_task_cfs_rq(struct task_struct *p) +{ + struct sched_entity *se = &p->se; + struct cfs_rq *cfs_rq = cfs_rq_of(se); + + attach_entity_cfs_rq(se); if (!vruntime_normalized(p)) se->vruntime += cfs_rq->min_vruntime;