1.  root_domain 的路径的赋值路径

                                    kernel_init_freeable //内核初始化路径调用 【2】
sched_init_smp //core.c 传参 cpu_active_mask
sched_init_domains //topology.c 传参为cpu_map 和 NULL
cpuset_cpu_inactive //core.c
cpuset_cpu_active //core.c 调用路径见下面
partition_sched_domains //topology.c
/proc/sys/kernel/sched_energy_aware 文件的回调 【3】
sched_energy_aware_handler //topology.c
/dev/cpuset的cpus和mems文件 【4】
cpuset_write_resmask //cpuset.c
core_ctl_force_pause_cpu //core_ctl.c isolate cpu后的resume路径中 【6】
try_to_resume //core_ctl.c isolate cpu后的resume路径中
sched_resume_cpu //core_pause.c
resume_cpus //cpu.c
sched_cpus_activate //core.c
cpuhp_hp_states[CPUHP_AP_ACTIVE].startup.single 回调。CPU热插拔处理【5】
sched_cpu_activate //core.c
cpuset_cpu_active //core.c
cpuset_cpu_inactive //core.c 应该是active相反的操作
cpuset_update_active_cpus //cpuset.c
resume_cpus //cpu.c 调用路径同上
cpuset_update_active_cpus_affine //cpuset.c
cpu_up //cpu.c down/up 即 online/offline 一个cpu时调用【8】
thaw_secondary_cpus //cpu.c
_cpu_up //cpu.c
_cpu_down //cpu.c
cpu_up_down_serialize_trainwrecks //cpu.c
thaw_processes //process.c 系统唤醒后解冻进程 【7】
cpuset_wait_for_hotplug //cpuset.c
register_hotmemory_notifier(&cpuset_track_online_nodes_nb); //cpuset.c 内存相关 【9】
cpuset_track_online_nodes //cpuset.c
cpuset_hotplug_workfn //cpuset.c
rebuild_sched_domains //cpuset.c
cpuset_write_resmask //cpuset.c 同上,写cpus文件
update_cpumask //cpuset.c
"cpus.partition" 文件响应函数,cgroup-v2的接口 【10】
sched_partition_write //cpuset.c
cpuset_cgrp_subsys.css_offline //cpuset 回调
cpuset_css_offline //cpuset.c
update_prstate //cpuset.c 更新 partititon_root_state
update_sibling_cpumasks //cpuset.c
update_cpumask //cpuset.c 调用路径同上
update_cpumasks_hier //cpuset.c
/dev/cpuset/sched_relax_domain_level 文件的写响应 【11】
cpuset_write_s64 //cpuset.c
update_relax_domain_level //cpuset.c
/dev/cpuset下"cpu_exclusive"、"sched_load_balance"、和一些memory相关文件的写回调函数 【12】
cpuset_write_u64 //cpuset.c
update_prstate //cpuset.c
update_flag //cpuset.c
update_prstate //cpuset.c 路径同上
rebuild_sched_domains_locked //cpuset.c
partition_and_rebuild_sched_domains //cpuset.c
partition_sched_domains_locked //topology.c
build_sched_domains //topology.c 给cpu赋值 __visit_domain_allocation_hell() 中通过 alloc_rootdomain() 获得的rd
partition_sched_domains_locked //topology.c 调用路径同上
detach_destroy_domains //topology.c 将给定的cpu的rq->rd重新指向 def_root_domain
cpu_attach_domain //topology.c
start_kernel //main.c 内核初始化时调用,对每个cpu的rq都设置为 def_root_domain 【1】
sched_init //core.c
rq_attach_root //topology.c
rq->rd = rd;

可以看出,虽然root_domain全局唯一,是有诸多事件影响 rq->rd 值的,包括CPU的online/offline、isolate、cpu hotplug、cpuset的cpus和mems文件,以及cpuset的其它文件、系统suspend/resume。

2. 实验

通过不停打印 rq->rd 的值来进行实验,即使系统空闲,rq->rd 的指向也是时刻在变化的,设置路径是:

[23008.485401] dump_backtrace.cfi_jt+0x0/0x8
[23008.485404] dump_stack_lvl+0xc4/0x140
[23008.485408] rq_attach_root+0x1e8/0x4f0
[23008.485411] cpu_attach_domain+0x280/0x928
[23008.485415] build_sched_domains+0xef0/0x1170
[23008.485419] partition_sched_domains_locked+0x3b0/0x6e8
[23008.485422] rebuild_sched_domains_locked+0x83c/0x8f0
[23008.485426] cpuset_hotplug_workfn+0x3e8/0x614
[23008.485430] process_one_work+0x248/0x780
[23008.485433] worker_thread+0x3e4/0x97c
[23008.485437] kthread+0x150/0x200
[23008.485439] ret_from_fork+0x10/0x30
[23008.485442] Hello: rq_attach_root: rq->rd = rd, rd=000000006bd11285

3. 从实验上看,同一时刻,不同CPU看到的 rq->rd 的指向可能是不同的。

最新文章

  1. c# winform 动态画矩形 矩形大小可以拖动
  2. [CareerCup] 9.6 Generate Parentheses 生成括号
  3. 【HTML5】SVG内联
  4. RouterOS 软路由配置固定IP上网+DHCP
  5. android Thread和Runable区别,精讲(有疑问)
  6. hibernate注解原理
  7. cocos2d-x 3.2 它 三消游戏——万圣节大作战
  8. C#网络请求与JSON解析
  9. Django(其二)
  10. EntityFrameworkCore中的实体状态
  11. Java知识回顾 (10) 线程
  12. Web.config配置customErrors mode为Off后依然不显示具体错误的可能原因。
  13. app分组
  14. 【转】Redis集群搭建与简单使用
  15. 【转】每天一个linux命令(44):top命令
  16. Spinner功能和用法
  17. 微信小程序“满月”:尝鲜之后你还用过它吗?
  18. eclispe创建gradle项目
  19. Swift Development – List of Resources You Must Bookmark
  20. 20155216 2016-2017-2 《Java程序设计》第九周学习总结

热门文章

  1. 五大数据类型 - 字符串 - 列表 list - 集合set - 有序集合 - 哈希 hashMap
  2. Thymeleaf的内置对象、SpringBoot整合Thymeleaf和JDBC
  3. SQL Server数据库日常检查
  4. 9.【go-kit教程】go-kit集成Prometheus
  5. Node.js安装、webpack 安装步骤Windows
  6. 基于ArcGIS的三维路网可视化
  7. 免费ASP空间
  8. 负载均衡做集群时关于的session不均衡的解决方案
  9. elasticsearch 索引数据手动复制注意事项
  10. 【研究生学习】Turbo编码