Lines Matching refs:pids
63 static struct pids_cgroup *parent_pids(struct pids_cgroup *pids) in parent_pids() argument
65 return css_pids(pids->css.parent); in parent_pids()
71 struct pids_cgroup *pids; in pids_css_alloc() local
73 pids = kzalloc(sizeof(struct pids_cgroup), GFP_KERNEL); in pids_css_alloc()
74 if (!pids) in pids_css_alloc()
77 atomic64_set(&pids->counter, 0); in pids_css_alloc()
78 atomic64_set(&pids->limit, PIDS_MAX); in pids_css_alloc()
79 atomic64_set(&pids->events_limit, 0); in pids_css_alloc()
80 return &pids->css; in pids_css_alloc()
96 static void pids_cancel(struct pids_cgroup *pids, int num) in pids_cancel() argument
102 WARN_ON_ONCE(atomic64_add_negative(-num, &pids->counter)); in pids_cancel()
110 static void pids_uncharge(struct pids_cgroup *pids, int num) in pids_uncharge() argument
114 for (p = pids; parent_pids(p); p = parent_pids(p)) in pids_uncharge()
127 static void pids_charge(struct pids_cgroup *pids, int num) in pids_charge() argument
131 for (p = pids; parent_pids(p); p = parent_pids(p)) in pids_charge()
144 static int pids_try_charge(struct pids_cgroup *pids, int num) in pids_try_charge() argument
148 for (p = pids; parent_pids(p); p = parent_pids(p)) { in pids_try_charge()
164 for (q = pids; q != p; q = parent_pids(q)) in pids_try_charge()
177 struct pids_cgroup *pids = css_pids(dst_css); in pids_can_attach() local
189 pids_charge(pids, 1); in pids_can_attach()
202 struct pids_cgroup *pids = css_pids(dst_css); in pids_cancel_attach() local
210 pids_uncharge(pids, 1); in pids_cancel_attach()
221 struct pids_cgroup *pids; in pids_can_fork() local
228 pids = css_pids(css); in pids_can_fork()
229 err = pids_try_charge(pids, 1); in pids_can_fork()
232 if (atomic64_inc_return(&pids->events_limit) == 1) { in pids_can_fork()
237 cgroup_file_notify(&pids->events_file); in pids_can_fork()
245 struct pids_cgroup *pids; in pids_cancel_fork() local
251 pids = css_pids(css); in pids_cancel_fork()
252 pids_uncharge(pids, 1); in pids_cancel_fork()
257 struct pids_cgroup *pids = css_pids(task_css(task, pids_cgrp_id)); in pids_release() local
259 pids_uncharge(pids, 1); in pids_release()
266 struct pids_cgroup *pids = css_pids(css); in pids_max_write() local
288 atomic64_set(&pids->limit, limit); in pids_max_write()
295 struct pids_cgroup *pids = css_pids(css); in pids_max_show() local
296 int64_t limit = atomic64_read(&pids->limit); in pids_max_show()
309 struct pids_cgroup *pids = css_pids(css); in pids_current_read() local
311 return atomic64_read(&pids->counter); in pids_current_read()
316 struct pids_cgroup *pids = css_pids(seq_css(sf)); in pids_events_show() local
318 seq_printf(sf, "max %lld\n", (s64)atomic64_read(&pids->events_limit)); in pids_events_show()