cgroup.c (e4f8d81c738db6d3ffdabfb8329aa2feaa310699) | cgroup.c (488dee96bb62f0b3d9e678cf42574034d5b033a5) |
---|---|
1/* 2 * Generic process-grouping system. 3 * 4 * Based originally on the cpuset system, extracted by Paul Menage 5 * Copyright (C) 2006 Google, Inc 6 * 7 * Notifications support 8 * Copyright (C) 2009 Nokia Corporation --- 69 unchanged lines hidden (view full) --- 78DEFINE_MUTEX(cgroup_mutex); 79DEFINE_SPINLOCK(css_set_lock); 80 81#ifdef CONFIG_PROVE_RCU 82EXPORT_SYMBOL_GPL(cgroup_mutex); 83EXPORT_SYMBOL_GPL(css_set_lock); 84#endif 85 | 1/* 2 * Generic process-grouping system. 3 * 4 * Based originally on the cpuset system, extracted by Paul Menage 5 * Copyright (C) 2006 Google, Inc 6 * 7 * Notifications support 8 * Copyright (C) 2009 Nokia Corporation --- 69 unchanged lines hidden (view full) --- 78DEFINE_MUTEX(cgroup_mutex); 79DEFINE_SPINLOCK(css_set_lock); 80 81#ifdef CONFIG_PROVE_RCU 82EXPORT_SYMBOL_GPL(cgroup_mutex); 83EXPORT_SYMBOL_GPL(css_set_lock); 84#endif 85 |
86DEFINE_SPINLOCK(trace_cgroup_path_lock); 87char trace_cgroup_path[TRACE_CGROUP_PATH_LEN]; 88 | |
89/* 90 * Protects cgroup_idr and css_idr so that IDs can be released without 91 * grabbing cgroup_mutex. 92 */ 93static DEFINE_SPINLOCK(cgroup_idr_lock); 94 95/* 96 * Protects cgroup_file->kn for !self csses. It synchronizes notifications --- 2539 unchanged lines hidden (view full) --- 2636 /* prepare dst csets and commit */ 2637 ret = cgroup_migrate_prepare_dst(&mgctx); 2638 if (!ret) 2639 ret = cgroup_migrate(leader, threadgroup, &mgctx); 2640 2641 cgroup_migrate_finish(&mgctx); 2642 2643 if (!ret) | 86/* 87 * Protects cgroup_idr and css_idr so that IDs can be released without 88 * grabbing cgroup_mutex. 89 */ 90static DEFINE_SPINLOCK(cgroup_idr_lock); 91 92/* 93 * Protects cgroup_file->kn for !self csses. It synchronizes notifications --- 2539 unchanged lines hidden (view full) --- 2633 /* prepare dst csets and commit */ 2634 ret = cgroup_migrate_prepare_dst(&mgctx); 2635 if (!ret) 2636 ret = cgroup_migrate(leader, threadgroup, &mgctx); 2637 2638 cgroup_migrate_finish(&mgctx); 2639 2640 if (!ret) |
2644 TRACE_CGROUP_PATH(attach_task, dst_cgrp, leader, threadgroup); | 2641 trace_cgroup_attach_task(dst_cgrp, leader, threadgroup); |
2645 2646 return ret; 2647} 2648 2649struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup) 2650 __acquires(&cgroup_threadgroup_rwsem) 2651{ 2652 struct task_struct *tsk; --- 902 unchanged lines hidden (view full) --- 3555 struct kernfs_node *kn; 3556 struct lock_class_key *key = NULL; 3557 int ret; 3558 3559#ifdef CONFIG_DEBUG_LOCK_ALLOC 3560 key = &cft->lockdep_key; 3561#endif 3562 kn = __kernfs_create_file(cgrp->kn, cgroup_file_name(cgrp, cft, name), | 2642 2643 return ret; 2644} 2645 2646struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup) 2647 __acquires(&cgroup_threadgroup_rwsem) 2648{ 2649 struct task_struct *tsk; --- 902 unchanged lines hidden (view full) --- 3552 struct kernfs_node *kn; 3553 struct lock_class_key *key = NULL; 3554 int ret; 3555 3556#ifdef CONFIG_DEBUG_LOCK_ALLOC 3557 key = &cft->lockdep_key; 3558#endif 3559 kn = __kernfs_create_file(cgrp->kn, cgroup_file_name(cgrp, cft, name), |
3563 cgroup_file_mode(cft), 0, cft->kf_ops, cft, | 3560 cgroup_file_mode(cft), 3561 GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, 3562 0, cft->kf_ops, cft, |
3564 NULL, key); 3565 if (IS_ERR(kn)) 3566 return PTR_ERR(kn); 3567 3568 ret = cgroup_kn_set_ugid(kn); 3569 if (ret) { 3570 kernfs_remove(kn); 3571 return ret; --- 1060 unchanged lines hidden (view full) --- 4632 4633 cgroup_idr_replace(&ss->css_idr, NULL, css->id); 4634 if (ss->css_released) 4635 ss->css_released(css); 4636 } else { 4637 struct cgroup *tcgrp; 4638 4639 /* cgroup release path */ | 3563 NULL, key); 3564 if (IS_ERR(kn)) 3565 return PTR_ERR(kn); 3566 3567 ret = cgroup_kn_set_ugid(kn); 3568 if (ret) { 3569 kernfs_remove(kn); 3570 return ret; --- 1060 unchanged lines hidden (view full) --- 4631 4632 cgroup_idr_replace(&ss->css_idr, NULL, css->id); 4633 if (ss->css_released) 4634 ss->css_released(css); 4635 } else { 4636 struct cgroup *tcgrp; 4637 4638 /* cgroup release path */ |
4640 TRACE_CGROUP_PATH(release, cgrp); | 4639 trace_cgroup_release(cgrp); |
4641 4642 if (cgroup_on_dfl(cgrp)) 4643 cgroup_rstat_flush(cgrp); 4644 4645 for (tcgrp = cgroup_parent(cgrp); tcgrp; 4646 tcgrp = cgroup_parent(tcgrp)) 4647 tcgrp->nr_dying_descendants--; 4648 --- 326 unchanged lines hidden (view full) --- 4975 ret = css_populate_dir(&cgrp->self); 4976 if (ret) 4977 goto out_destroy; 4978 4979 ret = cgroup_apply_control_enable(cgrp); 4980 if (ret) 4981 goto out_destroy; 4982 | 4640 4641 if (cgroup_on_dfl(cgrp)) 4642 cgroup_rstat_flush(cgrp); 4643 4644 for (tcgrp = cgroup_parent(cgrp); tcgrp; 4645 tcgrp = cgroup_parent(tcgrp)) 4646 tcgrp->nr_dying_descendants--; 4647 --- 326 unchanged lines hidden (view full) --- 4974 ret = css_populate_dir(&cgrp->self); 4975 if (ret) 4976 goto out_destroy; 4977 4978 ret = cgroup_apply_control_enable(cgrp); 4979 if (ret) 4980 goto out_destroy; 4981 |
4983 TRACE_CGROUP_PATH(mkdir, cgrp); | 4982 trace_cgroup_mkdir(cgrp); |
4984 4985 /* let's create and online css's */ 4986 kernfs_activate(kn); 4987 4988 ret = 0; 4989 goto out_unlock; 4990 4991out_destroy: --- 171 unchanged lines hidden (view full) --- 5163 struct cgroup *cgrp; 5164 int ret = 0; 5165 5166 cgrp = cgroup_kn_lock_live(kn, false); 5167 if (!cgrp) 5168 return 0; 5169 5170 ret = cgroup_destroy_locked(cgrp); | 4983 4984 /* let's create and online css's */ 4985 kernfs_activate(kn); 4986 4987 ret = 0; 4988 goto out_unlock; 4989 4990out_destroy: --- 171 unchanged lines hidden (view full) --- 5162 struct cgroup *cgrp; 5163 int ret = 0; 5164 5165 cgrp = cgroup_kn_lock_live(kn, false); 5166 if (!cgrp) 5167 return 0; 5168 5169 ret = cgroup_destroy_locked(cgrp); |
5170 |
|
5171 if (!ret) | 5171 if (!ret) |
5172 TRACE_CGROUP_PATH(rmdir, cgrp); | 5172 trace_cgroup_rmdir(cgrp); |
5173 5174 cgroup_kn_unlock(kn); 5175 return ret; 5176} 5177 5178static struct kernfs_syscall_ops cgroup_kf_syscall_ops = { 5179 .show_options = cgroup_show_options, 5180 .remount_fs = cgroup_remount, --- 802 unchanged lines hidden --- | 5173 5174 cgroup_kn_unlock(kn); 5175 return ret; 5176} 5177 5178static struct kernfs_syscall_ops cgroup_kf_syscall_ops = { 5179 .show_options = cgroup_show_options, 5180 .remount_fs = cgroup_remount, --- 802 unchanged lines hidden --- |