aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cgroup.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r--include/linux/cgroup.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index 1b7f9d525013..34256ad9e553 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -457,6 +457,28 @@ void cgroup_exclude_rmdir(struct cgroup_subsys_state *css);
457void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css); 457void cgroup_release_and_wakeup_rmdir(struct cgroup_subsys_state *css);
458 458
459/* 459/*
460 * Control Group taskset, used to pass around set of tasks to cgroup_subsys
461 * methods.
462 */
463struct cgroup_taskset;
464struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset);
465struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset);
466struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset);
467int cgroup_taskset_size(struct cgroup_taskset *tset);
468
469/**
470 * cgroup_taskset_for_each - iterate cgroup_taskset
471 * @task: the loop cursor
472 * @skip_cgrp: skip if task's cgroup matches this, %NULL to iterate through all
473 * @tset: taskset to iterate
474 */
475#define cgroup_taskset_for_each(task, skip_cgrp, tset) \
476 for ((task) = cgroup_taskset_first((tset)); (task); \
477 (task) = cgroup_taskset_next((tset))) \
478 if (!(skip_cgrp) || \
479 cgroup_taskset_cur_cgroup((tset)) != (skip_cgrp))
480
481/*
460 * Control Group subsystem type. 482 * Control Group subsystem type.
461 * See Documentation/cgroups/cgroups.txt for details 483 * See Documentation/cgroups/cgroups.txt for details
462 */ 484 */
@@ -467,14 +489,14 @@ struct cgroup_subsys {
467 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 489 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
468 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 490 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
469 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 491 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
470 struct task_struct *tsk); 492 struct cgroup_taskset *tset);
471 int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk); 493 int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
472 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 494 void (*cancel_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
473 struct task_struct *tsk); 495 struct cgroup_taskset *tset);
474 void (*pre_attach)(struct cgroup *cgrp); 496 void (*pre_attach)(struct cgroup *cgrp);
475 void (*attach_task)(struct cgroup *cgrp, struct task_struct *tsk); 497 void (*attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
476 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 498 void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
477 struct cgroup *old_cgrp, struct task_struct *tsk); 499 struct cgroup_taskset *tset);
478 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); 500 void (*fork)(struct cgroup_subsys *ss, struct task_struct *task);
479 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp, 501 void (*exit)(struct cgroup_subsys *ss, struct cgroup *cgrp,
480 struct cgroup *old_cgrp, struct task_struct *task); 502 struct cgroup *old_cgrp, struct task_struct *task);