From patchwork Mon Oct 17 09:14:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 77723 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp300225qge; Mon, 17 Oct 2016 02:16:10 -0700 (PDT) X-Received: by 10.98.68.7 with SMTP id r7mr31339863pfa.77.1476695770545; Mon, 17 Oct 2016 02:16:10 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s90si29921445pfd.180.2016.10.17.02.16.10; Mon, 17 Oct 2016 02:16:10 -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 S934029AbcJQJPv (ORCPT + 27 others); Mon, 17 Oct 2016 05:15:51 -0400 Received: from mail-qt0-f172.google.com ([209.85.216.172]:36762 "EHLO mail-qt0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933399AbcJQJPM (ORCPT ); Mon, 17 Oct 2016 05:15:12 -0400 Received: by mail-qt0-f172.google.com with SMTP id m5so110128655qtb.3 for ; Mon, 17 Oct 2016 02:15:12 -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=rq4JqcAUFzAIPNe8FvkQdPRRc7v+Dmvj+jtYlWvevRY=; b=CMHa7OIUMGzqvKCgpg7bpd9SlZiUZZ6QDshA/tb0flgRhz5Ar6//nJON0J7hbgpYzv ShSBymW2XAm2KREby3GGKg1UdobncdZRAZzUSdXWK2m1nWiTTTsmZ9yxjF6CNVBeJFrM nflAsIXUBBSb3715PguYDj/ICo0AC5xhR/Wag= 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=rq4JqcAUFzAIPNe8FvkQdPRRc7v+Dmvj+jtYlWvevRY=; b=AQ0Gf8hY5u8dxsENnEgBKQms7ObokTrWVUC0ucYJVO2Wu0rGPejcr1emC/CuVmOgei j9j2wJJZ7Xs4mqzjt2opNP0izBUCnunUbYj2hPuOoB/iMr8ZKi/LJ5mbjImrDvoDFR2P 8LAk/LIX8i93nSeXec6jAY/8hyLHzUCGP0DSjElHi3DK9jB0wy04ng/2RtO1eYztPH78 lV0fo46hd2J8spaxhml0TrI6X/garD5v1lj4OWKtse4eENdqTbWhUyiQiBXmFe+E4iOf cmsqBl7MW+woLM912AbyRY3wU1nYFCm5G8/DHrhzwnySRpH7423tVOGyKnRI+080pSPU G+aA== X-Gm-Message-State: AA6/9RkqQQf1OTgDcK7XsdEHqLzvkQ8rTx/OqP+oPVyaKlvE4MuNTkXFIHOdrUbvmS50h9s1 X-Received: by 10.28.18.5 with SMTP id 5mr2284828wms.35.1476695711386; Mon, 17 Oct 2016 02:15:11 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:8bd4:7750:80a0:ca36:f872:d659]) by smtp.gmail.com with ESMTPSA id f2sm51341206wjr.2.2016.10.17.02.15.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Oct 2016 02:15:10 -0700 (PDT) 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, linaro-kernel@lists.linaro.org, pjt@google.com, bsegall@google.com, kernellwp@gmail.com, Vincent Guittot Subject: [PATCH 5/6 v5] sched: propagate asynchrous detach Date: Mon, 17 Oct 2016 11:14:12 +0200 Message-Id: <1476695653-12309-6-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1476695653-12309-1-git-send-email-vincent.guittot@linaro.org> References: <1476695653-12309-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 advanatge 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 91fc949..4c0a404 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3231,6 +3231,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)) { @@ -3238,6 +3239,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, @@ -6803,6 +6805,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); }