进程创建时cgroup处理
来源:互联网 发布:授权书制作软件 编辑:程序博客网 时间:2024/06/05 08:57
void cgroup_fork(struct task_struct *child){ RCU_INIT_POINTER(child->cgroups, &init_css_set); INIT_LIST_HEAD(&child->cg_list);}
cgroup_can_fork:
/** * cgroup_can_fork - called on a new task before the process is exposed * @child: the task in question. * * This calls the subsystem can_fork() callbacks. If the can_fork() callback * returns an error, the fork aborts with that error code. This allows for * a cgroup subsystem to conditionally allow or deny new forks. */int cgroup_can_fork(struct task_struct *child){ struct cgroup_subsys *ss; int i, j, ret;
do_each_subsys_mask(ss, i, have_canfork_callback) { ret = ss->can_fork(child); if (ret) goto out_revert; } while_each_subsys_mask();
return 0;
out_revert: for_each_subsys(ss, j) { if (j >= i) break; if (ss->cancel_fork) ss->cancel_fork(child); }
return ret;}
/** * cgroup_post_fork - called on a new task after adding it to the task list * @child: the task in question * * Adds the task to the list running through its css_set if necessary and * call the subsystem fork() callbacks. Has to be after the task is * visible on the task list in case we race with the first call to * cgroup_task_iter_start() - to guarantee that the new task ends up on its * list. */void cgroup_post_fork(struct task_struct *child){ struct cgroup_subsys *ss; int i;
/* * This may race against cgroup_enable_task_cg_lists(). As that * function sets use_task_css_set_links before grabbing * tasklist_lock and we just went through tasklist_lock to add * @child, it's guaranteed that either we see the set * use_task_css_set_links or cgroup_enable_task_cg_lists() sees * @child during its iteration. * * If we won the race, @child is associated with %current's * css_set. Grabbing css_set_lock guarantees both that the * association is stable, and, on completion of the parent's * migration, @child is visible in the source of migration or * already in the destination cgroup. This guarantee is necessary * when implementing operations which need to migrate all tasks of * a cgroup to another. * * Note that if we lose to cgroup_enable_task_cg_lists(), @child * will remain in init_css_set. This is safe because all tasks are * in the init_css_set before cg_links is enabled and there's no * operation which transfers all tasks out of init_css_set. */ if (use_task_css_set_links) { struct css_set *cset;
spin_lock_irq(&css_set_lock); cset = task_css_set(current); if (list_empty(&child->cg_list)) { get_css_set(cset); css_set_move_task(child, NULL, cset, false); } spin_unlock_irq(&css_set_lock); }
/* * Call ss->fork(). This must happen after @child is linked on * css_set; otherwise, @child might change state between ->fork() * and addition to css_set. */ do_each_subsys_mask(ss, i, have_fork_callback) { ss->fork(child); } while_each_subsys_mask();}
- 进程创建时cgroup处理
- 进程创建时信号处理
- 进程创建时IO处理
- 进程创建时信号处理函数处理
- cgroup限制进程内存大小
- 进程创建时内存描述符处理
- 进程创建时命名空间处理
- 进程创建时线程栈处理
- 进程创建时安全计算处理
- 进程创建时共享内存处理
- Linux cgroup控制进程资源
- cgroup实践---使用cgroup限制mongodb进程内存
- 进程创建时文件处理
- Cgroup
- Cgroup
- cgroup
- cgroup
- 使用cgroup 限制进程的磁盘io
- PostgreSQL-XL, PostgreSQL集群项目(二)
- 浅谈CSS中line-height:200% | 2.0em | 2.0 的区别
- 2014年与友人交流的一点总结
- ARM点灯,PWM,中断实验
- MySQL是怎么在源码层表达对象的-----Item对象及子对象解析(一)
- 进程创建时cgroup处理
- MySQL 5.7 查询优化器的重构(一)---prepare阶段的重构
- MySQL/PostgreSQL/Oracle架构图
- MySQL是怎么在源码层表达对象的-----Item对象及子对象解析(二)
- MySQL是怎么在源码层表达对象的-----Item对象及子对象解析(三)
- 妄谈数据库框架(非整个框架全部),见笑,请多指正:
- MySQL是怎么在源码层表达对象的-----Item对象及子对象解析(四)
- select count(*) 和 select count(1)有什么区别?
- MySQL多表连接过程中自动创建索引一例: