From patchwork Tue Sep 16 00:07:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Morten Rasmussen X-Patchwork-Id: 37435 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A8E2D203E6 for ; Tue, 16 Sep 2014 00:07:34 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id z11sf2658596lbi.2 for ; Mon, 15 Sep 2014 17:07:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=Ts3fISNEKQUflLj3M7Gwz+CIfUJiO+3CuFbK2M/Zsyk=; b=FLDIP/QImLwJUTcCJWrKsyXadzq811QwEJeREYVHKwQyzjQHLdThnBCpZqqWeJ63ua wM1eS9Wisw0NPy0ckefnkT7fRzUQTGdd8RgbCBbzDOvd9+4mSkY+ph3ByNkrXQqyLub1 ZJ3ktn1Qn6EJuGBPeSAFv1M4kSNGdp22+ZQwI3AQtCY9HGZul/Vc5Hx/PdmNmQLmBQYl ids7wbsS7PFzyDWqjI9FUJLev48zuTU1IP2cg0lwYi+jPARo3Spev4jMOTNYxJwbLTW9 8RT+bFuPEELRRYBlLRn4i/fFFscAFSioM4EFkQAK82Y/W4CMt3mv2YaJRkn7tWpvi/tl 94Uw== X-Gm-Message-State: ALoCoQlYIimlfoddH3u2Fc/P1oJ/HgDzPL2CCxz3owNWxV4bzxjSoGhwWncp+Y6E2GVTMejAU4Bl X-Received: by 10.112.162.138 with SMTP id ya10mr741lbb.21.1410826053351; Mon, 15 Sep 2014 17:07:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.141 with SMTP id j13ls423121laa.5.gmail; Mon, 15 Sep 2014 17:07:33 -0700 (PDT) X-Received: by 10.152.21.195 with SMTP id x3mr32345371lae.11.1410826053148; Mon, 15 Sep 2014 17:07:33 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com [209.85.215.53]) by mx.google.com with ESMTPS id ld4si21479298lab.73.2014.09.15.17.07.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 15 Sep 2014 17:07:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by mail-la0-f53.google.com with SMTP id ge10so5663966lab.40 for ; Mon, 15 Sep 2014 17:07:33 -0700 (PDT) X-Received: by 10.112.205.39 with SMTP id ld7mr10114938lbc.40.1410826053071; Mon, 15 Sep 2014 17:07:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp306530lbb; Mon, 15 Sep 2014 17:07:32 -0700 (PDT) X-Received: by 10.70.132.167 with SMTP id ov7mr47270807pdb.45.1410826051620; Mon, 15 Sep 2014 17:07:31 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wr1si25879798pbc.203.2014.09.15.17.07.01 for ; Mon, 15 Sep 2014 17:07:31 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757174AbaIPAG6 (ORCPT + 27 others); Mon, 15 Sep 2014 20:06:58 -0400 Received: from service87.mimecast.com ([91.220.42.44]:50675 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755005AbaIPAG5 (ORCPT ); Mon, 15 Sep 2014 20:06:57 -0400 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Tue, 16 Sep 2014 01:06:53 +0100 Received: from e103034-lin.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 16 Sep 2014 01:06:51 +0100 From: Morten Rasmussen To: peterz@infradead.org, mingo@kernel.org Cc: linux-kernel@vger.kernel.org, Morten Rasmussen , Paul Turner , Ben Segall Subject: [PATCH] sched: Update task group load contributions during active load-balancing Date: Tue, 16 Sep 2014 01:07:10 +0100 Message-Id: <1410826030-26301-1-git-send-email-morten.rasmussen@arm.com> X-Mailer: git-send-email 1.7.9.5 X-OriginalArrivalTime: 16 Sep 2014 00:06:51.0918 (UTC) FILETIME=[1E0BF2E0:01CFD142] X-MC-Unique: 114091601065301501 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: morten.rasmussen@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Task group load-contributions are not updated when tasks belonging to task groups are migrated by active load-balancing. If no other task belonging to the same task group is already queued at the destination cpu the group sched_entity will be enqueued with load_avg_contrib=0. Hence, weighted_cpuload() won't reflect the newly added load. The load may remain invisible until the next tick, when the sched_entity load_avg_contrib and task group contributions are reevaluated. The enqueue loop for_each_entity(se) { enqueue_entity(cfs_rq,se) ... enqueue_entity_load_avg(cfs_rq,se) ... update_entity_load_avg(se) ... __update_entity_load_avg_contrib(se) ... ... update_cfs_rq_blocked_load(cfs_rq) ... __update_cfs_rq_tg_load_contrib(cfs_rq) ... } currently skips __update_entity_load_avg_contrib() and __update_cfs_rq_tg_load_contrib() for group entities for active load-balance migrations. The former updates the sched_entity load_avg_contrib, and the latter updates the task group contribution which is needed by the former. They must both be called to ensure that load doesn't temporarily disappear. cc: Paul Turner cc: Ben Segall Signed-off-by: Morten Rasmussen --- kernel/sched/fair.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index be9e97b..2b6e2eb 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2521,7 +2521,8 @@ static inline void update_entity_load_avg(struct sched_entity *se, else now = cfs_rq_clock_task(group_cfs_rq(se)); - if (!__update_entity_runnable_avg(now, &se->avg, se->on_rq)) + if (!__update_entity_runnable_avg(now, &se->avg, se->on_rq) && + entity_is_task(se)) return; contrib_delta = __update_entity_load_avg_contrib(se); @@ -2609,6 +2610,10 @@ static inline void enqueue_entity_load_avg(struct cfs_rq *cfs_rq, cfs_rq->runnable_load_avg += se->avg.load_avg_contrib; /* we force update consideration on load-balancer moves */ update_cfs_rq_blocked_load(cfs_rq, !wakeup); + + /* We force update group contributions on load-balancer moves */ + if (wakeup && !entity_is_task(se)) + __update_cfs_rq_tg_load_contrib(cfs_rq, 0); } /*