linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Guittot <vincent.guittot@linaro.org>
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 <vincent.guittot@linaro.org>
Subject: [PATCH 5/6 v7] sched: propagate asynchrous detach
Date: Tue,  8 Nov 2016 10:53:46 +0100	[thread overview]
Message-ID: <1478598827-32372-6-git-send-email-vincent.guittot@linaro.org> (raw)
In-Reply-To: <1478598827-32372-1-git-send-email-vincent.guittot@linaro.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 <vincent.guittot@linaro.org>
---
 kernel/sched/fair.c | 6 ++++++
 1 file changed, 6 insertions(+)

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);
 }
-- 
2.7.4

  parent reply	other threads:[~2016-11-08  9:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-08  9:53 [PATCH 0/6 v7] sched: reflect sched_entity move into task_group's load Vincent Guittot
2016-11-08  9:53 ` [PATCH 1/6 v7] sched: factorize attach/detach entity Vincent Guittot
2016-11-16 12:15   ` [tip:sched/core] sched/fair: Factorize " tip-bot for Vincent Guittot
2016-11-08  9:53 ` [PATCH 2/6 v7] sched: fix hierarchical order in rq->leaf_cfs_rq_list Vincent Guittot
2016-11-16 12:15   ` [tip:sched/core] sched/fair: Fix " tip-bot for Vincent Guittot
2016-11-08  9:53 ` [PATCH 3/6 v7] sched: factorize PELT update Vincent Guittot
2016-11-16 12:16   ` [tip:sched/core] sched/fair: Factorize " tip-bot for Vincent Guittot
2016-11-08  9:53 ` [PATCH 4/6 v7] sched: propagate load during synchronous attach/detach Vincent Guittot
2016-11-09 15:03   ` Peter Zijlstra
2016-11-09 15:23     ` Vincent Guittot
2016-11-16 12:16   ` [tip:sched/core] sched/fair: Propagate " tip-bot for Vincent Guittot
2016-11-08  9:53 ` Vincent Guittot [this message]
2016-11-16 12:17   ` [tip:sched/core] sched/fair: Propagate asynchrous detach tip-bot for Vincent Guittot
2016-11-08  9:53 ` [PATCH 6/6 v7] sched: fix task group initialization Vincent Guittot
2016-11-16 12:17   ` [tip:sched/core] sched/fair: Fix " tip-bot for Vincent Guittot
2016-11-10 17:04 ` [PATCH 0/6 v7] sched: reflect sched_entity move into task_group's load Dietmar Eggemann
2016-11-12  9:27   ` Vincent Guittot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478598827-32372-6-git-send-email-vincent.guittot@linaro.org \
    --to=vincent.guittot@linaro.org \
    --cc=Morten.Rasmussen@arm.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=kernellwp@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=yuyang.du@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).