CPU idle学习笔记

1. per-cpu的idle线程初始化

(1) boot cpu的idle线程初始化

start_kernel //init/main.c
    sched_init //kernel/sched/core.c
        init_idle(current, smp_processor_id()); //当前正在执行的进程将其初始化为此boot CPU的idle线程

(2) 非boot cpu的idle线程初始化

start_kernel //init/main.c 最后调用rest_init
    rest_init //kernel_thread(kernel_init, NULL, CLONE_FS);
        kernel_init
            kernel_init_freeable //init/main.c
                smp_init //kernel/smp.c
                    idle_threads_init //kernel\smpboot.c
                        for_each_possible_cpu(cpu) {
                            if (cpu != boot_cpu)
                                idle_init(cpu); /*为非boot cpu初始化idle线程*/
                        }

 

posted on 2021-06-30 11:15  Hello-World3  阅读(240)  评论(0编辑  收藏  举报

导航