From patchwork Tue Nov 8 09:53: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: 81270 Delivered-To: patch@linaro.org Received: by 10.182.113.165 with SMTP id iz5csp1596440obb; Tue, 8 Nov 2016 01:55:35 -0800 (PST) X-Received: by 10.99.196.70 with SMTP id m6mr5565516pgg.118.1478598935100; Tue, 08 Nov 2016 01:55:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si36046617pgj.255.2016.11.08.01.55.34; Tue, 08 Nov 2016 01:55:35 -0800 (PST) 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 S932402AbcKHJzb (ORCPT + 27 others); Tue, 8 Nov 2016 04:55:31 -0500 Received: from mail-wm0-f52.google.com ([74.125.82.52]:36296 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932840AbcKHJyk (ORCPT ); Tue, 8 Nov 2016 04:54:40 -0500 Received: by mail-wm0-f52.google.com with SMTP id p190so234816110wmp.1 for ; Tue, 08 Nov 2016 01:54:40 -0800 (PST) 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=hZQSKB8b2AnQu9knGCm/pGGx6BRwurMiC3Yzu00sxSg=; b=jrFXb0bS8Kdw8IbY+K0k8MzzC02H2kaGV4FY3BQyKcHQZpaUO3qh5CU+4qUYc729qr PfrI3EGpiJ6lwoLtKNYE+Hw3xpRNkoZ1u8HKlswrIuFpIjPBMcq/kpzng5xMUgJbnmuB CkEAcOcUfxhMwa6b9XWLksN5nZkp2Aibv++5M= 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=hZQSKB8b2AnQu9knGCm/pGGx6BRwurMiC3Yzu00sxSg=; b=DxctSHiHY13JglbAWPmV80CN1WXnHPayLe92v2754Pic7BYG2xfR/NqNeonvvMXBW5 df9wB/KvVELZfkYp58K2jtn09B6fXUhRIynFuDbvnArHY+GKM1Pfr4+wtAlsdcSUMw/i d1IgTaTmhFypk7WsmdhZrdMdyvH29FDCu/yhGTfHqODNCbVdqo88kILB64JWbmQRsaNd Zu3WxGlYSCoclUBJi0sG0OP5trjl6Er86DRzeq2HEX435feVOhz4DMItjR4RqLdm73cz jXxhe5Hp0fPxW76AvawxaCfx5/S6R+mbqLvEImzqRWMMptZeEdbbfXFBtYGuLADjfDjN UDlQ== X-Gm-Message-State: ABUngveAJo8u2y+3Ql/FArNhkmI5C28KHTOgXPnFEqoYzLSyjiyN1LjxoFnzVQyLChmNw5wk X-Received: by 10.194.248.43 with SMTP id yj11mr9339241wjc.81.1478598879326; Tue, 08 Nov 2016 01:54:39 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:8bd4:7750:6483:2475:9666:6640]) by smtp.gmail.com with ESMTPSA id p13sm18606435wmd.20.2016.11.08.01.54.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Nov 2016 01:54:38 -0800 (PST) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com Cc: yuyang.du@intel.com, Morten.Rasmussen@arm.com, pjt@google.com, bsegall@google.com, kernellwp@gmail.com, Vincent Guittot Subject: [PATCH 5/6 v7] sched: propagate asynchrous detach Date: Tue, 8 Nov 2016 10:53:46 +0100 Message-Id: <1478598827-32372-6-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478598827-32372-1-git-send-email-vincent.guittot@linaro.org> References: <1478598827-32372-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 A task can be asynchronously detached from cfs_rq when migrating between CPUs. The load of the migrated task is then removed from source cfs_rq during its next update. We use this event to set propagation flag. During the load balance, we take advantage of the update of blocked load to propagate any pending changes.The propagation relies on patch "sched: fix hierarchical order in rq->leaf_cfs_rq_list", which orders children and parents, to ensure that it's done in one pass. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e47bb046..8abed16 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3235,6 +3235,7 @@ update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq, bool update_freq) sub_positive(&sa->load_avg, r); sub_positive(&sa->load_sum, r * LOAD_AVG_MAX); removed_load = 1; + set_tg_cfs_propagate(cfs_rq); } if (atomic_long_read(&cfs_rq->removed_util_avg)) { @@ -3242,6 +3243,7 @@ update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq, bool update_freq) sub_positive(&sa->util_avg, r); sub_positive(&sa->util_sum, r * LOAD_AVG_MAX); removed_util = 1; + set_tg_cfs_propagate(cfs_rq); } decayed = __update_load_avg(now, cpu_of(rq_of(cfs_rq)), sa, @@ -6818,6 +6820,10 @@ static void update_blocked_averages(int cpu) if (update_cfs_rq_load_avg(cfs_rq_clock_task(cfs_rq), cfs_rq, true)) update_tg_load_avg(cfs_rq, 0); + + /* Propagate pending load changes to the parent */ + if (cfs_rq->tg->se[cpu]) + update_load_avg(cfs_rq->tg->se[cpu], 0); } raw_spin_unlock_irqrestore(&rq->lock, flags); }