Lines Matching refs:cgrp
14 static void cgroup_propagate_frozen(struct cgroup *cgrp, bool frozen) in cgroup_propagate_frozen() argument
24 while ((cgrp = cgroup_parent(cgrp))) { in cgroup_propagate_frozen()
26 cgrp->freezer.nr_frozen_descendants += desc; in cgroup_propagate_frozen()
27 if (!test_bit(CGRP_FROZEN, &cgrp->flags) && in cgroup_propagate_frozen()
28 test_bit(CGRP_FREEZE, &cgrp->flags) && in cgroup_propagate_frozen()
29 cgrp->freezer.nr_frozen_descendants == in cgroup_propagate_frozen()
30 cgrp->nr_descendants) { in cgroup_propagate_frozen()
31 set_bit(CGRP_FROZEN, &cgrp->flags); in cgroup_propagate_frozen()
32 cgroup_file_notify(&cgrp->events_file); in cgroup_propagate_frozen()
33 TRACE_CGROUP_PATH(notify_frozen, cgrp, 1); in cgroup_propagate_frozen()
37 cgrp->freezer.nr_frozen_descendants -= desc; in cgroup_propagate_frozen()
38 if (test_bit(CGRP_FROZEN, &cgrp->flags)) { in cgroup_propagate_frozen()
39 clear_bit(CGRP_FROZEN, &cgrp->flags); in cgroup_propagate_frozen()
40 cgroup_file_notify(&cgrp->events_file); in cgroup_propagate_frozen()
41 TRACE_CGROUP_PATH(notify_frozen, cgrp, 0); in cgroup_propagate_frozen()
52 void cgroup_update_frozen(struct cgroup *cgrp) in cgroup_update_frozen() argument
63 frozen = test_bit(CGRP_FREEZE, &cgrp->flags) && in cgroup_update_frozen()
64 cgrp->freezer.nr_frozen_tasks == __cgroup_task_count(cgrp); in cgroup_update_frozen()
68 if (test_bit(CGRP_FROZEN, &cgrp->flags)) in cgroup_update_frozen()
71 set_bit(CGRP_FROZEN, &cgrp->flags); in cgroup_update_frozen()
74 if (!test_bit(CGRP_FROZEN, &cgrp->flags)) in cgroup_update_frozen()
77 clear_bit(CGRP_FROZEN, &cgrp->flags); in cgroup_update_frozen()
79 cgroup_file_notify(&cgrp->events_file); in cgroup_update_frozen()
80 TRACE_CGROUP_PATH(notify_frozen, cgrp, frozen); in cgroup_update_frozen()
83 cgroup_propagate_frozen(cgrp, frozen); in cgroup_update_frozen()
89 static void cgroup_inc_frozen_cnt(struct cgroup *cgrp) in cgroup_inc_frozen_cnt() argument
91 cgrp->freezer.nr_frozen_tasks++; in cgroup_inc_frozen_cnt()
97 static void cgroup_dec_frozen_cnt(struct cgroup *cgrp) in cgroup_dec_frozen_cnt() argument
99 cgrp->freezer.nr_frozen_tasks--; in cgroup_dec_frozen_cnt()
100 WARN_ON_ONCE(cgrp->freezer.nr_frozen_tasks < 0); in cgroup_dec_frozen_cnt()
109 struct cgroup *cgrp; in cgroup_enter_frozen() local
116 cgrp = task_dfl_cgroup(current); in cgroup_enter_frozen()
117 cgroup_inc_frozen_cnt(cgrp); in cgroup_enter_frozen()
118 cgroup_update_frozen(cgrp); in cgroup_enter_frozen()
133 struct cgroup *cgrp; in cgroup_leave_frozen() local
136 cgrp = task_dfl_cgroup(current); in cgroup_leave_frozen()
137 if (always_leave || !test_bit(CGRP_FREEZE, &cgrp->flags)) { in cgroup_leave_frozen()
138 cgroup_dec_frozen_cnt(cgrp); in cgroup_leave_frozen()
139 cgroup_update_frozen(cgrp); in cgroup_leave_frozen()
177 static void cgroup_do_freeze(struct cgroup *cgrp, bool freeze) in cgroup_do_freeze() argument
186 set_bit(CGRP_FREEZE, &cgrp->flags); in cgroup_do_freeze()
188 clear_bit(CGRP_FREEZE, &cgrp->flags); in cgroup_do_freeze()
192 TRACE_CGROUP_PATH(freeze, cgrp); in cgroup_do_freeze()
194 TRACE_CGROUP_PATH(unfreeze, cgrp); in cgroup_do_freeze()
196 css_task_iter_start(&cgrp->self, 0, &it); in cgroup_do_freeze()
213 if (cgrp->nr_descendants == cgrp->freezer.nr_frozen_descendants) in cgroup_do_freeze()
214 cgroup_update_frozen(cgrp); in cgroup_do_freeze()
260 void cgroup_freeze(struct cgroup *cgrp, bool freeze) in cgroup_freeze() argument
271 if (cgrp->freezer.freeze == freeze) in cgroup_freeze()
274 cgrp->freezer.freeze = freeze; in cgroup_freeze()
279 css_for_each_descendant_pre(css, &cgrp->self) { in cgroup_freeze()
319 TRACE_CGROUP_PATH(notify_frozen, cgrp, in cgroup_freeze()
320 test_bit(CGRP_FROZEN, &cgrp->flags)); in cgroup_freeze()
321 cgroup_file_notify(&cgrp->events_file); in cgroup_freeze()