Commit 4553dab7 authored by Peter Boonstoppel's avatar Peter Boonstoppel Committed by Ben Hutchings

sched: Unthrottle rt runqueues in __disable_runtime()

commit a4c96ae3 upstream.

migrate_tasks() uses _pick_next_task_rt() to get tasks from the
real-time runqueues to be migrated. When rt_rq is throttled
_pick_next_task_rt() won't return anything, in which case
migrate_tasks() can't move all threads over and gets stuck in an
infinite loop.

Instead unthrottle rt runqueues before migrating tasks.

Additionally: move unthrottle_offline_cfs_rqs() to rq_offline_fair()
Signed-off-by: default avatarPeter Boonstoppel <pboonstoppel@nvidia.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Turner <pjt@google.com>
Link: http://lkml.kernel.org/r/5FBF8E85CA34454794F0F7ECBA79798F379D3648B7@HQMAIL04.nvidia.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
[ lizf: backported to 3.4: adjust context ]
Signed-off-by: default avatarLi Zefan <lizefan@huawei.com>
[bwh: Backported to 3.2:
 - Adjust filenames
 - unthrottle_offline_cfs_rqs() is already static, but defined in sched.c
   after including sched_fair.c, so add forward declaration
 - unthrottle_offline_cfs_rqs() also needs to be defined for all CONFIG_SMP
   configurations now]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent aee1f8b8
...@@ -2189,6 +2189,10 @@ static int irqtime_account_si_update(void) ...@@ -2189,6 +2189,10 @@ static int irqtime_account_si_update(void)
#endif #endif
#ifdef CONFIG_SMP
static void unthrottle_offline_cfs_rqs(struct rq *rq);
#endif
#include "sched_idletask.c" #include "sched_idletask.c"
#include "sched_fair.c" #include "sched_fair.c"
#include "sched_rt.c" #include "sched_rt.c"
...@@ -6566,8 +6570,6 @@ static void unthrottle_offline_cfs_rqs(struct rq *rq) ...@@ -6566,8 +6570,6 @@ static void unthrottle_offline_cfs_rqs(struct rq *rq)
unthrottle_cfs_rq(cfs_rq); unthrottle_cfs_rq(cfs_rq);
} }
} }
#else
static void unthrottle_offline_cfs_rqs(struct rq *rq) {}
#endif #endif
/* /*
...@@ -6595,9 +6597,6 @@ static void migrate_tasks(unsigned int dead_cpu) ...@@ -6595,9 +6597,6 @@ static void migrate_tasks(unsigned int dead_cpu)
*/ */
rq->stop = NULL; rq->stop = NULL;
/* Ensure any throttled groups are reachable by pick_next_task */
unthrottle_offline_cfs_rqs(rq);
for ( ; ; ) { for ( ; ; ) {
/* /*
* There's this thread running, bail when that's the only * There's this thread running, bail when that's the only
...@@ -6624,6 +6623,10 @@ static void migrate_tasks(unsigned int dead_cpu) ...@@ -6624,6 +6623,10 @@ static void migrate_tasks(unsigned int dead_cpu)
#endif /* CONFIG_HOTPLUG_CPU */ #endif /* CONFIG_HOTPLUG_CPU */
#if !defined(CONFIG_HOTPLUG_CPU) || !defined(CONFIG_CFS_BANDWIDTH)
static void unthrottle_offline_cfs_rqs(struct rq *rq) {}
#endif
#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_SYSCTL) #if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_SYSCTL)
static struct ctl_table sd_ctl_dir[] = { static struct ctl_table sd_ctl_dir[] = {
......
...@@ -4848,6 +4848,9 @@ static void rq_online_fair(struct rq *rq) ...@@ -4848,6 +4848,9 @@ static void rq_online_fair(struct rq *rq)
static void rq_offline_fair(struct rq *rq) static void rq_offline_fair(struct rq *rq)
{ {
update_sysctl(); update_sysctl();
/* Ensure any throttled groups are reachable by pick_next_task */
unthrottle_offline_cfs_rqs(rq);
} }
#else /* CONFIG_SMP */ #else /* CONFIG_SMP */
......
...@@ -509,6 +509,7 @@ static void __disable_runtime(struct rq *rq) ...@@ -509,6 +509,7 @@ static void __disable_runtime(struct rq *rq)
* runtime - in which case borrowing doesn't make sense. * runtime - in which case borrowing doesn't make sense.
*/ */
rt_rq->rt_runtime = RUNTIME_INF; rt_rq->rt_runtime = RUNTIME_INF;
rt_rq->rt_throttled = 0;
raw_spin_unlock(&rt_rq->rt_runtime_lock); raw_spin_unlock(&rt_rq->rt_runtime_lock);
raw_spin_unlock(&rt_b->rt_runtime_lock); raw_spin_unlock(&rt_b->rt_runtime_lock);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment