ANDROID: sched: Fix sched_cpu_drain CONFIG_HOTPLUG_CPU dependence
This scheduler interface has been brought to allow the hotplug feature
paused_cpus to force tasks migration. It depends on migrate_tasks() which
is only available when CONFIG_HOTPLUG_CPU is set. sched_cpu_drain*()
functions should then also depend on this configuration.
Bug: 161210528
Fixes: e19b8ce (ANDROID: cpu/hotplug: add migration to paused_cpus)
Change-Id: I250cd0a8f382811604445600acc33ab4df4ad4da
Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>
This commit is contained in:
committed by
Quentin Perret
parent
4de82f1b3b
commit
6f58dc1f83
+34
-34
@@ -6884,6 +6884,40 @@ static void migrate_tasks(struct rq *dead_rq, struct rq_flags *rf, bool force)
|
||||
|
||||
rq->stop = stop;
|
||||
}
|
||||
|
||||
static int drain_rq_cpu_stop(void *data)
|
||||
{
|
||||
struct rq *rq = this_rq();
|
||||
struct rq_flags rf;
|
||||
|
||||
rq_lock_irqsave(rq, &rf);
|
||||
migrate_tasks(rq, &rf, false);
|
||||
rq_unlock_irqrestore(rq, &rf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sched_cpu_drain_rq(unsigned int cpu)
|
||||
{
|
||||
struct cpu_stop_work *rq_drain = &(cpu_rq(cpu)->drain);
|
||||
struct cpu_stop_done *rq_drain_done = &(cpu_rq(cpu)->drain_done);
|
||||
|
||||
if (idle_cpu(cpu)) {
|
||||
rq_drain->done = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return stop_one_cpu_async(cpu, drain_rq_cpu_stop, NULL, rq_drain,
|
||||
rq_drain_done);
|
||||
}
|
||||
|
||||
void sched_cpu_drain_rq_wait(unsigned int cpu)
|
||||
{
|
||||
struct cpu_stop_work *rq_drain = &(cpu_rq(cpu)->drain);
|
||||
|
||||
if (rq_drain->done)
|
||||
cpu_stop_work_wait(rq_drain);
|
||||
}
|
||||
#endif /* CONFIG_HOTPLUG_CPU */
|
||||
|
||||
void set_rq_online(struct rq *rq)
|
||||
@@ -6964,40 +6998,6 @@ static int cpuset_cpu_inactive(unsigned int cpu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int drain_rq_cpu_stop(void *data)
|
||||
{
|
||||
struct rq *rq = this_rq();
|
||||
struct rq_flags rf;
|
||||
|
||||
rq_lock_irqsave(rq, &rf);
|
||||
migrate_tasks(rq, &rf, false);
|
||||
rq_unlock_irqrestore(rq, &rf);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sched_cpu_drain_rq(unsigned int cpu)
|
||||
{
|
||||
struct cpu_stop_work *rq_drain = &(cpu_rq(cpu)->drain);
|
||||
struct cpu_stop_done *rq_drain_done = &(cpu_rq(cpu)->drain_done);
|
||||
|
||||
if (idle_cpu(cpu)) {
|
||||
rq_drain->done = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return stop_one_cpu_async(cpu, drain_rq_cpu_stop, NULL, rq_drain,
|
||||
rq_drain_done);
|
||||
}
|
||||
|
||||
void sched_cpu_drain_rq_wait(unsigned int cpu)
|
||||
{
|
||||
struct cpu_stop_work *rq_drain = &(cpu_rq(cpu)->drain);
|
||||
|
||||
if (rq_drain->done)
|
||||
cpu_stop_work_wait(rq_drain);
|
||||
}
|
||||
|
||||
int sched_cpu_activate(unsigned int cpu)
|
||||
{
|
||||
struct rq *rq = cpu_rq(cpu);
|
||||
|
||||
Reference in New Issue
Block a user