[知其然不知其所以然-14] cpu hotplug引出的cgroup故障
来源:互联网 发布:淘宝收货可以延长多久 编辑:程序博客网 时间:2024/05/21 22:43
How to reprduce:
root@turing:/sys/devices/system/cpu/cpu2# pwd
/sys/devices/system/cpu/cpu2
root@turing:/sys/devices/system/cpu/cpu2# echo 0 > online
root@turing:/sys/devices/system/cpu/cpu2# echo 1 > online
root@turing:/sys/devices/system/cpu/cpu2# taskset -c 2 ls
since the taskset will invoke sched_setaffinity to set cpumask for task,
after investigation, the problem is caused by incorrect value of task's subsys - cpuset
's effective_cpus mask, it is still 0,1,3 after re-pluggin cpu2. and the value of effective_cpus
is updated in workqueue of cpuset_hotplug_workfn, and the effective_cpus will be updated
by cpu_active_mask dynamically:
cpumask_copy(&new_cpus, cpu_active_mask);
//if not equal, update effective_cpus
cpus_updated = !cpumask_equal(top_cpuset.effective_cpus, &new_cpus);
cpumask_copy(top_cpuset.effective_cpus, &new_cpus);
// then update the tree recusively
cpuset_for_each_descendant_pre(cs, pos_css, &top_cpuset) {
cpuset_hotplug_update_tasks(cs);
}
thus the child cpuset effective_mask will be updated according to top_cpuset:
cpumask_and(&new_cpus, cs->cpus_allowed, parent_cs(cs)->effective_cpus);
cpumask_copy(cs->cpus_allowed, new_cpus);
cpumask_copy(cs->effective_cpus, new_cpus);
finnaly all the tasks inside this cpuset will be updated :
while ((task = css_task_iter_next(&it)))
set_cpus_allowed_ptr(task, cs->effective_cpus);
Then, who will trigger the workqueue ? the answer is cpu online/offline,
and the online callback is cpuset_cpu_active, while the offline callback is
cpuset_cpu_inactive, which are registered in sched_init_smp:
hotcpu_notifier(cpuset_cpu_active, CPU_PRI_CPUSET_ACTIVE);
hotcpu_notifier(cpuset_cpu_inactive, CPU_PRI_CPUSET_INACTIVE);
As we mentioned before , the problem is that after re-plugging, the
the effective_cpus is not updated to 0,1,2,3, which should be updated
according to cpu_active_mask by cpuset_cpu_active.
and how cpu_active_mask is updated? it is updated by set_cpu_online
and set_cpu_active.
- [知其然不知其所以然-14] cpu hotplug引出的cgroup故障
- cpu hotplug的流程
- [知其然不知其所以然-15] cgroup概述
- dom0的cpu hotplug【续】
- CPU-hotplug
- CPU Hotplug
- xen中dom0的cpu hotplug问题
- hotplug cpu后用lscpu检查是否cpu真的被hotplug了
- vm的cpu通过cgroup来隔离
- ARM平台-cpu hotplug
- Qemu cpu hotplug特性
- openstack hotplug-cpu
- cpu hotplug notifier
- cpu hotplug 源码分析
- Cgroup的CPU资源隔离介绍&docker cpu限制
- 解读CPU模式hotplug、ondemand等的意义
- 解读CPU模式hotplug、ondemand等的意义
- Linux Cgroup cpu子系统
- BS架构ERP系统开发全系列之白金教程-系统简介
- GitHub 优秀的 Android 开源项目
- lua -- io.pathinfo
- java web基础 --- form提交
- 内存入门
- [知其然不知其所以然-14] cpu hotplug引出的cgroup故障
- Nginx的红黑树结构
- 哈希的原理和代价
- Centos修炼----->Centos7程序安装方法
- JSP页面中文乱码
- 项目管理软件——禅道
- 把windows换行符转换成unix换行符
- 使用ESCAPE定义转义符
- 微信公众号nodejs版