From bca71ee2753d174acdfab9e804cbcc4b4a66c4b6 Mon Sep 17 00:00:00 2001 From: Steve Muckle Date: Tue, 28 Feb 2012 17:39:31 -0800 Subject: init: apply SCHED_FIFO to kthreadd Hotplug (cpu_up) latency currently suffers because the system must wait for kthreadd to spawn certain kthreads (such as the migration and workqueue kthreads) and for them to run for the first time. Setting SCHED_FIFO will cause kthreadd to run immediately. The newly created kthreads will inherit the scheduler policy and run immediately also. The scheduling policy of newly created kthreads is already set back to SCHED_NORMAL in kthread_create_on_node, so nothing needs to be done to restore normal scheduling behavior for the kthreads once spawned. Change-Id: I236ceb29845cf58ea1ea886fc3210ccaab2dd792 Signed-off-by: Steve Muckle (cherry picked from commit 82440737eef236077e5781061b4c8de2c0b013fb) --- init/main.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'init') diff --git a/init/main.c b/init/main.c index 8316f4758..8a6b287fe 100644 --- a/init/main.c +++ b/init/main.c @@ -369,6 +369,7 @@ static __initdata DECLARE_COMPLETION(kthreadd_done); static noinline void __init_refok rest_init(void) { int pid; + const struct sched_param param = { .sched_priority = 1 }; rcu_scheduler_starting(); /* @@ -382,6 +383,7 @@ static noinline void __init_refok rest_init(void) rcu_read_lock(); kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns); rcu_read_unlock(); + sched_setscheduler_nocheck(kthreadd_task, SCHED_FIFO, ¶m); complete(&kthreadd_done); /* -- cgit v1.2.3