From 3c252ab080ced0c58290b0a98124ba95ce4e76cf Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Tue, 15 Dec 2020 17:54:22 +0000 Subject: [PATCH] Revert "ANDROID: sched: Fix sched_cpu_drain CONFIG_HOTPLUG_CPU dependence" This reverts commit 6f58dc1f83f0dc6ce4ea4e3e1ed4c0a363977cb3. CPU Pause causes major merge conflicts with the 5.11 scheduler changes (migrate-disable specifically), so lets revert Pause temporarily as it is not needed urgently in android-mainline. Signed-off-by: Quentin Perret Change-Id: I3eee0317d5e88591e47f7724a32af4339e6a979c --- kernel/sched/core.c | 68 ++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 89b01a013e53..0509b0ccfde7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6887,40 +6887,6 @@ 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) @@ -7001,6 +6967,40 @@ 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);