From patchwork Tue Nov 8 08:26:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 81251 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1428789qge; Tue, 8 Nov 2016 00:26:48 -0800 (PST) X-Received: by 10.98.13.130 with SMTP id 2mr20201393pfn.185.1478593608151; Tue, 08 Nov 2016 00:26:48 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e19si32957786pgk.268.2016.11.08.00.26.47; Tue, 08 Nov 2016 00:26:48 -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 S932358AbcKHI0h (ORCPT + 27 others); Tue, 8 Nov 2016 03:26:37 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:37410 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932188AbcKHI0e (ORCPT ); Tue, 8 Nov 2016 03:26:34 -0500 Received: by mail-wm0-f47.google.com with SMTP id t79so223534739wmt.0 for ; Tue, 08 Nov 2016 00:26:28 -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=+uDwZadi31x5hE6LWUOFfD1BOWBfr75OXNzqvdwpkVA=; b=cg7E9LEh1b3y7uBMepeBq04x6aOS8LzKGtFsK7bULQVbZxUn+JjumFv5jlKXI33RLo i0YGBxgCLAhjr8lv3KaECO1lV7MncjouyUarN/3cpatN3Z1GE543EXpLfDpmxt2Cm+8L BrEzIizts0iufmSjYDIkmQarUPmB4FN5h6PdM= 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=+uDwZadi31x5hE6LWUOFfD1BOWBfr75OXNzqvdwpkVA=; b=Cdo1UhxmM8fQMUEvM1woUBC1VaDhQKHEaBqs3MLSEtsYLn4qMfWxwuna85gpy7jslf ouuZQMv/DtihHLYB54PGrXODk3tTsdcQJWWQST9Lq49AF+v8KfPV5x5+VqjFaJCZHCII 3k0wl3PeKiZLml6ryVMQH0H6f/CvxJVF2e7MJ36IH3rZ73LbRnFWGpj5fE4Uw6amsDDT ffvZdEbU26v9Xddn/Z7PfsKdtxS/A5s9pIUW0nk2Jd7aqRy+gt+knVDRe6K9N954H3Jq 1sQOYQwrOMnz3nPXN487LYapbJF0z3UJilDLyX9RkJI+gH229k7vdt83bsDFXzr5BwoT jGYQ== X-Gm-Message-State: ABUngvdgB+yo6ZhH3UT5s3Xu8FAJh6BysUZ566a1Minu/CMHVNaVRkAev6Qs91LEESwCoMFl X-Received: by 10.194.96.135 with SMTP id ds7mr8872392wjb.29.1478593588031; Tue, 08 Nov 2016 00:26:28 -0800 (PST) Received: from localhost.localdomain ([2a01:e35:8bd4:7750:6483:2475:9666:6640]) by smtp.gmail.com with ESMTPSA id w1sm35670015wje.36.2016.11.08.00.26.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Nov 2016 00:26:27 -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 v6] sched: propagate asynchrous detach Date: Tue, 8 Nov 2016 09:26:11 +0100 Message-Id: <1478593572-26671-6-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478593572-26671-1-git-send-email-vincent.guittot@linaro.org> References: <1478593572-26671-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 184b544..a2412dc 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); }