From patchwork Mon Sep 12 07:47:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 75966 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp725606qgf; Mon, 12 Sep 2016 00:48:45 -0700 (PDT) X-Received: by 10.98.201.203 with SMTP id l72mr30814921pfk.4.1473666525018; Mon, 12 Sep 2016 00:48:45 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si20400173paf.144.2016.09.12.00.48.44; Mon, 12 Sep 2016 00:48:45 -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 S1756755AbcILHsc (ORCPT + 27 others); Mon, 12 Sep 2016 03:48:32 -0400 Received: from mail-wm0-f43.google.com ([74.125.82.43]:37074 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753142AbcILHsa (ORCPT ); Mon, 12 Sep 2016 03:48:30 -0400 Received: by mail-wm0-f43.google.com with SMTP id c131so42762248wmh.0 for ; Mon, 12 Sep 2016 00:48:24 -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=uAPR5y72Cag6xHAzn0yDSUKLVV5cQazbs6naVYD8m+s=; b=WiBleQJSdRY89moXwH3OGPh7M3wxGXRWb8BYU27N0YzvLFLd4a9d95fto9oJY+lvoG i+WddiF+eZlfJLGkIA8SFJvRFNAAZ2JcshWUW4/1QPf4yNtcvEIEMq0wQzvG9PEAO4fB 9LSWZ3ODb0le21LuW8pB0/hQw2Xu0hHjGk3o8= 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=uAPR5y72Cag6xHAzn0yDSUKLVV5cQazbs6naVYD8m+s=; b=VBSjw6Owv+lkSnjy1GsJBQ4ejKx26pHoSoOO5mTp9+pCTLlDp2bQW+GyZJ98y9sy/x Pw3EkxIOxNP3BRB7uSOpJb7tapGwGF898jvx2ZEfssxO/kSsPdHW9nZHSKVXfHdFnX2Z u+u1e/pz13vQCVFtwBTcbmAh7i7/pG2FUAEmjFL5s1/FQ01eklUhuzkNCoWC15YsJgzl UvzJqrFFjYvFTdN78ilRIVIDQQ1EGQuBPXtIpCQkmfGbAmlr+kwidPBjDjoIzR794I8o 7BZlPLrgc34vv3ei+nabFqWJYVIAGdF0ynSsJwk4Nm1h6e02Fax6vzCoL++meTp0b/vg 9YlA== X-Gm-Message-State: AE9vXwOmN41RScPjUGvu21swwImBMh80xuU49MvB/vF5JD5ZaoimWu9KBM2lwnNZR37Vj2yz X-Received: by 10.28.137.212 with SMTP id l203mr9681316wmd.26.1473666504023; Mon, 12 Sep 2016 00:48:24 -0700 (PDT) Received: from localhost.localdomain (pas72-3-88-189-71-117.fbx.proxad.net. [88.189.71.117]) by smtp.gmail.com with ESMTPSA id i195sm16502821wmg.14.2016.09.12.00.48.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Sep 2016 00:48:23 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, yuyang.du@intel.com, Morten.Rasmussen@arm.com Cc: linaro-kernel@lists.linaro.org, dietmar.eggemann@arm.com, pjt@google.com, bsegall@google.com, Vincent Guittot Subject: [PATCH 1/7 v3] sched: factorize attach entity Date: Mon, 12 Sep 2016 09:47:46 +0200 Message-Id: <1473666472-13749-2-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473666472-13749-1-git-send-email-vincent.guittot@linaro.org> References: <1473666472-13749-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 a6820b3..dfd9c0c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -694,9 +694,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 @@ -761,9 +759,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 */ @@ -8498,9 +8494,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); @@ -8516,6 +8511,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;