From patchwork Mon Sep 12 07:47:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 75971 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp725826qgf; Mon, 12 Sep 2016 00:49:32 -0700 (PDT) X-Received: by 10.66.152.238 with SMTP id vb14mr30841087pab.78.1473666572023; Mon, 12 Sep 2016 00:49:32 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r10si20387939pan.45.2016.09.12.00.49.31; Mon, 12 Sep 2016 00:49:31 -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 S1756810AbcILHt2 (ORCPT + 27 others); Mon, 12 Sep 2016 03:49:28 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:38426 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932353AbcILHsm (ORCPT ); Mon, 12 Sep 2016 03:48:42 -0400 Received: by mail-wm0-f50.google.com with SMTP id 1so129136189wmz.1 for ; Mon, 12 Sep 2016 00:48:41 -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=rFQk5umc5x2Vppj61S0xyKq1Rv6RPD2B4dpF76J6IgY=; b=ZFBx6pt5IP0GdvV+W9b6NuW3JACZqW6cb5OHcCfhvG6djV//Y+WwLl+DiQofkkZLY9 zzBBVZCx1Co31UsyQbHaZbtR+8OzU70z9Z7U7xUgIZIQ6qmUjUxbw7ETtV5E23FXjxhc XimLSYUvoYA63tgr5uMpcTHnjd36hhc9wfIH8= 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=rFQk5umc5x2Vppj61S0xyKq1Rv6RPD2B4dpF76J6IgY=; b=Tjv+EZrm4ywmtHyCTIMhIaHAd9QEgjOaMCzAREWPCZcVARDQGcUgVJg9X+I+4d9yn0 sjoWMFryVPGHiiOEmJ8fEGeU3VbRUcujEz3OmMruKqw0Sh0whH4ECJtxGloGv5NOwjd/ yfW6se5GwprQ69Us1GyliOKES9nlwhicGrTXNHnpzVoD0pQoWfVD81j58Fu1l2njAMMV nh72hq/K8eFDO0Z/0So2levC/7YZpmeZzbsPWpMUiaB9qk0kZbEMZ2f6Q4Y3AJ1CN0hr /qEqH5nlqIV5pyKZt9dBXhvxKYCYNyy+JpEZTbdzMTW8uGYUwUSYCcc+Rte2JvXkg4h5 7HKg== X-Gm-Message-State: AE9vXwNCrXqI4Mw7v02GkCvO0saZrp5Sn8O/aRLAPAnKy/nZa/1hr+dgU7ZVIBtAG/XtFy8o X-Received: by 10.28.173.205 with SMTP id w196mr9882254wme.86.1473666520307; Mon, 12 Sep 2016 00:48:40 -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.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Sep 2016 00:48:39 -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 5/7 v3] sched: propagate asynchrous detach Date: Mon, 12 Sep 2016 09:47:50 +0200 Message-Id: <1473666472-13749-6-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 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 we propagate any pending changes. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 1.9.1 diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index e4015f6..25533ba 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3188,6 +3188,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)) { @@ -3195,6 +3196,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, @@ -6567,6 +6569,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, 0); } raw_spin_unlock_irqrestore(&rq->lock, flags); }