Lines Matching defs:pids

13  * In order to use the `pids` controller, set the maximum number of tasks in
14 * pids.max (this is not available in the root cgroup for obvious reasons). The
15 * number of processes currently in the cgroup is given by pids.current.
17 * possible to have pids.current > pids.max. However, it is not possible to
21 * To set a cgroup to have no limit, set pids.max to "max". This is the default
25 * pids.current tracks all child cgroup hierarchies, so parent/pids.current is
26 * a superset of parent/child/pids.current.
52 /* Handle for "pids.events" */
64 static struct pids_cgroup *parent_pids(struct pids_cgroup *pids)
66 return css_pids(pids->css.parent);
72 struct pids_cgroup *pids;
74 pids = kzalloc(sizeof(struct pids_cgroup), GFP_KERNEL);
75 if (!pids)
78 atomic64_set(&pids->counter, 0);
79 atomic64_set(&pids->limit, PIDS_MAX);
80 atomic64_set(&pids->events_limit, 0);
81 return &pids->css;
101 * @pids: the pid cgroup state
102 * @num: the number of pids to cancel
105 * a bug in the pids controller proper.
107 static void pids_cancel(struct pids_cgroup *pids, int num)
111 * and indicates a bug in the `pids` controller proper.
113 WARN_ON_ONCE(atomic64_add_negative(-num, &pids->counter));
118 * @pids: the pid cgroup state
119 * @num: the number of pids to uncharge
121 static void pids_uncharge(struct pids_cgroup *pids, int num)
125 for (p = pids; parent_pids(p); p = parent_pids(p))
131 * @pids: the pid cgroup state
132 * @num: the number of pids to charge
138 static void pids_charge(struct pids_cgroup *pids, int num)
142 for (p = pids; parent_pids(p); p = parent_pids(p)) {
151 * @pids: the pid cgroup state
152 * @num: the number of pids to charge
158 static int pids_try_charge(struct pids_cgroup *pids, int num)
162 for (p = pids; parent_pids(p); p = parent_pids(p)) {
184 for (q = pids; q != p; q = parent_pids(q))
197 struct pids_cgroup *pids = css_pids(dst_css);
209 pids_charge(pids, 1);
222 struct pids_cgroup *pids = css_pids(dst_css);
230 pids_uncharge(pids, 1);
241 struct pids_cgroup *pids;
248 pids = css_pids(css);
249 err = pids_try_charge(pids, 1);
252 if (atomic64_inc_return(&pids->events_limit) == 1) {
253 pr_info("cgroup: fork rejected by pids controller in ");
257 cgroup_file_notify(&pids->events_file);
265 struct pids_cgroup *pids;
271 pids = css_pids(css);
272 pids_uncharge(pids, 1);
277 struct pids_cgroup *pids = css_pids(task_css(task, pids_cgrp_id));
279 pids_uncharge(pids, 1);
286 struct pids_cgroup *pids = css_pids(css);
308 atomic64_set(&pids->limit, limit);
315 struct pids_cgroup *pids = css_pids(css);
316 int64_t limit = atomic64_read(&pids->limit);
329 struct pids_cgroup *pids = css_pids(css);
331 return atomic64_read(&pids->counter);
337 struct pids_cgroup *pids = css_pids(css);
339 return READ_ONCE(pids->watermark);
344 struct pids_cgroup *pids = css_pids(seq_css(sf));
346 seq_printf(sf, "max %lld\n", (s64)atomic64_read(&pids->events_limit));