From patchwork Mon Sep 26 12:19:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 77028 Delivered-To: patch@linaro.org Received: by 10.140.106.72 with SMTP id d66csp1146320qgf; Mon, 26 Sep 2016 05:21:29 -0700 (PDT) X-Received: by 10.98.71.204 with SMTP id p73mr38619412pfi.20.1474892489801; Mon, 26 Sep 2016 05:21:29 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si25046832pav.91.2016.09.26.05.21.29; Mon, 26 Sep 2016 05:21:29 -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 S1034094AbcIZMVQ (ORCPT + 27 others); Mon, 26 Sep 2016 08:21:16 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35079 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941435AbcIZMUe (ORCPT ); Mon, 26 Sep 2016 08:20:34 -0400 Received: by mail-pa0-f53.google.com with SMTP id oz2so62634693pac.2 for ; Mon, 26 Sep 2016 05:20:34 -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=oB3d3UCWNe6dy1nzAXr5+5u4w+Ex83ugttfTySgE3Q0=; b=B3tb2CGX+yKgMBcLIO6e/8G0nFGLXZWD/JZqxkQfQ91BaimnAgosCOGn+ByR3UgfDY qIVeYZACQXMWxGGKsIddOi+kvTJXGiAJfs+1y64kU1Zmb+LqAioRC8BnkUcMjdDECoHu bgTzNph4VKviXZm65/4p/bt5ynSitatREugCU= 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=oB3d3UCWNe6dy1nzAXr5+5u4w+Ex83ugttfTySgE3Q0=; b=hgEdQpWpgTBePDV01CPe+KB1tWS5TmCjj1Qn6Vam4LsyccrKma1Ueb5iUooiByvcGf JEErSbRH44nsG1Mnhxz2j8VEl9aLpOgg/0gfOGqN+ue4H7WjodRbbMzpq6sjvprI11t9 d63SbbsdHfQ1jSwJ+sB9Muh1O+RcXPtXqu7P0DnU0Y/yE4xN872z6HgI0+RY1snzQxiM EkbW6jxA1x9jmBM6wjAVMxOoThh3enePQagNhLKOFMIm6TuYn+t095o9AAX6VaBy2CCo sSMQqjaNLkCBvfZHsKBIE2KVlm+9iVb8RtVo03k+Sg94rBEfGbYlC99MsPmDQJzuyUYO rzgQ== X-Gm-Message-State: AE9vXwOTLcgEDsBsPEXl0LPLmEwIQVEJqyq7MmIi4DrvPhsjMc1uggvwu95DHrf+j+yJt4bi X-Received: by 10.66.147.5 with SMTP id tg5mr37429699pab.116.1474892433541; Mon, 26 Sep 2016 05:20:33 -0700 (PDT) Received: from localhost.localdomain ([67.238.99.186]) by smtp.gmail.com with ESMTPSA id i62sm30773860pfg.89.2016.09.26.05.20.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Sep 2016 05:20:32 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com, kernellwp@gmail.com Cc: yuyang.du@intel.com, Morten.Rasmussen@arm.com, linaro-kernel@lists.linaro.org, pjt@google.com, bsegall@google.com, Vincent Guittot Subject: [PATCH 5/7 v4] sched: propagate asynchrous detach Date: Mon, 26 Sep 2016 14:19:51 +0200 Message-Id: <1474892393-5095-6-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1474892393-5095-1-git-send-email-vincent.guittot@linaro.org> References: <1474892393-5095-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 8ba500f..bd3b6b9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3221,6 +3221,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)) { @@ -3228,6 +3229,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, @@ -6607,6 +6609,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); }