From 9da1f37103d99b4ee850b89be3af089c9be43493 Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Mon, 26 Oct 2020 17:00:34 +0000 Subject: [PATCH] ANDROID: cpu: Don't prevent hotplug from DL/BATCH/IDLE Commit c6e5f9d7cf2f ("ANDROID: cpu-hotplug: Always use real time scheduling when hotplugging a CPU") tried to speed-up hotplug of SCHED_NORMAL tasks by temporarily elevating them to SCHED_FIFO. But while at it, it also prevented hotplug from SCHED_IDLE, SCHED_BATCH or SCHED_DEADLINE for no apparent reason. Since this is a userspace-visible change, and is unlikely to actually be needed, change the patch logic to only optimize for SCHED_NORMAL tasks and leave the others untouched. Bug: 169238689 Fixes: c6e5f9d7cf2f ("ANDROID: cpu-hotplug: Always use real time scheduling when hotplugging a CPU") Signed-off-by: Quentin Perret Change-Id: I4d9e88b15fee56e7d234826e2eaea306a69328bb --- kernel/cpu.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/kernel/cpu.c b/kernel/cpu.c index 7f1edbdf336c..1a7ad6644cc5 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1195,10 +1195,8 @@ static int switch_to_rt_policy(void) if (policy == SCHED_NORMAL) /* Switch to SCHED_FIFO from SCHED_NORMAL. */ return sched_setscheduler_nocheck(current, SCHED_FIFO, ¶m); - else if (policy == SCHED_FIFO || policy == SCHED_RR) - return 1; else - return -EPERM; + return 1; } static int switch_to_fair_policy(void) @@ -1293,8 +1291,6 @@ static int cpu_up(unsigned int cpu, enum cpuhp_state target) */ switch_err = switch_to_rt_policy(); - if (switch_err < 0) - return switch_err; err = try_online_node(cpu_to_node(cpu)); if (err)