aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/cgroups/cgroups.txt26
-rw-r--r--block/blk-cgroup.c22
-rw-r--r--include/linux/cgroup.h29
-rw-r--r--include/net/sock.h7
-rw-r--r--include/net/tcp_memcontrol.h2
-rw-r--r--kernel/cgroup.c43
-rw-r--r--kernel/cgroup_freezer.c11
-rw-r--r--kernel/cpuset.c16
-rw-r--r--kernel/events/core.c13
-rw-r--r--kernel/sched/core.c20
-rw-r--r--mm/memcontrol.c48
-rw-r--r--net/core/netprio_cgroup.c10
-rw-r--r--net/core/sock.c6
-rw-r--r--net/ipv4/tcp_memcontrol.c2
-rw-r--r--net/sched/cls_cgroup.c10
-rw-r--r--security/device_cgroup.c10
16 files changed, 113 insertions, 162 deletions
diff --git a/Documentation/cgroups/cgroups.txt b/Documentation/cgroups/cgroups.txt
index a7c96ae5557c..8e74980ab385 100644
--- a/Documentation/cgroups/cgroups.txt
+++ b/Documentation/cgroups/cgroups.txt
@@ -558,8 +558,7 @@ Each subsystem may export the following methods. The only mandatory
558methods are create/destroy. Any others that are null are presumed to 558methods are create/destroy. Any others that are null are presumed to
559be successful no-ops. 559be successful no-ops.
560 560
561struct cgroup_subsys_state *create(struct cgroup_subsys *ss, 561struct cgroup_subsys_state *create(struct cgroup *cgrp)
562 struct cgroup *cgrp)
563(cgroup_mutex held by caller) 562(cgroup_mutex held by caller)
564 563
565Called to create a subsystem state object for a cgroup. The 564Called to create a subsystem state object for a cgroup. The
@@ -574,7 +573,7 @@ identified by the passed cgroup object having a NULL parent (since
574it's the root of the hierarchy) and may be an appropriate place for 573it's the root of the hierarchy) and may be an appropriate place for
575initialization code. 574initialization code.
576 575
577void destroy(struct cgroup_subsys *ss, struct cgroup *cgrp) 576void destroy(struct cgroup *cgrp)
578(cgroup_mutex held by caller) 577(cgroup_mutex held by caller)
579 578
580The cgroup system is about to destroy the passed cgroup; the subsystem 579The cgroup system is about to destroy the passed cgroup; the subsystem
@@ -585,7 +584,7 @@ cgroup->parent is still valid. (Note - can also be called for a
585newly-created cgroup if an error occurs after this subsystem's 584newly-created cgroup if an error occurs after this subsystem's
586create() method has been called for the new cgroup). 585create() method has been called for the new cgroup).
587 586
588int pre_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp); 587int pre_destroy(struct cgroup *cgrp);
589 588
590Called before checking the reference count on each subsystem. This may 589Called before checking the reference count on each subsystem. This may
591be useful for subsystems which have some extra references even if 590be useful for subsystems which have some extra references even if
@@ -593,8 +592,7 @@ there are not tasks in the cgroup. If pre_destroy() returns error code,
593rmdir() will fail with it. From this behavior, pre_destroy() can be 592rmdir() will fail with it. From this behavior, pre_destroy() can be
594called multiple times against a cgroup. 593called multiple times against a cgroup.
595 594
596int can_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, 595int can_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
597 struct cgroup_taskset *tset)
598(cgroup_mutex held by caller) 596(cgroup_mutex held by caller)
599 597
600Called prior to moving one or more tasks into a cgroup; if the 598Called prior to moving one or more tasks into a cgroup; if the
@@ -615,8 +613,7 @@ fork. If this method returns 0 (success) then this should remain valid
615while the caller holds cgroup_mutex and it is ensured that either 613while the caller holds cgroup_mutex and it is ensured that either
616attach() or cancel_attach() will be called in future. 614attach() or cancel_attach() will be called in future.
617 615
618void cancel_attach(struct cgroup_subsys *ss, struct cgroup *cgrp, 616void cancel_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
619 struct cgroup_taskset *tset)
620(cgroup_mutex held by caller) 617(cgroup_mutex held by caller)
621 618
622Called when a task attach operation has failed after can_attach() has succeeded. 619Called when a task attach operation has failed after can_attach() has succeeded.
@@ -625,23 +622,22 @@ function, so that the subsystem can implement a rollback. If not, not necessary.
625This will be called only about subsystems whose can_attach() operation have 622This will be called only about subsystems whose can_attach() operation have
626succeeded. The parameters are identical to can_attach(). 623succeeded. The parameters are identical to can_attach().
627 624
628void attach(struct cgroup_subsys *ss, struct cgroup *cgrp, 625void attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
629 struct cgroup_taskset *tset)
630(cgroup_mutex held by caller) 626(cgroup_mutex held by caller)
631 627
632Called after the task has been attached to the cgroup, to allow any 628Called after the task has been attached to the cgroup, to allow any
633post-attachment activity that requires memory allocations or blocking. 629post-attachment activity that requires memory allocations or blocking.
634The parameters are identical to can_attach(). 630The parameters are identical to can_attach().
635 631
636void fork(struct cgroup_subsy *ss, struct task_struct *task) 632void fork(struct task_struct *task)
637 633
638Called when a task is forked into a cgroup. 634Called when a task is forked into a cgroup.
639 635
640void exit(struct cgroup_subsys *ss, struct task_struct *task) 636void exit(struct task_struct *task)
641 637
642Called during task exit. 638Called during task exit.
643 639
644int populate(struct cgroup_subsys *ss, struct cgroup *cgrp) 640int populate(struct cgroup *cgrp)
645(cgroup_mutex held by caller) 641(cgroup_mutex held by caller)
646 642
647Called after creation of a cgroup to allow a subsystem to populate 643Called after creation of a cgroup to allow a subsystem to populate
@@ -651,7 +647,7 @@ include/linux/cgroup.h for details). Note that although this
651method can return an error code, the error code is currently not 647method can return an error code, the error code is currently not
652always handled well. 648always handled well.
653 649
654void post_clone(struct cgroup_subsys *ss, struct cgroup *cgrp) 650void post_clone(struct cgroup *cgrp)
655(cgroup_mutex held by caller) 651(cgroup_mutex held by caller)
656 652
657Called during cgroup_create() to do any parameter 653Called during cgroup_create() to do any parameter
@@ -659,7 +655,7 @@ initialization which might be required before a task could attach. For
659example in cpusets, no task may attach before 'cpus' and 'mems' are set 655example in cpusets, no task may attach before 'cpus' and 'mems' are set
660up. 656up.
661 657
662void bind(struct cgroup_subsys *ss, struct cgroup *root) 658void bind(struct cgroup *root)
663(cgroup_mutex and ss->hierarchy_mutex held by caller) 659(cgroup_mutex and ss->hierarchy_mutex held by caller)
664 660
665Called when a cgroup subsystem is rebound to a different hierarchy 661Called when a cgroup subsystem is rebound to a different hierarchy
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index fa8f26309444..1359d637831f 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -28,13 +28,10 @@ static LIST_HEAD(blkio_list);
28struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT }; 28struct blkio_cgroup blkio_root_cgroup = { .weight = 2*BLKIO_WEIGHT_DEFAULT };
29EXPORT_SYMBOL_GPL(blkio_root_cgroup); 29EXPORT_SYMBOL_GPL(blkio_root_cgroup);
30 30
31static struct cgroup_subsys_state *blkiocg_create(struct cgroup_subsys *, 31static struct cgroup_subsys_state *blkiocg_create(struct cgroup *);
32 struct cgroup *); 32static int blkiocg_can_attach(struct cgroup *, struct cgroup_taskset *);
33static int blkiocg_can_attach(struct cgroup_subsys *, struct cgroup *, 33static void blkiocg_attach(struct cgroup *, struct cgroup_taskset *);
34 struct cgroup_taskset *); 34static void blkiocg_destroy(struct cgroup *);
35static void blkiocg_attach(struct cgroup_subsys *, struct cgroup *,
36 struct cgroup_taskset *);
37static void blkiocg_destroy(struct cgroup_subsys *, struct cgroup *);
38static int blkiocg_populate(struct cgroup_subsys *, struct cgroup *); 35static int blkiocg_populate(struct cgroup_subsys *, struct cgroup *);
39 36
40/* for encoding cft->private value on file */ 37/* for encoding cft->private value on file */
@@ -1548,7 +1545,7 @@ static int blkiocg_populate(struct cgroup_subsys *subsys, struct cgroup *cgroup)
1548 ARRAY_SIZE(blkio_files)); 1545 ARRAY_SIZE(blkio_files));
1549} 1546}
1550 1547
1551static void blkiocg_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup) 1548static void blkiocg_destroy(struct cgroup *cgroup)
1552{ 1549{
1553 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup); 1550 struct blkio_cgroup *blkcg = cgroup_to_blkio_cgroup(cgroup);
1554 unsigned long flags; 1551 unsigned long flags;
@@ -1598,8 +1595,7 @@ static void blkiocg_destroy(struct cgroup_subsys *subsys, struct cgroup *cgroup)
1598 kfree(blkcg); 1595 kfree(blkcg);
1599} 1596}
1600 1597
1601static struct cgroup_subsys_state * 1598static struct cgroup_subsys_state *blkiocg_create(struct cgroup *cgroup)
1602blkiocg_create(struct cgroup_subsys *subsys, struct cgroup *cgroup)
1603{ 1599{
1604 struct blkio_cgroup *blkcg; 1600 struct blkio_cgroup *blkcg;
1605 struct cgroup *parent = cgroup->parent; 1601 struct cgroup *parent = cgroup->parent;
@@ -1628,8 +1624,7 @@ done:
1628 * of the main cic data structures. For now we allow a task to change 1624 * of the main cic data structures. For now we allow a task to change
1629 * its cgroup only if it's the only owner of its ioc. 1625 * its cgroup only if it's the only owner of its ioc.
1630 */ 1626