调度器14—CPU拓扑结构和调度域建立-2

一、拓扑相关调试

基于msm-5.4

1. sched_debug 开关

前提需要使能 CONFIG_SCHED_DEBUG,此时会导出一个 /sys/kernel/debug/sched_debug 文件,它会控制全局变量 sched_debug_enabled 的值,后者在 kernel/sched/topology.c 中唯一使用。

定义端:

late_initcall //sched/debug.c
    sched_init_debug //sched/debug.c
        debugfs_create_bool("sched_debug", 0644, NULL, &sched_debug_enabled); //这个类似函数 /sys/kernel/debug/sched_debug

使用端:

static int __init sched_debug_setup(char *str) //topology.c
{
    sched_debug_enabled = true;

    return 0;
}
early_param("sched_debug", sched_debug_setup);

static inline bool sched_debug(void)
{
    return sched_debug_enabled;
}

sched_domain_debug(*sd, cpu) //topology.c
    if (!sched_debug_enabled)
        return;
    printk(KERN_DEBUG "CPU%d attaching sched-domain(s):\n", cpu);

pd_init(cpu) //topology.c
    if (sched_debug())
        pr_info("%s: no EM found for CPU%d\n", __func__, cpu);

perf_domain_debug //topology.c
    if(sched_debug())
        printk(KERN_DEBUG "root_domain %*pbl:", cpumask_pr_args(cpu_map));
        printk(KERN_CONT " pd%d:{ cpus=%*pbl nr_cstate=%d }", ...);

partition_sched_domains_locked //topology.c
    sched_energy_set(bool has_eas) //topology.c 使能或关闭EAS都有打印
        if (sched_debug())
            pr_info("%s: stopping EAS\n", __func__);
            static_branch_disable_cpuslocked(&sched_energy_present);
        if (sched_debug())
            pr_info("%s: starting EAS\n", __func__);
            static_branch_enable_cpuslocked(&sched_energy_present);

 

posted on 2026-03-11 14:10  Hello-World3  阅读(0)  评论(0)    收藏  举报

导航