[cpp]
364 static noinline void __init_refok rest_init(void)
365 {
366 int pid;
367
368 rcu_scheduler_starting();
369 /*
370 * We need to spawn init first so that it obtains pid 1, however
371 * the init task will end up wanting to create kthreads, which, if
372 * we schedule it before we create kthreadd, will OOPS.
373 */
374 kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
375 numa_default_policy();
376 pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
377 rcu_read_lock();
378 kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
379 rcu_read_unlock();
380 complete(&kthreadd_done);
381
382 /*
383 * The boot idle thread must execute schedule()
384 * at least once to get things moving:
385 */
386 init_idle_bootup_task(current);
387 schedule_preempt_disabled();
388 /* Call into cpu_idle with preempt disabled */
389 cpu_startup_entry(CPUHP_ONLINE);
390 }