Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139650
b: refs/heads/master
c: d20a390
h: refs/heads/master
v: v3
  • Loading branch information
Paul Menage authored and Linus Torvalds committed Apr 3, 2009
1 parent 0f77a84 commit 2f31ec0
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 45dad7bd9d9b65a30d6e790b111f6f2d8f746d22
refs/heads/master: d20a390a0ee2bf2f692c539c6ce1c829e1080bb5
71 changes: 41 additions & 30 deletions trunk/include/linux/cgroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,18 @@ enum cgroup_subsys_id {

/* Per-subsystem/per-cgroup state maintained by the system. */
struct cgroup_subsys_state {
/* The cgroup that this subsystem is attached to. Useful
/*
* The cgroup that this subsystem is attached to. Useful
* for subsystems that want to know about the cgroup
* hierarchy structure */
* hierarchy structure
*/
struct cgroup *cgroup;

/* State maintained by the cgroup system to allow subsystems
/*
* State maintained by the cgroup system to allow subsystems
* to be "busy". Should be accessed via css_get(),
* css_tryget() and and css_put(). */
* css_tryget() and and css_put().
*/

atomic_t refcnt;

Expand Down Expand Up @@ -120,8 +124,10 @@ static inline void css_put(struct cgroup_subsys_state *css)
enum {
/* Control Group is dead */
CGRP_REMOVED,
/* Control Group has previously had a child cgroup or a task,
* but no longer (only if CGRP_NOTIFY_ON_RELEASE is set) */
/*
* Control Group has previously had a child cgroup or a task,
* but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
*/
CGRP_RELEASABLE,
/* Control Group requires release notifications to userspace */
CGRP_NOTIFY_ON_RELEASE,
Expand All @@ -130,9 +136,10 @@ enum {
struct cgroup {
unsigned long flags; /* "unsigned long" so bitops work */

/* count users of this cgroup. >0 means busy, but doesn't
* necessarily indicate the number of tasks in the
* cgroup */
/*
* count users of this cgroup. >0 means busy, but doesn't
* necessarily indicate the number of tasks in the cgroup
*/
atomic_t count;

/*
Expand All @@ -142,7 +149,7 @@ struct cgroup {
struct list_head sibling; /* my parent's children */
struct list_head children; /* my children */

struct cgroup *parent; /* my parent */
struct cgroup *parent; /* my parent */
struct dentry *dentry; /* cgroup fs entry, RCU protected */

/* Private pointers for each registered subsystem */
Expand Down Expand Up @@ -177,11 +184,12 @@ struct cgroup {
struct rcu_head rcu_head;
};

/* A css_set is a structure holding pointers to a set of
/*
* A css_set is a structure holding pointers to a set of
* cgroup_subsys_state objects. This saves space in the task struct
* object and speeds up fork()/exit(), since a single inc/dec and a
* list_add()/del() can bump the reference count on the entire
* cgroup set for a task.
* list_add()/del() can bump the reference count on the entire cgroup
* set for a task.
*/

struct css_set {
Expand Down Expand Up @@ -226,13 +234,8 @@ struct cgroup_map_cb {
void *state;
};

/* struct cftype:
*
* The files in the cgroup filesystem mostly have a very simple read/write
* handling, some common function will take care of it. Nevertheless some cases
* (read tasks) are special and therefore I define this structure for every
* kind of file.
*
/*
* struct cftype: handler definitions for cgroup control files
*
* When reading/writing to a file:
* - the cgroup to use is file->f_dentry->d_parent->d_fsdata
Expand All @@ -241,8 +244,10 @@ struct cgroup_map_cb {

#define MAX_CFTYPE_NAME 64
struct cftype {
/* By convention, the name should begin with the name of the
* subsystem, followed by a period */
/*
* By convention, the name should begin with the name of the
* subsystem, followed by a period
*/
char name[MAX_CFTYPE_NAME];
int private;

Expand Down Expand Up @@ -321,13 +326,17 @@ struct cgroup_scanner {
struct ptr_heap *heap;
};

/* Add a new file to the given cgroup directory. Should only be
* called by subsystems from within a populate() method */
/*
* 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 *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 */
/*
* 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 *cgrp,
struct cgroup_subsys *subsys,
const struct cftype cft[],
Expand Down Expand Up @@ -419,7 +428,8 @@ struct cgroup_iter {
struct list_head *task;
};

/* To iterate across the tasks in a cgroup:
/*
* To iterate across the tasks in a cgroup:
*
* 1) call cgroup_iter_start to intialize an iterator
*
Expand All @@ -428,9 +438,10 @@ struct cgroup_iter {
*
* 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.
* Or, call cgroup_scan_tasks() to iterate through every task in a
* cgroup - 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 *cgrp, struct cgroup_iter *it);
struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
Expand Down

0 comments on commit 2f31ec0

Please sign in to comment.