X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=include%2Flinux%2Fcgroup.h;h=a6a6035a4e1ec16d1e27a3f2470fc316c476cd6a;hb=9e9abecfc0ff3a9ad2ead954b37bbfcb863c775e;hp=87479328d46ddf88de95b3038f98134f74fc054e;hpb=846c7bb055747989891f5cd2bb6e8d56243ba1e7;p=mv-sheeva.git diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 87479328d46..a6a6035a4e1 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -14,6 +14,7 @@ #include #include #include +#include #ifdef CONFIG_CGROUPS @@ -174,7 +175,7 @@ struct css_set { * * * When reading/writing to a file: - * - the cgroup to use in file->f_dentry->d_parent->d_fsdata + * - the cgroup to use is file->f_dentry->d_parent->d_fsdata * - the 'cftype' of the file is file->f_dentry->d_fsdata */ @@ -185,15 +186,15 @@ struct cftype { char name[MAX_CFTYPE_NAME]; int private; int (*open) (struct inode *inode, struct file *file); - ssize_t (*read) (struct cgroup *cont, struct cftype *cft, + ssize_t (*read) (struct cgroup *cgrp, struct cftype *cft, struct file *file, char __user *buf, size_t nbytes, loff_t *ppos); /* * read_uint() is a shortcut for the common case of returning a * single integer. Use it in place of read() */ - u64 (*read_uint) (struct cgroup *cont, struct cftype *cft); - ssize_t (*write) (struct cgroup *cont, struct cftype *cft, + u64 (*read_uint) (struct cgroup *cgrp, struct cftype *cft); + ssize_t (*write) (struct cgroup *cgrp, struct cftype *cft, struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos); @@ -202,50 +203,60 @@ struct cftype { * a single integer (as parsed by simple_strtoull) from * userspace. Use in place of write(); return 0 or error. */ - int (*write_uint) (struct cgroup *cont, struct cftype *cft, u64 val); + int (*write_uint) (struct cgroup *cgrp, struct cftype *cft, u64 val); int (*release) (struct inode *inode, struct file *file); }; +struct cgroup_scanner { + struct cgroup *cg; + int (*test_task)(struct task_struct *p, struct cgroup_scanner *scan); + void (*process_task)(struct task_struct *p, + struct cgroup_scanner *scan); + struct ptr_heap *heap; +}; + /* Add a new file to the given cgroup directory. Should only be * called by subsystems from within a populate() method */ -int cgroup_add_file(struct cgroup *cont, struct cgroup_subsys *subsys, +int cgroup_add_file(struct cgroup *cgrp, struct cgroup_subsys *subsys, const struct cftype *cft); /* Add a set of new files to the given cgroup directory. Should * only be called by subsystems from within a populate() method */ -int cgroup_add_files(struct cgroup *cont, +int cgroup_add_files(struct cgroup *cgrp, struct cgroup_subsys *subsys, const struct cftype cft[], int count); -int cgroup_is_removed(const struct cgroup *cont); +int cgroup_is_removed(const struct cgroup *cgrp); -int cgroup_path(const struct cgroup *cont, char *buf, int buflen); +int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen); -int cgroup_task_count(const struct cgroup *cont); +int cgroup_task_count(const struct cgroup *cgrp); /* Return true if the cgroup is a descendant of the current cgroup */ -int cgroup_is_descendant(const struct cgroup *cont); +int cgroup_is_descendant(const struct cgroup *cgrp); /* Control Group subsystem type. See Documentation/cgroups.txt for details */ struct cgroup_subsys { struct cgroup_subsys_state *(*create)(struct cgroup_subsys *ss, - struct cgroup *cont); - void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cont); + struct cgroup *cgrp); + void (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); + void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); int (*can_attach)(struct cgroup_subsys *ss, - struct cgroup *cont, struct task_struct *tsk); - void (*attach)(struct cgroup_subsys *ss, struct cgroup *cont, - struct cgroup *old_cont, struct task_struct *tsk); + struct cgroup *cgrp, struct task_struct *tsk); + void (*attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, + struct cgroup *old_cgrp, struct task_struct *tsk); void (*fork)(struct cgroup_subsys *ss, struct task_struct *task); void (*exit)(struct cgroup_subsys *ss, struct task_struct *task); int (*populate)(struct cgroup_subsys *ss, - struct cgroup *cont); - void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cont); + struct cgroup *cgrp); + void (*post_clone)(struct cgroup_subsys *ss, struct cgroup *cgrp); void (*bind)(struct cgroup_subsys *ss, struct cgroup *root); int subsys_id; int active; + int disabled; int early_init; #define MAX_CGROUP_TYPE_NAMELEN 32 const char *name; @@ -263,9 +274,9 @@ struct cgroup_subsys { #undef SUBSYS static inline struct cgroup_subsys_state *cgroup_subsys_state( - struct cgroup *cont, int subsys_id) + struct cgroup *cgrp, int subsys_id) { - return cont->subsys[subsys_id]; + return cgrp->subsys[subsys_id]; } static inline struct cgroup_subsys_state *task_subsys_state( @@ -280,8 +291,6 @@ static inline struct cgroup* task_cgroup(struct task_struct *task, return task_subsys_state(task, subsys_id)->cgroup; } -int cgroup_path(const struct cgroup *cont, char *buf, int buflen); - int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *ss); /* A cgroup_iter should be treated as an opaque object */ @@ -298,11 +307,17 @@ struct cgroup_iter { * returns NULL or until you want to end the iteration * * 3) call cgroup_iter_end() to destroy the iterator. + * + * Or, call cgroup_scan_tasks() to iterate through every task in a cpuset. + * - cgroup_scan_tasks() holds the css_set_lock when calling the test_task() + * callback, but not while calling the process_task() callback. */ -void cgroup_iter_start(struct cgroup *cont, struct cgroup_iter *it); -struct task_struct *cgroup_iter_next(struct cgroup *cont, +void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it); +struct task_struct *cgroup_iter_next(struct cgroup *cgrp, struct cgroup_iter *it); -void cgroup_iter_end(struct cgroup *cont, struct cgroup_iter *it); +void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it); +int cgroup_scan_tasks(struct cgroup_scanner *scan); +int cgroup_attach_task(struct cgroup *, struct task_struct *); #else /* !CONFIG_CGROUPS */