• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/kernel/

Lines Matching refs:cgroup

29 #include <linux/cgroup.h>
67 * Generate an array of cgroup subsystem pointers. At boot time, this is
80 * A cgroupfs_root represents the root of a cgroup hierarchy,
102 /* The root cgroup for this hierarchy */
103 struct cgroup top_cgroup;
124 * single cgroup, and all tasks are part of that cgroup.
136 * after cgroup is populated. If cgroup is removed, this will be NULL.
167 struct cgroup *cgrp;
177 * Each of these stored in a list by the cgroup.
199 /* dummytop is a shorthand for the dummy hierarchy's top cgroup */
224 inline int cgroup_is_removed(const struct cgroup *cgrp)
234 static int cgroup_is_releasable(const struct cgroup *cgrp)
242 static int notify_on_release(const struct cgroup *cgrp)
264 static void check_for_release(struct cgroup *cgrp);
270 * cgroup, anchored on cgroup->css_sets
273 struct cgroup *cgrp;
302 * hash table for cgroup groups. This improves the performance to find
354 /* This css_set is dead. unlink it and release cgroup refcounts */
360 struct cgroup *cgrp = link->cgrp;
399 * @new_cgrp: cgroup that's being entered by the task
407 struct cgroup *new_cgrp,
418 * Compare cgroup pointers in order to distinguish between
430 struct cgroup *cg1, *cg2;
450 * If this hierarchy is the hierarchy of the cgroup
452 * css_set points to the new cgroup; if it's any other
454 * same cgroup as the old css_set.
472 * oldcg: the cgroup group that we're using before the cgroup
475 * cgrp: the cgroup that we're moving into
478 * state objects for the new cgroup group
482 struct cgroup *cgrp,
500 * cgroup */
518 /* No existing cgroup group matched */
555 * link_css_set - a helper function to link a css_set to a cgroup
558 * @cgrp: the destination cgroup
561 struct css_set *cg, struct cgroup *cgrp)
580 * find_css_set() takes an existing cgroup group and a
581 * cgroup object, and returns a css_set object that's
582 * equivalent to the old group, but with the given cgroup
587 struct css_set *oldcg, struct cgroup *cgrp)
597 /* First see if we already have a cgroup group that matches
630 struct cgroup *c = link->cgrp;
640 /* Add this cgroup group to the hash table */
650 * Return the cgroup for "task" from the given hierarchy. Must be
653 static struct cgroup *task_cgroup_from_root(struct task_struct *task,
657 struct cgroup *res = NULL;
672 struct cgroup *c = link->cgrp;
685 * There is one global cgroup mutex. We also require taking
686 * task_lock() when dereferencing a task's cgroup subsys pointers.
696 * way a task attached to that cgroup can fork (the other way to
699 * a task holds cgroup_mutex on a cgroup with zero count, it
700 * knows that the cgroup won't be removed, as cgroup_rmdir()
706 * when a task in a notify_on_release cgroup exits. Then cgroup_mutex
707 * is taken, and if the cgroup count is zero, a usermode call made
708 * to the release agent with the name of the cgroup (path relative to
709 * the root of cgroup file system) as the argument.
711 * A cgroup can only be deleted if both its 'count' of using tasks
713 * tasks in the system use _some_ cgroup, and since there is always at
721 * cgroup_attach_task(), which overwrites one tasks cgroup pointer with
724 * task->cgroup without the expense of grabbing a system global
726 * in cgroup_attach_task(), modifying a task'ss cgroup pointer we use
731 * update of a tasks cgroup pointer by cgroup_attach_task()
735 * cgroup_lock - lock out any changes to cgroup structures
745 * cgroup_unlock - release lock on cgroup changes
764 static int cgroup_populate_dir(struct cgroup *cgrp);
769 .name = "cgroup",
774 struct cgroup *parent, struct cgroup *child);
794 static int cgroup_call_pre_destroy(struct cgroup *cgrp)
811 struct cgroup *cgrp = container_of(obj, struct cgroup, rcu_head);
818 /* is dentry a directory ? if so, kfree() associated cgroup */
820 struct cgroup *cgrp = dentry->d_fsdata;
824 * reference counts on a cgroup; css_put() needs to
825 * be able to access the cgroup after decrementing
827 * queue the cgroup to be handled by the release
843 * created the cgroup
848 * if we're getting rid of the cgroup, refcount should ensure
878 /* This should never be called on a cgroup
907 * A queue for waiters to do rmdir() cgroup. A tasks will sleep when
908 * cgroup->count == 0 && list_empty(&cgroup->children) && subsys has some
912 * CGRP_WAIT_ON_RMDIR flag is set under cgroup's inode->i_mutex;
916 static void cgroup_wakeup_rmdir_waiter(struct cgroup *cgrp)
929 cgroup_wakeup_rmdir_waiter(css->cgroup);
942 struct cgroup *cgrp = &root->top_cgroup;
983 BUG_ON(dummytop->subsys[i]->cgroup != dummytop);
986 cgrp->subsys[i]->cgroup = cgrp;
997 BUG_ON(cgrp->subsys[i]->cgroup != cgrp);
1001 dummytop->subsys[i]->cgroup = dummytop;
1222 struct cgroup *cgrp = &root->top_cgroup;
1269 static void init_cgroup_housekeeping(struct cgroup *cgrp)
1283 struct cgroup *cgrp = &root->top_cgroup;
1441 * Allocate a new cgroup root. We may not need it if we're
1464 struct cgroup *root_cgrp = &root->top_cgroup;
1527 /* Link the top cgroup in this hierarchy into all
1577 struct cgroup *cgrp = &root->top_cgroup;
1597 * root cgroup
1621 .name = "cgroup",
1628 static inline struct cgroup *__d_cgrp(struct dentry *dentry)
1639 * cgroup_path - generate the path of a cgroup
1640 * @cgrp: the cgroup in question
1644 * Called with cgroup_mutex held or else with an RCU-protected cgroup
1645 * reference. Writes path of cgroup into buf. Returns 0 on success,
1648 int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
1658 * cgroup
1692 * cgroup_attach_task - attach task 'tsk' to cgroup 'cgrp'
1693 * @cgrp: the cgroup the task is attaching to
1699 int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
1703 struct cgroup *oldcgrp;
1708 /* Nothing to do if the task is already in that cgroup */
1771 * wake up rmdir() waiter. the rmdir should fail since the cgroup
1805 struct cgroup *from_cg = task_cgroup_from_root(from, root);
1818 * Attach task with pid 'pid' to cgroup 'cgrp'. Call with cgroup_mutex
1821 static int attach_task_by_pid(struct cgroup *cgrp, u64 pid)
1854 static int cgroup_tasks_write(struct cgroup *cgrp, struct cftype *cft, u64 pid)
1866 * @cgrp: the cgroup to be checked for liveness
1871 bool cgroup_lock_live_group(struct cgroup *cgrp)
1882 static int cgroup_release_agent_write(struct cgroup *cgrp, struct cftype *cft,
1893 static int cgroup_release_agent_show(struct cgroup *cgrp, struct cftype *cft,
1907 static ssize_t cgroup_write_X64(struct cgroup *cgrp, struct cftype *cft,
1940 static ssize_t cgroup_write_string(struct cgroup *cgrp, struct cftype *cft,
1979 struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent);
1996 static ssize_t cgroup_read_u64(struct cgroup *cgrp, struct cftype *cft,
2008 static ssize_t cgroup_read_s64(struct cgroup *cgrp, struct cftype *cft,
2024 struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent);
2045 struct cgroup *cgroup;
2063 return cft->read_map(state->cgroup, cft, &cb);
2065 return cft->read_seq_string(state->cgroup, cft, m);
2098 state->cgroup = __d_cgrp(file->f_dentry->d_parent);
2199 * @cgrp: the cgroup we create the directory for. It must have a valid
2201 * @dentry: dentry of the new cgroup
2204 static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry,
2250 int cgroup_add_file(struct cgroup *cgrp,
2280 int cgroup_add_files(struct cgroup *cgrp,
2296 * cgroup_task_count - count the number of tasks in a cgroup.
2297 * @cgrp: the cgroup in question
2299 * Return the number of tasks in the cgroup.
2301 int cgroup_task_count(const struct cgroup *cgrp)
2318 static void cgroup_advance_iter(struct cgroup *cgrp,
2367 void cgroup_iter_start(struct cgroup *cgrp, struct cgroup_iter *it)
2370 * The first time anyone tries to iterate across a cgroup,
2382 struct task_struct *cgroup_iter_next(struct cgroup *cgrp,
2406 void cgroup_iter_end(struct cgroup *cgrp, struct cgroup_iter *it)
2446 * cgroup_scan_tasks - iterate though all the tasks in a cgroup
2451 * Iterate through all the tasks in a cgroup, calling test_task() for each,
2459 * is a member of the cgroup for the duration of this call. This
2461 * or move to a different cgroup during the call, or are forked or
2462 * move into the cgroup during the call.
2498 * Scan tasks in the cgroup, using the scanner's "test_task" callback
2574 * Reading this file can return large amounts of data if a cgroup has
2674 static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp,
2715 * Load a cgroup's pidarray with either procs' tgids or tasks' pids
2717 static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type,
2728 * If cgroup gets more users after we read count, we won't have
2730 * caller from the case that the additional cgroup users didn't
2774 * @dentry: A dentry entry belonging to the cgroup for which stats have
2783 struct cgroup *cgrp;
2829 * in the cgroup->l->list array.
2912 * have us remove it from the cgroup's list, which entails taking the
2913 * mutex. since in pidlist_find the pidlist->lock depends on cgroup->
2957 * in the cgroup.
2962 struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent);
2994 static u64 cgroup_read_notify_on_release(struct cgroup *cgrp,
3000 static int cgroup_write_notify_on_release(struct cgroup *cgrp,
3021 struct cgroup *cgrp = event->cgrp;
3040 struct cgroup *cgrp = event->cgrp;
3069 * Parse input and register new cgroup event handler.
3074 static int cgroup_write_event_control(struct cgroup *cgrp, struct cftype *cft,
3149 * Events should be removed after rmdir of cgroup directory, but before
3150 * destroying subsystem state objects. Let's take reference to cgroup
3183 #define CGROUP_FILE_GENERIC_PREFIX "cgroup."
3218 static int cgroup_populate_dir(struct cgroup *cgrp)
3239 /* This cgroup is ready now */
3256 struct cgroup *cgrp)
3258 css->cgroup = cgrp;
3300 * cgroup_create - create a cgroup
3301 * @parent: cgroup that will be parent of the new cgroup
3302 * @dentry: dentry of the new cgroup
3307 static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
3310 struct cgroup *cgrp;
3363 /* The cgroup directory was pre-locked for us */
3399 struct cgroup *c_parent = dentry->d_parent->d_fsdata;
3405 static int cgroup_has_css_refs(struct cgroup *cgrp)
3409 * cgroup, if the css refcount is also 1, then there should
3419 * we're concerned about aren't going anywhere since our cgroup root
3430 * that by this point the cgroup has been removed
3432 * matter, since it can only happen if the cgroup
3442 * Atomically mark all (or else none) of the cgroup's CSS objects as
3443 * CSS_REMOVED. Return true on success, or false if the cgroup has
3447 static int cgroup_clear_css_refs(struct cgroup *cgrp)
3496 struct cgroup *cgrp = dentry->d_fsdata;
3498 struct cgroup *parent;
3521 * for cgroup's rmdir. CGRP_WAIT_ON_RMDIR is for synchronizing rmdir
3570 /* delete this cgroup from parent->children */
3586 * Notify userspace about cgroup removing only after rmdir of cgroup
3606 printk(KERN_INFO "Initializing cgroup subsys %s\n", ss->name);
3608 /* Create the top cgroup state for this subsystem */
3619 * init_css_set is in the subsystem's top cgroup. */
3824 * cgroup_init_early - cgroup initialization at system boot
3860 printk(KERN_ERR "cgroup: Subsys %s id == %d\n",
3872 * cgroup_init - cgroup initialization
3874 * Register cgroup filesystem and /proc file, and initialize
3901 cgroup_kobj = kobject_create_and_add("cgroup", fs_kobj);
3924 * - Print task's cgroup paths into seq_file, one line for each hierarchy
3925 * - Used for /proc/<pid>/cgroup.
3926 * - No need to task_lock(tsk) on this tsk->cgroup reference, as it
3927 * doesn't really matter if tsk->cgroup changes after we read it,
3929 * anyway. No need to check that tsk->cgroup != NULL, thanks to
3931 * cgroup to top_cgroup.
3960 struct cgroup *cgrp;
4037 * cgroup_fork - attach newly forked task to its parents cgroup.
4040 * Description: A task inherits its parent's cgroup at fork().
4045 * might no longer be a valid cgroup pointer. cgroup_attach_task() might
4047 * referenced cgroup group to be removed and freed.
4107 * cgroup_exit - detach cgroup from exiting task
4111 * Description: Detach cgroup from @tsk and release it.
4121 * Set the exiting tasks cgroup to the root cgroup (top_cgroup).
4125 * root cgroup in each hierarchy for the remainder of its exit.
4129 * code we would add a second cgroup function call, to drop that
4133 * Normally, holding a reference to a cgroup without bumping its
4134 * count is unsafe. The cgroup could go away, or someone could
4135 * attach us to a different cgroup, decrementing the count on
4136 * the first cgroup that we never incremented. But in this case,
4180 * cgroup_clone - clone the cgroup the given subsystem is attached to
4183 * @nodename: the name for the new cgroup
4185 * Duplicate the current cgroup in the hierarchy that the given
4194 struct cgroup *parent, *child;
4203 /* First figure out what hierarchy and cgroup we're dealing
4220 /* Keep the cgroup alive */
4229 /* Now do the VFS work to create a cgroup */
4233 * stop anyone else deleting the new cgroup */
4238 "cgroup: Couldn't allocate dentry for %s: %ld\n", nodename,
4244 /* Create the cgroup directory, which also creates the cgroup */
4250 "Failed to create cgroup %s: %d\n", nodename,
4255 /* The cgroup now exists. Retake cgroup_mutex and check
4266 /* The cgroup is still accessible in the VFS, but
4270 "Race in cgroup_clone() - leaking cgroup %s\n",
4281 /* All seems fine. Finish by moving the task into the new cgroup */
4297 * @cgrp: the cgroup in question
4300 * See if @cgrp is a descendant of @task's cgroup in the appropriate
4304 * the top cgroup in the subsystem.
4306 * Called only by the ns (nsproxy) cgroup.
4308 int cgroup_is_descendant(const struct cgroup *cgrp, struct task_struct *task)
4311 struct cgroup *target;
4323 static void check_for_release(struct cgroup *cgrp)
4325 /* All of these checks rely on RCU to keep the cgroup
4345 /* Caller must verify that the css is not for root cgroup */
4348 struct cgroup *cgrp = css->cgroup;
4365 * Notify userspace when a cgroup is released, by running the
4366 * configured release agent with the name of the cgroup (path
4367 * relative to the root of cgroup file system) as the argument.
4369 * Most likely, this user command will try to rmdir this cgroup.
4372 * attached to this cgroup before it is removed, or that some other
4373 * user task will 'mkdir' a child cgroup of this cgroup. That's ok.
4374 * The presumed 'rmdir' will fail quietly if this cgroup is no longer
4375 * unused, and this cgroup will be reprieved from its death sentence,
4396 struct cgroup *cgrp = list_entry(release_list.next,
4397 struct cgroup,
4625 static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent,
4626 struct cgroup *child)
4646 * child_id->css pointer will be set after this cgroup is available
4656 * @ss: cgroup subsys to be looked into.
4677 * css_get_next - lookup next cgroup under specified hierarchy.
4728 struct cgroup *cont)
4738 static void debug_destroy(struct cgroup_subsys *ss, struct cgroup *cont)
4743 static u64 cgroup_refcount_read(struct cgroup *cont, struct cftype *cft)
4748 static u64 debug_taskcount_read(struct cgroup *cont, struct cftype *cft)
4753 static u64 current_css_set_read(struct cgroup *cont, struct cftype *cft)
4758 static u64 current_css_set_refcount_read(struct cgroup *cont,
4769 static int current_css_set_cg_links_read(struct cgroup *cont,
4780 struct cgroup *c = link->cgrp;
4796 static int cgroup_css_links_read(struct cgroup *cont,
4822 static u64 releasable_read(struct cgroup *cgrp, struct cftype *cft)
4863 static int debug_populate(struct cgroup_subsys *ss, struct cgroup *cont)