Merge "cpu-hotplug: Always use real time scheduling when hotplugging a CPU"
This commit is contained in:
commit
6c5cc8bddc
1 changed files with 39 additions and 0 deletions
39
kernel/cpu.c
39
kernel/cpu.c
|
@ -530,9 +530,41 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int switch_to_rt_policy(void)
|
||||||
|
{
|
||||||
|
struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };
|
||||||
|
unsigned int policy = current->policy;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
/* Nobody should be attempting hotplug from these policy contexts. */
|
||||||
|
if (policy == SCHED_BATCH || policy == SCHED_IDLE ||
|
||||||
|
policy == SCHED_DEADLINE)
|
||||||
|
return -EPERM;
|
||||||
|
|
||||||
|
if (policy == SCHED_FIFO || policy == SCHED_RR)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
/* Only SCHED_NORMAL left. */
|
||||||
|
err = sched_setscheduler_nocheck(current, SCHED_FIFO, ¶m);
|
||||||
|
return err;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int switch_to_fair_policy(void)
|
||||||
|
{
|
||||||
|
struct sched_param param = { .sched_priority = 0 };
|
||||||
|
|
||||||
|
return sched_setscheduler_nocheck(current, SCHED_NORMAL, ¶m);
|
||||||
|
}
|
||||||
|
|
||||||
int cpu_up(unsigned int cpu)
|
int cpu_up(unsigned int cpu)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
int switch_err = 0;
|
||||||
|
|
||||||
|
switch_err = switch_to_rt_policy();
|
||||||
|
if (switch_err < 0)
|
||||||
|
return switch_err;
|
||||||
|
|
||||||
if (!cpu_possible(cpu)) {
|
if (!cpu_possible(cpu)) {
|
||||||
pr_err("can't online cpu %d because it is not configured as may-hotadd at boot time\n",
|
pr_err("can't online cpu %d because it is not configured as may-hotadd at boot time\n",
|
||||||
|
@ -558,6 +590,13 @@ int cpu_up(unsigned int cpu)
|
||||||
|
|
||||||
out:
|
out:
|
||||||
cpu_maps_update_done();
|
cpu_maps_update_done();
|
||||||
|
|
||||||
|
if (!switch_err) {
|
||||||
|
switch_err = switch_to_fair_policy();
|
||||||
|
pr_err("Hotplug policy switch err. Task %s pid=%d\n",
|
||||||
|
current->comm, current->pid);
|
||||||
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(cpu_up);
|
EXPORT_SYMBOL_GPL(cpu_up);
|
||||||
|
|
Loading…
Add table
Reference in a new issue