diff options
| -rw-r--r-- | block/blk-cgroup.c | 6 | ||||
| -rw-r--r-- | block/blk-throttle.c | 32 | ||||
| -rw-r--r-- | block/cfq-iosched.c | 90 | ||||
| -rw-r--r-- | include/linux/cgroup.h | 24 | ||||
| -rw-r--r-- | include/linux/memcontrol.h | 2 | ||||
| -rw-r--r-- | kernel/cgroup.c | 162 | ||||
| -rw-r--r-- | kernel/cgroup_freezer.c | 40 | ||||
| -rw-r--r-- | kernel/cpuset.c | 35 | ||||
| -rw-r--r-- | kernel/sched/core.c | 65 | ||||
| -rw-r--r-- | kernel/sched/cpuacct.c | 28 | ||||
| -rw-r--r-- | mm/hugetlb_cgroup.c | 26 | ||||
| -rw-r--r-- | mm/memcontrol.c | 88 | ||||
| -rw-r--r-- | mm/vmpressure.c | 4 | ||||
| -rw-r--r-- | net/core/netprio_cgroup.c | 10 | ||||
| -rw-r--r-- | net/ipv4/tcp_memcontrol.c | 12 | ||||
| -rw-r--r-- | net/sched/cls_cgroup.c | 14 | ||||
| -rw-r--r-- | security/device_cgroup.c | 12 |
17 files changed, 322 insertions, 328 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 34063739745b..f46f3c69179c 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
| @@ -437,10 +437,10 @@ struct request_list *__blk_queue_next_rl(struct request_list *rl, | |||
| 437 | return &blkg->rl; | 437 | return &blkg->rl; |
| 438 | } | 438 | } |
| 439 | 439 | ||
| 440 | static int blkcg_reset_stats(struct cgroup *cgroup, struct cftype *cftype, | 440 | static int blkcg_reset_stats(struct cgroup_subsys_state *css, |
| 441 | u64 val) | 441 | struct cftype *cftype, u64 val) |
| 442 | { | 442 | { |
| 443 | struct blkcg *blkcg = cgroup_to_blkcg(cgroup); | 443 | struct blkcg *blkcg = css_to_blkcg(css); |
| 444 | struct blkcg_gq *blkg; | 444 | struct blkcg_gq *blkg; |
| 445 | int i; | 445 | int i; |
| 446 | 446 | ||
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 08a32dfd3844..88bcfb651b0b 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
| @@ -1293,10 +1293,10 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf, | |||
| 1293 | return __blkg_prfill_rwstat(sf, pd, &rwstat); | 1293 | return __blkg_prfill_rwstat(sf, pd, &rwstat); |
| 1294 | } | 1294 | } |
| 1295 | 1295 | ||
| 1296 | static int tg_print_cpu_rwstat(struct cgroup *cgrp, struct cftype *cft, | 1296 | static int tg_print_cpu_rwstat(struct cgroup_subsys_state *css, |
| 1297 | struct seq_file *sf) | 1297 | struct cftype *cft, struct seq_file *sf) |
| 1298 | { | 1298 | { |
| 1299 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1299 | struct blkcg *blkcg = css_to_blkcg(css); |
| 1300 | 1300 | ||
| 1301 | blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, &blkcg_policy_throtl, | 1301 | blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, &blkcg_policy_throtl, |
| 1302 | cft->private, true); | 1302 | cft->private, true); |
| @@ -1325,26 +1325,26 @@ static u64 tg_prfill_conf_uint(struct seq_file *sf, struct blkg_policy_data *pd, | |||
| 1325 | return __blkg_prfill_u64(sf, pd, v); | 1325 | return __blkg_prfill_u64(sf, pd, v); |
| 1326 | } | 1326 | } |
| 1327 | 1327 | ||
| 1328 | static int tg_print_conf_u64(struct cgroup *cgrp, struct cftype *cft, | 1328 | static int tg_print_conf_u64(struct cgroup_subsys_state *css, |
| 1329 | struct seq_file *sf) | 1329 | struct cftype *cft, struct seq_file *sf) |
| 1330 | { | 1330 | { |
| 1331 | blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), tg_prfill_conf_u64, | 1331 | blkcg_print_blkgs(sf, css_to_blkcg(css), tg_prfill_conf_u64, |
| 1332 | &blkcg_policy_throtl, cft->private, false); | 1332 | &blkcg_policy_throtl, cft->private, false); |
| 1333 | return 0; | 1333 | return 0; |
| 1334 | } | 1334 | } |
| 1335 | 1335 | ||
| 1336 | static int tg_print_conf_uint(struct cgroup *cgrp, struct cftype *cft, | 1336 | static int tg_print_conf_uint(struct cgroup_subsys_state *css, |
| 1337 | struct seq_file *sf) | 1337 | struct cftype *cft, struct seq_file *sf) |
| 1338 | { | 1338 | { |
| 1339 | blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), tg_prfill_conf_uint, | 1339 | blkcg_print_blkgs(sf, css_to_blkcg(css), tg_prfill_conf_uint, |
| 1340 | &blkcg_policy_throtl, cft->private, false); | 1340 | &blkcg_policy_throtl, cft->private, false); |
| 1341 | return 0; | 1341 | return 0; |
| 1342 | } | 1342 | } |
| 1343 | 1343 | ||
| 1344 | static int tg_set_conf(struct cgroup *cgrp, struct cftype *cft, const char *buf, | 1344 | static int tg_set_conf(struct cgroup_subsys_state *css, struct cftype *cft, |
| 1345 | bool is_u64) | 1345 | const char *buf, bool is_u64) |
| 1346 | { | 1346 | { |
| 1347 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1347 | struct blkcg *blkcg = css_to_blkcg(css); |
| 1348 | struct blkg_conf_ctx ctx; | 1348 | struct blkg_conf_ctx ctx; |
| 1349 | struct throtl_grp *tg; | 1349 | struct throtl_grp *tg; |
| 1350 | struct throtl_service_queue *sq; | 1350 | struct throtl_service_queue *sq; |
| @@ -1403,16 +1403,16 @@ static int tg_set_conf(struct cgroup *cgrp, struct cftype *cft, const char *buf, | |||
| 1403 | return 0; | 1403 | return 0; |
| 1404 | } | 1404 | } |
| 1405 | 1405 | ||
| 1406 | static int tg_set_conf_u64(struct cgroup *cgrp, struct cftype *cft, | 1406 | static int tg_set_conf_u64(struct cgroup_subsys_state *css, struct cftype *cft, |
| 1407 | const char *buf) | 1407 | const char *buf) |
| 1408 | { | 1408 | { |
| 1409 | return tg_set_conf(cgrp, cft, buf, true); | 1409 | return tg_set_conf(css, cft, buf, true); |
| 1410 | } | 1410 | } |
| 1411 | 1411 | ||
| 1412 | static int tg_set_conf_uint(struct cgroup *cgrp, struct cftype *cft, | 1412 | static int tg_set_conf_uint(struct cgroup_subsys_state *css, struct cftype *cft, |
| 1413 | const char *buf) | 1413 | const char *buf) |
| 1414 | { | 1414 | { |
| 1415 | return tg_set_conf(cgrp, cft, buf, false); | 1415 | return tg_set_conf(css, cft, buf, false); |
| 1416 | } | 1416 | } |
| 1417 | 1417 | ||
| 1418 | static struct cftype throtl_files[] = { | 1418 | static struct cftype throtl_files[] = { |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index d5bbdcfd0dab..dabb9d02cf9a 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
| @@ -1607,12 +1607,11 @@ static u64 cfqg_prfill_weight_device(struct seq_file *sf, | |||
| 1607 | return __blkg_prfill_u64(sf, pd, cfqg->dev_weight); | 1607 | return __blkg_prfill_u64(sf, pd, cfqg->dev_weight); |
| 1608 | } | 1608 | } |
| 1609 | 1609 | ||
| 1610 | static int cfqg_print_weight_device(struct cgroup *cgrp, struct cftype *cft, | 1610 | static int cfqg_print_weight_device(struct cgroup_subsys_state *css, |
| 1611 | struct seq_file *sf) | 1611 | struct cftype *cft, struct seq_file *sf) |
| 1612 | { | 1612 | { |
| 1613 | blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), | 1613 | blkcg_print_blkgs(sf, css_to_blkcg(css), cfqg_prfill_weight_device, |
| 1614 | cfqg_prfill_weight_device, &blkcg_policy_cfq, 0, | 1614 | &blkcg_policy_cfq, 0, false); |
| 1615 | false); | ||
| 1616 | return 0; | 1615 | return 0; |
| 1617 | } | 1616 | } |
| 1618 | 1617 | ||
| @@ -1626,35 +1625,34 @@ static u64 cfqg_prfill_leaf_weight_device(struct seq_file *sf, | |||
| 1626 | return __blkg_prfill_u64(sf, pd, cfqg->dev_leaf_weight); | 1625 | return __blkg_prfill_u64(sf, pd, cfqg->dev_leaf_weight); |
| 1627 | } | 1626 | } |
| 1628 | 1627 | ||
| 1629 | static int cfqg_print_leaf_weight_device(struct cgroup *cgrp, | 1628 | static int cfqg_print_leaf_weight_device(struct cgroup_subsys_state *css, |
| 1630 | struct cftype *cft, | 1629 | struct cftype *cft, |
| 1631 | struct seq_file *sf) | 1630 | struct seq_file *sf) |
| 1632 | { | 1631 | { |
| 1633 | blkcg_print_blkgs(sf, cgroup_to_blkcg(cgrp), | 1632 | blkcg_print_blkgs(sf, css_to_blkcg(css), cfqg_prfill_leaf_weight_device, |
| 1634 | cfqg_prfill_leaf_weight_device, &blkcg_policy_cfq, 0, | 1633 | &blkcg_policy_cfq, 0, false); |
| 1635 | false); | ||
| 1636 | return 0; | 1634 | return 0; |
| 1637 | } | 1635 | } |
| 1638 | 1636 | ||
| 1639 | static int cfq_print_weight(struct cgroup *cgrp, struct cftype *cft, | 1637 | static int cfq_print_weight(struct cgroup_subsys_state *css, struct cftype *cft, |
| 1640 | struct seq_file *sf) | 1638 | struct seq_file *sf) |
| 1641 | { | 1639 | { |
| 1642 | seq_printf(sf, "%u\n", cgroup_to_blkcg(cgrp)->cfq_weight); | 1640 | seq_printf(sf, "%u\n", css_to_blkcg(css)->cfq_weight); |
| 1643 | return 0; | 1641 | return 0; |
| 1644 | } | 1642 | } |
| 1645 | 1643 | ||
| 1646 | static int cfq_print_leaf_weight(struct cgroup *cgrp, struct cftype *cft, | 1644 | static int cfq_print_leaf_weight(struct cgroup_subsys_state *css, |
| 1647 | struct seq_file *sf) | 1645 | struct cftype *cft, struct seq_file *sf) |
| 1648 | { | 1646 | { |
| 1649 | seq_printf(sf, "%u\n", | 1647 | seq_printf(sf, "%u\n", css_to_blkcg(css)->cfq_leaf_weight); |
| 1650 | cgroup_to_blkcg(cgrp)->cfq_leaf_weight); | ||
| 1651 | return 0; | 1648 | return 0; |
| 1652 | } | 1649 | } |
| 1653 | 1650 | ||
| 1654 | static int __cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft, | 1651 | static int __cfqg_set_weight_device(struct cgroup_subsys_state *css, |
| 1655 | const char *buf, bool is_leaf_weight) | 1652 | struct cftype *cft, const char *buf, |
| 1653 | bool is_leaf_weight) | ||
| 1656 | { | 1654 | { |
| 1657 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1655 | struct blkcg *blkcg = css_to_blkcg(css); |
| 1658 | struct blkg_conf_ctx ctx; | 1656 | struct blkg_conf_ctx ctx; |
| 1659 | struct cfq_group *cfqg; | 1657 | struct cfq_group *cfqg; |
| 1660 | int ret; | 1658 | int ret; |
| @@ -1680,22 +1678,22 @@ static int __cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft, | |||
| 1680 | return ret; | 1678 | return ret; |
| 1681 | } | 1679 | } |
| 1682 | 1680 | ||
| 1683 | static int cfqg_set_weight_device(struct cgroup *cgrp, struct cftype *cft, | 1681 | static int cfqg_set_weight_device(struct cgroup_subsys_state *css, |
| 1684 | const char *buf) | 1682 | struct cftype *cft, const char *buf) |
| 1685 | { | 1683 | { |
| 1686 | return __cfqg_set_weight_device(cgrp, cft, buf, false); | 1684 | return __cfqg_set_weight_device(css, cft, buf, false); |
| 1687 | } | 1685 | } |
| 1688 | 1686 | ||
| 1689 | static int cfqg_set_leaf_weight_device(struct cgroup *cgrp, struct cftype *cft, | 1687 | static int cfqg_set_leaf_weight_device(struct cgroup_subsys_state *css, |
| 1690 | const char *buf) | 1688 | struct cftype *cft, const char *buf) |
| 1691 | { | 1689 | { |
| 1692 | return __cfqg_set_weight_device(cgrp, cft, buf, true); | 1690 | return __cfqg_set_weight_device(css, cft, buf, true); |
| 1693 | } | 1691 | } |
| 1694 | 1692 | ||
| 1695 | static int __cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val, | 1693 | static int __cfq_set_weight(struct cgroup_subsys_state *css, struct cftype *cft, |
| 1696 | bool is_leaf_weight) | 1694 | u64 val, bool is_leaf_weight) |
| 1697 | { | 1695 | { |
| 1698 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1696 | struct blkcg *blkcg = css_to_blkcg(css); |
| 1699 | struct blkcg_gq *blkg; | 1697 | struct blkcg_gq *blkg; |
| 1700 | 1698 | ||
| 1701 | if (val < CFQ_WEIGHT_MIN || val > CFQ_WEIGHT_MAX) | 1699 | if (val < CFQ_WEIGHT_MIN || val > CFQ_WEIGHT_MAX) |
| @@ -1727,30 +1725,32 @@ static int __cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val, | |||
| 1727 | return 0; | 1725 | return 0; |
| 1728 | } | 1726 | } |
| 1729 | 1727 | ||
| 1730 | static int cfq_set_weight(struct cgroup *cgrp, struct cftype *cft, u64 val) | 1728 | static int cfq_set_weight(struct cgroup_subsys_state *css, struct cftype *cft, |
| 1729 | u64 val) | ||
| 1731 | { | 1730 | { |
| 1732 | return __cfq_set_weight(cgrp, cft, val, false); | 1731 | return __cfq_set_weight(css, cft, val, false); |
| 1733 | } | 1732 | } |
| 1734 | 1733 | ||
| 1735 | static int cfq_set_leaf_weight(struct cgroup *cgrp, struct cftype *cft, u64 val) | 1734 | static int cfq_set_leaf_weight(struct cgroup_subsys_state *css, |
| 1735 | struct cftype *cft, u64 val) | ||
| 1736 | { | 1736 | { |
| 1737 | return __cfq_set_weight(cgrp, cft, val, true); | 1737 | return __cfq_set_weight(css, cft, val, true); |
| 1738 | } | 1738 | } |
| 1739 | 1739 | ||
| 1740 | static int cfqg_print_stat(struct cgroup *cgrp, struct cftype *cft, | 1740 | static int cfqg_print_stat(struct cgroup_subsys_state *css, struct cftype *cft, |
| 1741 | struct seq_file *sf) | 1741 | struct seq_file *sf) |
| 1742 | { | 1742 | { |
| 1743 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1743 | struct blkcg *blkcg = css_to_blkcg(css); |
| 1744 | 1744 | ||
| 1745 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkcg_policy_cfq, | 1745 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_stat, &blkcg_policy_cfq, |
| 1746 | cft->private, false); | 1746 | cft->private, false); |
| 1747 | return 0; | 1747 | return 0; |
| 1748 | } | 1748 | } |
| 1749 | 1749 | ||
| 1750 | static int cfqg_print_rwstat(struct cgroup *cgrp, struct cftype *cft, | 1750 | static int cfqg_print_rwstat(struct cgroup_subsys_state *css, |
| 1751 | struct seq_file *sf) | 1751 | struct cftype *cft, struct seq_file *sf) |
| 1752 | { | 1752 | { |
| 1753 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1753 | struct blkcg *blkcg = css_to_blkcg(css); |
| 1754 | 1754 | ||
| 1755 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkcg_policy_cfq, | 1755 | blkcg_print_blkgs(sf, blkcg, blkg_prfill_rwstat, &blkcg_policy_cfq, |
| 1756 | cft->private, true); | 1756 | cft->private, true); |
| @@ -1773,20 +1773,20 @@ static u64 cfqg_prfill_rwstat_recursive(struct seq_file *sf, | |||
| 1773 | return __blkg_prfill_rwstat(sf, pd, &sum); | 1773 | return __blkg_prfill_rwstat(sf, pd, &sum); |
| 1774 | } | 1774 | } |
| 1775 | 1775 | ||
| 1776 | static int cfqg_print_stat_recursive(struct cgroup *cgrp, struct cftype *cft, | 1776 | static int cfqg_print_stat_recursive(struct cgroup_subsys_state *css, |
| 1777 | struct seq_file *sf) | 1777 | struct cftype *cft, struct seq_file *sf) |
| 1778 | { | 1778 | { |
| 1779 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1779 | struct blkcg *blkcg = css_to_blkcg(css); |
| 1780 | 1780 | ||
| 1781 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_stat_recursive, | 1781 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_stat_recursive, |
| 1782 | &blkcg_policy_cfq, cft->private, false); | 1782 | &blkcg_policy_cfq, cft->private, false); |
| 1783 | return 0; | 1783 | return 0; |
| 1784 | } | 1784 | } |
| 1785 | 1785 | ||
| 1786 | static int cfqg_print_rwstat_recursive(struct cgroup *cgrp, struct cftype *cft, | 1786 | static int cfqg_print_rwstat_recursive(struct cgroup_subsys_state *css, |
| 1787 | struct seq_file *sf) | 1787 | struct cftype *cft, struct seq_file *sf) |
| 1788 | { | 1788 | { |
| 1789 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1789 | struct blkcg *blkcg = css_to_blkcg(css); |
| 1790 | 1790 | ||
| 1791 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_rwstat_recursive, | 1791 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_rwstat_recursive, |
| 1792 | &blkcg_policy_cfq, cft->private, true); | 1792 | &blkcg_policy_cfq, cft->private, true); |
| @@ -1810,10 +1810,10 @@ static u64 cfqg_prfill_avg_queue_size(struct seq_file *sf, | |||
| 1810 | } | 1810 | } |
| 1811 | 1811 | ||
| 1812 | /* print avg_queue_size */ | 1812 | /* print avg_queue_size */ |
| 1813 | static int cfqg_print_avg_queue_size(struct cgroup *cgrp, struct cftype *cft, | 1813 | static int cfqg_print_avg_queue_size(struct cgroup_subsys_state *css, |
| 1814 | struct seq_file *sf) | 1814 | struct cftype *cft, struct seq_file *sf) |
| 1815 | { | 1815 | { |
| 1816 | struct blkcg *blkcg = cgroup_to_blkcg(cgrp); | 1816 | struct blkcg *blkcg = css_to_blkcg(css); |
| 1817 | 1817 | ||
| 1818 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size, | 1818 | blkcg_print_blkgs(sf, blkcg, cfqg_prfill_avg_queue_size, |
| 1819 | &blkcg_policy_cfq, 0, false); | 1819 | &blkcg_policy_cfq, 0, false); |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index b0d5f53ae5e1..0b91436c68ef 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
| @@ -439,34 +439,34 @@ struct cftype { | |||
| 439 | struct cgroup_subsys *ss; | 439 | struct cgroup_subsys *ss; |
| 440 | 440 | ||
| 441 | int (*open)(struct inode *inode, struct file *file); | 441 | int (*open)(struct inode *inode, struct file *file); |
| 442 | ssize_t (*read)(struct cgroup *cgrp, struct cftype *cft, | 442 | ssize_t (*read)(struct cgroup_subsys_state *css, struct cftype *cft, |
| 443 | struct file *file, | 443 | struct file *file, |
| 444 | char __user *buf, size_t nbytes, loff_t *ppos); | 444 | char __user *buf, size_t nbytes, loff_t *ppos); |
| 445 | /* | 445 | /* |
| 446 | * read_u64() is a shortcut for the common case of returning a | 446 | * read_u64() is a shortcut for the common case of returning a |
| 447 | * single integer. Use it in place of read() | 447 | * single integer. Use it in place of read() |
| 448 | */ | 448 | */ |
| 449 | u64 (*read_u64)(struct cgroup *cgrp, struct cftype *cft); | 449 | u64 (*read_u64)(struct cgroup_subsys_state *css, struct cftype *cft); |
| 450 | /* | 450 | /* |
| 451 | * read_s64() is a signed version of read_u64() | 451 | * read_s64() is a signed version of read_u64() |
| 452 | */ | 452 | */ |
| 453 | s64 (*read_s64)(struct cgroup *cgrp, struct cftype *cft); | 453 | s64 (*read_s64)(struct cgroup_subsys_state *css, struct cftype *cft); |
| 454 | /* | 454 | /* |
| 455 | * read_map() is used for defining a map of key/value | 455 | * read_map() is used for defining a map of key/value |
| 456 | * pairs. It should call cb->fill(cb, key, value) for each | 456 | * pairs. It should call cb->fill(cb, key, value) for each |
| 457 | * entry. The key/value pairs (and their ordering) should not | 457 | * entry. The key/value pairs (and their ordering) should not |
| 458 | * change between reboots. | 458 | * change between reboots. |
| 459 | */ | 459 | */ |
| 460 | int (*read_map)(struct cgroup *cgrp, struct cftype *cft, | 460 | int (*read_map)(struct cgroup_subsys_state *css, struct cftype *cft, |
| 461 | struct cgroup_map_cb *cb); | 461 | struct cgroup_map_cb *cb); |
| 462 | /* | 462 | /* |
| 463 | * read_seq_string() is used for outputting a simple sequence | 463 | * read_seq_string() is used for outputting a simple sequence |
| 464 | * using seqfile. | 464 | * using seqfile. |
| 465 | */ | 465 | */ |
| 466 | int (*read_seq_string)(struct cgroup *cgrp, struct cftype *cft, | 466 | int (*read_seq_string)(struct cgroup_subsys_state *css, |
| 467 | struct seq_file *m); | 467 | struct cftype *cft, struct seq_file *m); |
| 468 | 468 | ||
| 469 | ssize_t (*write)(struct cgroup *cgrp, struct cftype *cft, | 469 | ssize_t (*write)(struct cgroup_subsys_state *css, struct cftype *cft, |
| 470 | struct file *file, | 470 | struct file *file, |
| 471 | const char __user *buf, size_t nbytes, loff_t *ppos); | 471 | const char __user *buf, size_t nbytes, loff_t *ppos); |
| 472 | 472 | ||
| @@ -475,18 +475,20 @@ struct cftype { | |||
| 475 | * a single integer (as parsed by simple_strtoull) from | 475 | * a single integer (as parsed by simple_strtoull) from |
| 476 | * userspace. Use in place of write(); return 0 or error. | 476 | * userspace. Use in place of write(); return 0 or error. |
| 477 | */ | 477 | */ |
| 478 | int (*write_u64)(struct cgroup *cgrp, struct cftype *cft, u64 val); | 478 | int (*write_u64)(struct cgroup_subsys_state *css, struct cftype *cft, |
| 479 | u64 val); | ||
| 479 | /* | 480 | /* |
| 480 | * write_s64() is a signed version of write_u64() | 481 | * write_s64() is a signed version of write_u64() |
| 481 | */ | 482 | */ |
| 482 | int (*write_s64)(struct cgroup *cgrp, struct cftype *cft, s64 val); | 483 | int (*write_s64)(struct cgroup_subsys_state *css, struct cftype *cft, |
| 484 | s64 val); | ||
| 483 | 485 | ||
| 484 | /* | 486 | /* |
| 485 | * write_string() is passed a nul-terminated kernelspace | 487 | * write_string() is passed a nul-terminated kernelspace |
| 486 | * buffer of maximum length determined by max_write_len. | 488 | * buffer of maximum length determined by max_write_len. |
| 487 | * Returns 0 or -ve error code. | 489 | * Returns 0 or -ve error code. |
| 488 | */ | 490 | */ |
| 489 | int (*write_string)(struct cgroup *cgrp, struct cftype *cft, | 491 | int (*write_string)(struct cgroup_subsys_state *css, struct cftype *cft, |
| 490 | const char *buffer); | 492 | const char *buffer); |
| 491 | /* | 493 | /* |
| 492 | * trigger() callback can be used to get some kick from the | 494 | * trigger() callback can be used to get some kick from the |
| @@ -494,7 +496,7 @@ struct cftype { | |||
| 494 | * at all. The private field can be used to determine the | 496 | * at all. The private field can be used to determine the |
| 495 | * kick type for multiplexing. | 497 | * kick type for multiplexing. |
| 496 | */ | 498 | */ |
| 497 | int (*trigger)(struct cgroup *cgrp, unsigned int event); | 499 | int (*trigger)(struct cgroup_subsys_state *css, unsigned int event); |
| 498 | 500 | ||
| 499 | int (*release)(struct inode *inode, struct file *file); | 501 | int (*release)(struct inode *inode, struct file *file); |
| 500 | 502 | ||
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 7b4d9d79570b..6c416092e324 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
| @@ -85,7 +85,7 @@ extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p); | |||
| 85 | extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm); | 85 | extern struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm); |
| 86 | 86 | ||
| 87 | extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg); | 87 | extern struct mem_cgroup *parent_mem_cgroup(struct mem_cgroup *memcg); |
| 88 | extern struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont); | 88 | extern struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *css); |
| 89 | 89 | ||
| 90 | static inline | 90 | static inline |
| 91 | bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg) | 91 | bool mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *memcg) |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index c049992f1ffa..6ee469837fda 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
| @@ -2235,34 +2235,38 @@ int cgroup_attach_task_all(struct task_struct *from, struct task_struct *tsk) | |||
| 2235 | } | 2235 | } |
| 2236 | EXPORT_SYMBOL_GPL(cgroup_attach_task_all); | 2236 | EXPORT_SYMBOL_GPL(cgroup_attach_task_all); |
| 2237 | 2237 | ||
| 2238 | static int cgroup_tasks_write(struct cgroup *cgrp, struct cftype *cft, u64 pid) | 2238 | static int cgroup_tasks_write(struct cgroup_subsys_state *css, |
| 2239 | struct cftype *cft, u64 pid) | ||
| 2239 | { | 2240 | { |
| 2240 | return attach_task_by_pid(cgrp, pid, false); | 2241 | return attach_task_by_pid(css->cgroup, pid, false); |
| 2241 | } | 2242 | } |
| 2242 | 2243 | ||
| 2243 | static int cgroup_procs_write(struct cgroup *cgrp, struct cftype *cft, u64 tgid) | 2244 | static int cgroup_procs_write(struct cgroup_subsys_state *css, |
| 2245 | struct cftype *cft, u64 tgid) | ||
| 2244 | { | 2246 | { |
| 2245 | return attach_task_by_pid(cgrp, tgid, true); | 2247 | return attach_task_by_pid(css->cgroup, tgid, true); |
| 2246 | } | 2248 | } |
| 2247 | 2249 | ||
| 2248 | static int cgroup_release_agent_write(struct cgroup *cgrp, struct cftype *cft, | 2250 | static int cgroup_release_agent_write(struct cgroup_subsys_state *css, |
| 2249 | const char *buffer) | 2251 | struct cftype *cft, const char *buffer) |
| 2250 | { | 2252 | { |
| 2251 | BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX); | 2253 | BUILD_BUG_ON(sizeof(css->cgroup->root->release_agent_path) < PATH_MAX); |
| 2252 | if (strlen(buffer) >= PATH_MAX) | 2254 | if (strlen(buffer) >= PATH_MAX) |
| 2253 | return -EINVAL; | 2255 | return -EINVAL; |
| 2254 | if (!cgroup_lock_live_group(cgrp)) | 2256 | if (!cgroup_lock_live_group(css->cgroup)) |
| 2255 | return -ENODEV; | 2257 | return -ENODEV; |
| 2256 | mutex_lock(&cgroup_root_mutex); | 2258 | mutex_lock(&cgroup_root_mutex); |
| 2257 | strcpy(cgrp->root->release_agent_path, buffer); | 2259 | strcpy(css->cgroup->root->release_agent_path, buffer); |
| 2258 | mutex_unlock(&cgroup_root_mutex); | 2260 | mutex_unlock(&cgroup_root_mutex); |
| 2259 | mutex_unlock(&cgroup_mutex); | 2261 | mutex_unlock(&cgroup_mutex); |
| 2260 | return 0; | 2262 | return 0; |
| 2261 | } | 2263 | } |
| 2262 | 2264 | ||
| 2263 | static int cgroup_release_agent_show(struct cgroup *cgrp, struct cftype *cft, | 2265 | static int cgroup_release_agent_show(struct cgroup_subsys_state *css, |
| 2264 | struct seq_file *seq) | 2266 | struct cftype *cft, struct seq_file *seq) |
| 2265 | { | 2267 | { |
| 2268 | struct cgroup *cgrp = css->cgroup; | ||
| 2269 | |||
| 2266 | if (!cgroup_lock_live_group(cgrp)) | 2270 | if (!cgroup_lock_live_group(cgrp)) |
| 2267 | return -ENODEV; | 2271 | return -ENODEV; |
| 2268 | seq_puts(seq, cgrp->root->release_agent_path); | 2272 | seq_puts(seq, cgrp->root->release_agent_path); |
| @@ -2271,10 +2275,10 @@ static int cgroup_release_agent_show(struct cgroup *cgrp, struct cftype *cft, | |||
| 2271 | return 0; | 2275 | return 0; |
| 2272 | } | 2276 | } |
| 2273 | 2277 | ||
| 2274 | static int cgroup_sane_behavior_show(struct cgroup *cgrp, struct cftype *cft, | 2278 | static int cgroup_sane_behavior_show(struct cgroup_subsys_state *css, |
| 2275 | struct seq_file *seq) | 2279 | struct cftype *cft, struct seq_file *seq) |
| 2276 | { | 2280 | { |
| 2277 | seq_printf(seq, "%d\n", cgroup_sane_behavior(cgrp)); | 2281 | seq_printf(seq, "%d\n", cgroup_sane_behavior(css->cgroup)); |
| 2278 | return 0; | 2282 | return 0; |
| 2279 | } | 2283 | } |
| 2280 | 2284 | ||
| @@ -2292,10 +2296,10 @@ static struct cgroup_subsys_state *cgroup_file_css(struct cfent *cfe) | |||
| 2292 | /* A buffer size big enough for numbers or short strings */ | 2296 | /* A buffer size big enough for numbers or short strings */ |
| 2293 | #define CGROUP_LOCAL_BUFFER_SIZE 64 | 2297 | #define CGROUP_LOCAL_BUFFER_SIZE 64 |
| 2294 | 2298 | ||
| 2295 | static ssize_t cgroup_write_X64(struct cgroup *cgrp, struct cftype *cft, | 2299 | static ssize_t cgroup_write_X64(struct cgroup_subsys_state *css, |
| 2296 | struct file *file, | 2300 | struct cftype *cft, struct file *file, |
| 2297 | const char __user *userbuf, | 2301 | const char __user *userbuf, size_t nbytes, |
| 2298 | size_t nbytes, loff_t *unused_ppos) | 2302 | loff_t *unused_ppos) |
| 2299 | { | 2303 | { |
| 2300 | char buffer[CGROUP_LOCAL_BUFFER_SIZE]; | 2304 | char buffer[CGROUP_LOCAL_BUFFER_SIZE]; |
| 2301 | int retval = 0; | 2305 | int retval = 0; |
| @@ -2313,22 +2317,22 @@ static ssize_t cgroup_write_X64(struct cgroup *cgrp, struct cftype *cft, | |||
| 2313 | u64 val = simple_strtoull(strstrip(buffer), &end, 0); | 2317 | u64 val = simple_strtoull(strstrip(buffer), &end, 0); |
| 2314 | if (*end) | 2318 | if (*end) |
| 2315 | return -EINVAL; | 2319 | return -EINVAL; |
| 2316 | retval = cft->write_u64(cgrp, cft, val); | 2320 | retval = cft->write_u64(css, cft, val); |
| 2317 | } else { | 2321 | } else { |
| 2318 | s64 val = simple_strtoll(strstrip(buffer), &end, 0); | 2322 | s64 val = simple_strtoll(strstrip(buffer), &end, 0); |
| 2319 | if (*end) | 2323 | if (*end) |
| 2320 | return -EINVAL; | 2324 | return -EINVAL; |
| 2321 | retval = cft->write_s64(cgrp, cft, val); | 2325 | retval = cft->write_s64(css, cft, val); |
| 2322 | } | 2326 | } |
| 2323 | if (!retval) | 2327 | if (!retval) |
| 2324 | retval = nbytes; | 2328 | retval = nbytes; |
| 2325 | return retval; | 2329 | return retval; |
| 2326 | } | 2330 | } |
| 2327 | 2331 | ||
| 2328 | static ssize_t cgroup_write_string(struct cgroup *cgrp, struct cftype *cft, | 2332 | static ssize_t cgroup_write_string(struct cgroup_subsys_state *css, |
| 2329 | struct file *file, | 2333 | struct cftype *cft, struct file *file, |
| 2330 | const char __user *userbuf, | 2334 | const char __user *userbuf, size_t nbytes, |
| 2331 | size_t nbytes, loff_t *unused_ppos) | 2335 | loff_t *unused_ppos) |
| 2332 | { | 2336 | { |
| 2333 | char local_buffer[CGROUP_LOCAL_BUFFER_SIZE]; | 2337 | char local_buffer[CGROUP_LOCAL_BUFFER_SIZE]; |
| 2334 | int retval = 0; | 2338 | int retval = 0; |
| @@ -2351,7 +2355,7 @@ static ssize_t cgroup_write_string(struct cgroup *cgrp, struct cftype *cft, | |||
| 2351 | } | 2355 | } |
| 2352 | 2356 | ||
| 2353 | buffer[nbytes] = 0; /* nul-terminate */ | 2357 | buffer[nbytes] = 0; /* nul-terminate */ |
| 2354 | retval = cft->write_string(cgrp, cft, strstrip(buffer)); | 2358 | retval = cft->write_string(css, cft, strstrip(buffer)); |
| 2355 | if (!retval) | 2359 | if (!retval) |
| 2356 | retval = nbytes; | 2360 | retval = nbytes; |
| 2357 | out: | 2361 | out: |
| @@ -2361,60 +2365,60 @@ out: | |||
| 2361 | } | 2365 | } |
| 2362 | 2366 | ||
| 2363 | static ssize_t cgroup_file_write(struct file *file, const char __user *buf, | 2367 | static ssize_t cgroup_file_write(struct file *file, const char __user *buf, |
| 2364 | size_t nbytes, loff_t *ppos) | 2368 | size_t nbytes, loff_t *ppos) |
| 2365 | { | 2369 | { |
| 2370 | struct cfent *cfe = __d_cfe(file->f_dentry); | ||
| 2366 | struct cftype *cft = __d_cft(file->f_dentry); | 2371 | struct cftype *cft = __d_cft(file->f_dentry); |
| 2367 | struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent); | 2372 | struct cgroup_subsys_state *css = cgroup_file_css(cfe); |
| 2368 | 2373 | ||
| 2369 | if (cft->write) | 2374 | if (cft->write) |
| 2370 | return cft->write(cgrp, cft, file, buf, nbytes, ppos); | 2375 | return cft->write(css, cft, file, buf, nbytes, ppos); |
| 2371 | if (cft->write_u64 || cft->write_s64) | 2376 | if (cft->write_u64 || cft->write_s64) |
| 2372 | return cgroup_write_X64(cgrp, cft, file, buf, nbytes, ppos); | 2377 | return cgroup_write_X64(css, cft, file, buf, nbytes, ppos); |
| 2373 | if (cft->write_string) | 2378 | if (cft->write_string) |
| 2374 | return cgroup_write_string(cgrp, cft, file, buf, nbytes, ppos); | 2379 | return cgroup_write_string(css, cft, file, buf, nbytes, ppos); |
| 2375 | if (cft->trigger) { | 2380 | if (cft->trigger) { |
| 2376 | int ret = cft->trigger(cgrp, (unsigned int)cft->private); | 2381 | int ret = cft->trigger(css, (unsigned int)cft->private); |
| 2377 | return ret ? ret : nbytes; | 2382 | return ret ? ret : nbytes; |
| 2378 | } | 2383 | } |
| 2379 | return -EINVAL; | 2384 | return -EINVAL; |
| 2380 | } | 2385 | } |
| 2381 | 2386 | ||
| 2382 | static ssize_t cgroup_read_u64(struct cgroup *cgrp, struct cftype *cft, | 2387 | static ssize_t cgroup_read_u64(struct cgroup_subsys_state *css, |
| 2383 | struct file *file, | 2388 | struct cftype *cft, struct file *file, |
| 2384 | char __user *buf, size_t nbytes, | 2389 | char __user *buf, size_t nbytes, loff_t *ppos) |
| 2385 | loff_t *ppos) | ||
| 2386 | { | 2390 | { |
| 2387 | char tmp[CGROUP_LOCAL_BUFFER_SIZE]; | 2391 | char tmp[CGROUP_LOCAL_BUFFER_SIZE]; |
| 2388 | u64 val = cft->read_u64(cgrp, cft); | 2392 | u64 val = cft->read_u64(css, cft); |
| 2389 | int len = sprintf(tmp, "%llu\n", (unsigned long long) val); | 2393 | int len = sprintf(tmp, "%llu\n", (unsigned long long) val); |
| 2390 | 2394 | ||
| 2391 | return simple_read_from_buffer(buf, nbytes, ppos, tmp, len); | 2395 | return simple_read_from_buffer(buf, nbytes, ppos, tmp, len); |
| 2392 | } | 2396 | } |
| 2393 | 2397 | ||
| 2394 | static ssize_t cgroup_read_s64(struct cgroup *cgrp, struct cftype *cft, | 2398 | static ssize_t cgroup_read_s64(struct cgroup_subsys_state *css, |
| 2395 | struct file *file, | 2399 | struct cftype *cft, struct file *file, |
| 2396 | char __user *buf, size_t nbytes, | 2400 | char __user *buf, size_t nbytes, loff_t *ppos) |
| 2397 | loff_t *ppos) | ||
| 2398 | { | 2401 | { |
| 2399 | char tmp[CGROUP_LOCAL_BUFFER_SIZE]; | 2402 | char tmp[CGROUP_LOCAL_BUFFER_SIZE]; |
| 2400 | s64 val = cft->read_s64(cgrp, cft); | 2403 | s64 val = cft->read_s64(css, cft); |
| 2401 | int len = sprintf(tmp, "%lld\n", (long long) val); | 2404 | int len = sprintf(tmp, "%lld\n", (long long) val); |
| 2402 | 2405 | ||
| 2403 | return simple_read_from_buffer(buf, nbytes, ppos, tmp, len); | 2406 | return simple_read_from_buffer(buf, nbytes, ppos, tmp, len); |
| 2404 | } | 2407 | } |
| 2405 | 2408 | ||
| 2406 | static ssize_t cgroup_file_read(struct file *file, char __user *buf, | 2409 | static ssize_t cgroup_file_read(struct file *file, char __user *buf, |
| 2407 | size_t nbytes, loff_t *ppos) | 2410 | size_t nbytes, loff_t *ppos) |
| 2408 | { | 2411 | { |
| 2412 | struct cfent *cfe = __d_cfe(file->f_dentry); | ||
| 2409 | struct cftype *cft = __d_cft(file->f_dentry); | 2413 | struct cftype *cft = __d_cft(file->f_dentry); |
| 2410 | struct cgroup *cgrp = __d_cgrp(file->f_dentry->d_parent); | 2414 | struct cgroup_subsys_state *css = cgroup_file_css(cfe); |
| 2411 | 2415 | ||
| 2412 | if (cft->read) | 2416 | if (cft->read) |
| 2413 | return cft->read(cgrp, cft, file, buf, nbytes, ppos); | 2417 | return cft->read(css, cft, file, buf, nbytes, ppos); |
| 2414 | if (cft->read_u64) | 2418 | if (cft->read_u64) |
| 2415 | return cgroup_read_u64(cgrp, cft, file, buf, nbytes, ppos); | 2419 | return cgroup_read_u64(css, cft, file, buf, nbytes, ppos); |
| 2416 | if (cft->read_s64) | 2420 | if (cft->read_s64) |
| 2417 | return cgroup_read_s64(cgrp, cft, file, buf, nbytes, ppos); | 2421 | return cgroup_read_s64(css, cft, file, buf, nbytes, ppos); |
| 2418 | return -EINVAL; | 2422 | return -EINVAL; |
| 2419 | } | 2423 | } |
| 2420 | 2424 | ||
| @@ -2433,16 +2437,16 @@ static int cgroup_seqfile_show(struct seq_file *m, void *arg) | |||
| 2433 | { | 2437 | { |
| 2434 | struct cfent *cfe = m->private; | 2438 | struct cfent *cfe = m->private; |
| 2435 | struct cftype *cft = cfe->type; | 2439 | struct cftype *cft = cfe->type; |
| 2436 | struct cgroup *cgrp = __d_cgrp(cfe->dentry->d_parent); | 2440 | struct cgroup_subsys_state *css = cgroup_file_css(cfe); |
| 2437 | 2441 | ||
| 2438 | if (cft->read_map) { | 2442 | if (cft->read_map) { |
| 2439 | struct cgroup_map_cb cb = { | 2443 | struct cgroup_map_cb cb = { |
| 2440 | .fill = cgroup_map_add, | 2444 | .fill = cgroup_map_add, |
| 2441 | .state = m, | 2445 | .state = m, |
| 2442 | }; | 2446 | }; |
| 2443 | return cft->read_map(cgrp, cft, &cb); | 2447 | return cft->read_map(css, cft, &cb); |
| 2444 | } | 2448 | } |
| 2445 | return cft->read_seq_string(cgrp, cft, m); | 2449 | return cft->read_seq_string(css, cft, m); |
| 2446 | } | 2450 | } |
| 2447 | 2451 | ||
| 2448 | static const struct file_operations cgroup_seqfile_operations = { | 2452 | static const struct file_operations cgroup_seqfile_operations = { |
| @@ -3860,21 +3864,20 @@ static int cgroup_procs_open(struct inode *unused, struct file *file) | |||
| 3860 | return cgroup_pidlist_open(file, CGROUP_FILE_PROCS); | 3864 | return cgroup_pidlist_open(file, CGROUP_FILE_PROCS); |
| 3861 | } | 3865 | } |
| 3862 | 3866 | ||
| 3863 | static u64 cgroup_read_notify_on_release(struct cgroup *cgrp, | 3867 | static u64 cgroup_read_notify_on_release(struct cgroup_subsys_state *css, |
| 3864 | struct cftype *cft) | 3868 | struct cftype *cft) |
| 3865 | { | 3869 | { |
| 3866 | return notify_on_release(cgrp); | 3870 | return notify_on_release(css->cgroup); |
| 3867 | } | 3871 | } |
| 3868 | 3872 | ||
| 3869 | static int cgroup_write_notify_on_release(struct cgroup *cgrp, | 3873 | static int cgroup_write_notify_on_release(struct cgroup_subsys_state *css, |
| 3870 | struct cftype *cft, | 3874 | struct cftype *cft, u64 val) |
| 3871 | u64 val) | ||
| 3872 | { | 3875 | { |
| 3873 | clear_bit(CGRP_RELEASABLE, &cgrp->flags); | 3876 | clear_bit(CGRP_RELEASABLE, &css->cgroup->flags); |
| 3874 | if (val) | 3877 | if (val) |
| 3875 | set_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags); | 3878 | set_bit(CGRP_NOTIFY_ON_RELEASE, &css->cgroup->flags); |
| 3876 | else | 3879 | else |
| 3877 | clear_bit(CGRP_NOTIFY_ON_RELEASE, &cgrp->flags); | 3880 | clear_bit(CGRP_NOTIFY_ON_RELEASE, &css->cgroup->flags); |
| 3878 | return 0; | 3881 | return 0; |
| 3879 | } | 3882 | } |
| 3880 | 3883 | ||
| @@ -3972,9 +3975,10 @@ static void cgroup_event_ptable_queue_proc(struct file *file, | |||
| 3972 | * Input must be in format '<event_fd> <control_fd> <args>'. | 3975 | * Input must be in format '<event_fd> <control_fd> <args>'. |
| 3973 | * Interpretation of args is defined by control file implementation. | 3976 | * Interpretation of args is defined by control file implementation. |
| 3974 | */ | 3977 | */ |
| 3975 | static int cgroup_write_event_control(struct cgroup *cgrp, struct cftype *cft, | 3978 | static int cgroup_write_event_control(struct cgroup_subsys_state *css, |
| 3976 | const char *buffer) | 3979 | struct cftype *cft, const char *buffer) |
| 3977 | { | 3980 | { |
| 3981 | struct cgroup *cgrp = css->cgroup; | ||
| 3978 | struct cgroup_event *event; | 3982 | struct cgroup_event *event; |
| 3979 | struct cgroup *cgrp_cfile; | 3983 | struct cgroup *cgrp_cfile; |
| 3980 | unsigned int efd, cfd; | 3984 | unsigned int efd, cfd; |
| @@ -4082,20 +4086,19 @@ out_kfree: | |||
| 4082 | return ret; | 4086 | return ret; |
| 4083 | } | 4087 | } |
| 4084 | 4088 | ||
| 4085 | static u64 cgroup_clone_children_read(struct cgroup *cgrp, | 4089 | static u64 cgroup_clone_children_read(struct cgroup_subsys_state *css, |
| 4086 | struct cftype *cft) | 4090 | struct cftype *cft) |
| 4087 | { | 4091 | { |
| 4088 | return test_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags); | 4092 | return test_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags); |
| 4089 | } | 4093 | } |
| 4090 | 4094 | ||
| 4091 | static int cgroup_clone_children_write(struct cgroup *cgrp, | 4095 | static int cgroup_clone_children_write(struct cgroup_subsys_state *css, |
| 4092 | struct cftype *cft, | 4096 | struct cftype *cft, u64 val) |
| 4093 | u64 val) | ||
| 4094 | { | 4097 | { |
| 4095 | if (val) | 4098 | if (val) |
| 4096 | set_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags); | 4099 | set_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags); |
| 4097 | else | 4100 | else |
| 4098 | clear_bit(CGRP_CPUSET_CLONE_CHILDREN, &cgrp->flags); | 4101 | clear_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags); |
| 4099 | return 0; | 4102 | return 0; |
| 4100 | } | 4103 | } |
| 4101 | 4104 | ||
| @@ -5585,17 +5588,19 @@ static void debug_css_free(struct cgroup_subsys_state *css) | |||
| 5585 | kfree(css); | 5588 | kfree(css); |
| 5586 | } | 5589 | } |
| 5587 | 5590 | ||
| 5588 | static u64 debug_taskcount_read(struct cgroup *cgrp, struct cftype *cft) | 5591 | static u64 debug_taskcount_read(struct cgroup_subsys_state *css, |
| 5592 | struct cftype *cft) | ||
| 5589 | { | 5593 | { |
| 5590 | return cgroup_task_count(cgrp); | 5594 | return cgroup_task_count(css->cgroup); |
| 5591 | } | 5595 | } |
| 5592 | 5596 | ||
| 5593 | static u64 current_css_set_read(struct cgroup *cgrp, struct cftype *cft) | 5597 | static u64 current_css_set_read(struct cgroup_subsys_state *css, |
| 5598 | struct cftype *cft) | ||
| 5594 | { | 5599 | { |
| 5595 | return (u64)(unsigned long)current->cgroups; | 5600 | return (u64)(unsigned long)current->cgroups; |
| 5596 | } | 5601 | } |
| 5597 | 5602 | ||
| 5598 | static u64 current_css_set_refcount_read(struct cgroup *cgrp, | 5603 | static u64 current_css_set_refcount_read(struct cgroup_subsys_state *css, |
| 5599 | struct cftype *cft) | 5604 | struct cftype *cft) |
| 5600 | { | 5605 | { |
| 5601 | u64 count; | 5606 | u64 count; |
| @@ -5606,7 +5611,7 @@ static u64 current_css_set_refcount_read(struct cgroup *cgrp, | |||
| 5606 | return count; | 5611 | return count; |
| 5607 | } | 5612 | } |
| 5608 | 5613 | ||
| 5609 | static int current_css_set_cg_links_read(struct cgroup *cgrp, | 5614 | static int current_css_set_cg_links_read(struct cgroup_subsys_state *css, |
| 5610 | struct cftype *cft, | 5615 | struct cftype *cft, |
| 5611 | struct seq_file *seq) | 5616 | struct seq_file *seq) |
| 5612 | { | 5617 | { |
| @@ -5633,14 +5638,13 @@ static int current_css_set_cg_links_read(struct cgroup *cgrp, | |||
| 5633 | } | 5638 | } |
| 5634 | 5639 | ||
| 5635 | #define MAX_TASKS_SHOWN_PER_CSS 25 | 5640 | #define MAX_TASKS_SHOWN_PER_CSS 25 |
| 5636 | static int cgroup_css_links_read(struct cgroup *cgrp, | 5641 | static int cgroup_css_links_read(struct cgroup_subsys_state *css, |
| 5637 | struct cftype *cft, | 5642 | struct cftype *cft, struct seq_file *seq) |
| 5638 | struct seq_file *seq) | ||
| 5639 | { | 5643 | { |
| 5640 | struct cgrp_cset_link *link; | 5644 | struct cgrp_cset_link *link; |
| 5641 | 5645 | ||
| 5642 | read_lock(&css_set_lock); | 5646 | read_lock(&css_set_lock); |
| 5643 | list_for_each_entry(link, &cgrp->cset_links, cset_link) { | 5647 | list_for_each_entry(link, &css->cgroup->cset_links, cset_link) { |
| 5644 | struct css_set *cset = link->cset; | 5648 | struct css_set *cset = link->cset; |
| 5645 | struct task_struct *task; | 5649 | struct task_struct *task; |
| 5646 | int count = 0; | 5650 | int count = 0; |
| @@ -5659,9 +5663,9 @@ static int cgroup_css_links_read(struct cgroup *cgrp, | |||
| 5659 | return 0; | 5663 | return 0; |
| 5660 | } | 5664 | } |
| 5661 | 5665 | ||
| 5662 | static u64 releasable_read(struct cgroup *cgrp, struct cftype *cft) | 5666 | static u64 releasable_read(struct cgroup_subsys_state *css, struct cftype *cft) |
| 5663 | { | 5667 | { |
| 5664 | return test_bit(CGRP_RELEASABLE, &cgrp->flags); | 5668 | return test_bit(CGRP_RELEASABLE, &css->cgroup->flags); |
| 5665 | } | 5669 | } |
| 5666 | 5670 | ||
| 5667 | static struct cftype debug_files[] = { | 5671 | static struct cftype debug_files[] = { |
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index f03a85719c3c..19613ba51444 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c | |||
| @@ -245,7 +245,7 @@ out: | |||
| 245 | 245 | ||
| 246 | /** | 246 | /** |
| 247 | * update_if_frozen - update whether a cgroup finished freezing | 247 | * update_if_frozen - update whether a cgroup finished freezing |
| 248 | * @cgroup: cgroup of interest | 248 | * @css: css of interest |
| 249 | * | 249 | * |
| 250 | * Once FREEZING is initiated, transition to FROZEN is lazily updated by | 250 | * Once FREEZING is initiated, transition to FROZEN is lazily updated by |
| 251 | * calling this function. If the current state is FREEZING but not FROZEN, | 251 | * calling this function. If the current state is FREEZING but not FROZEN, |
| @@ -256,12 +256,12 @@ out: | |||
| 256 | * update_if_frozen() on all descendants prior to invoking this function. | 256 | * update_if_frozen() on all descendants prior to invoking this function. |
| 257 | * | 257 | * |
| 258 | * Task states and freezer state might disagree while tasks are being | 258 | * Task states and freezer state might disagree while tasks are being |
| 259 | * migrated into or out of @cgroup, so we can't verify task states against | 259 | * migrated into or out of @css, so we can't verify task states against |
| 260 | * @freezer state here. See freezer_attach() for details. | 260 | * @freezer state here. See freezer_attach() for details. |
| 261 | */ | 261 | */ |
| 262 | static void update_if_frozen(struct cgroup *cgroup) | 262 | static void update_if_frozen(struct cgroup_subsys_state *css) |
| 263 | { | 263 | { |
| 264 | struct freezer *freezer = cgroup_freezer(cgroup); | 264 | struct freezer *freezer = css_freezer(css); |
| 265 | struct cgroup *pos; | 265 | struct cgroup *pos; |
| 266 | struct cgroup_iter it; | 266 | struct cgroup_iter it; |
| 267 | struct task_struct *task; | 267 | struct task_struct *task; |
| @@ -275,7 +275,7 @@ static void update_if_frozen(struct cgroup *cgroup) | |||
| 275 | goto out_unlock; | 275 | goto out_unlock; |
| 276 | 276 | ||
| 277 | /* are all (live) children frozen? */ | 277 | /* are all (live) children frozen? */ |
| 278 | cgroup_for_each_child(pos, cgroup) { | 278 | cgroup_for_each_child(pos, css->cgroup) { |
| 279 | struct freezer *child = cgroup_freezer(pos); | 279 | struct freezer *child = cgroup_freezer(pos); |
| 280 | 280 | ||
| 281 | if ((child->state & CGROUP_FREEZER_ONLINE) && | 281 | if ((child->state & CGROUP_FREEZER_ONLINE) && |
| @@ -284,9 +284,9 @@ static void update_if_frozen(struct cgroup *cgroup) | |||
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | /* are all tasks frozen? */ | 286 | /* are all tasks frozen? */ |
| 287 | cgroup_iter_start(cgroup, &it); | 287 | cgroup_iter_start(css->cgroup, &it); |
| 288 | 288 | ||
| 289 | while ((task = cgroup_iter_next(cgroup, &it))) { | 289 | while ((task = cgroup_iter_next(css->cgroup, &it))) { |
| 290 | if (freezing(task)) { | 290 | if (freezing(task)) { |
| 291 | /* | 291 | /* |
| 292 | * freezer_should_skip() indicates that the task | 292 | * freezer_should_skip() indicates that the task |
| @@ -301,12 +301,12 @@ static void update_if_frozen(struct cgroup *cgroup) | |||
| 301 | 301 | ||
| 302 | freezer->state |= CGROUP_FROZEN; | 302 | freezer->state |= CGROUP_FROZEN; |
| 303 | out_iter_end: | 303 | out_iter_end: |
| 304 | cgroup_iter_end(cgroup, &it); | 304 | cgroup_iter_end(css->cgroup, &it); |
| 305 | out_unlock: | 305 | out_unlock: |
| 306 | spin_unlock_irq(&freezer->lock); | 306 | spin_unlock_irq(&freezer->lock); |
| 307 | } | 307 | } |
| 308 | 308 | ||
| 309 | static int freezer_read(struct cgroup *cgroup, struct cftype *cft, | 309 | static int freezer_read(struct cgroup_subsys_state *css, struct cftype *cft, |
| 310 | struct seq_file *m) | 310 | struct seq_file *m) |
| 311 | { | 311 | { |
| 312 | struct cgroup *pos; | 312 | struct cgroup *pos; |
| @@ -314,13 +314,13 @@ static int freezer_read(struct cgroup *cgroup, struct cftype *cft, | |||
| 314 | rcu_read_lock(); | 314 | rcu_read_lock(); |
| 315 | 315 | ||
| 316 | /* update states bottom-up */ | 316 | /* update states bottom-up */ |
| 317 | cgroup_for_each_descendant_post(pos, cgroup) | 317 | cgroup_for_each_descendant_post(pos, css->cgroup) |
| 318 | update_if_frozen(pos); | 318 | update_if_frozen(cgroup_css(pos, freezer_subsys_id)); |
| 319 | update_if_frozen(cgroup); | 319 | update_if_frozen(css); |
| 320 | 320 | ||
| 321 | rcu_read_unlock(); | 321 | rcu_read_unlock(); |
| 322 | 322 | ||
| 323 | seq_puts(m, freezer_state_strs(cgroup_freezer(cgroup)->state)); | 323 | seq_puts(m, freezer_state_strs(css_freezer(css)->state)); |
| 324 | seq_putc(m, '\n'); | 324 | seq_putc(m, '\n'); |
| 325 | return 0; | 325 | return 0; |
| 326 | } | 326 | } |
| @@ -426,7 +426,7 @@ static void freezer_change_state(struct freezer *freezer, bool freeze) | |||
| 426 | rcu_read_unlock(); | 426 | rcu_read_unlock(); |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | static int freezer_write(struct cgroup *cgroup, struct cftype *cft, | 429 | static int freezer_write(struct cgroup_subsys_state *css, struct cftype *cft, |
| 430 | const char *buffer) | 430 | const char *buffer) |
| 431 | { | 431 | { |
| 432 | bool freeze; | 432 | bool freeze; |
| @@ -438,20 +438,22 @@ static int freezer_write(struct cgroup *cgroup, struct cftype *cft, | |||
| 438 | else | 438 | else |
| 439 | return -EINVAL; | 439 | return -EINVAL; |
| 440 | 440 | ||
| 441 | freezer_change_state(cgroup_freezer(cgroup), freeze); | 441 | freezer_change_state(css_freezer(css), freeze); |
| 442 | return 0; | 442 | return 0; |
| 443 | } | 443 | } |
| 444 | 444 | ||
| 445 | static u64 freezer_self_freezing_read(struct cgroup *cgroup, struct cftype *cft) | 445 | static u64 freezer_self_freezing_read(struct cgroup_subsys_state *css, |
| 446 | struct cftype *cft) | ||
| 446 | { | 447 | { |
| 447 | struct freezer *freezer = cgroup_freezer(cgroup); | 448 | struct freezer *freezer = css_freezer(css); |
| 448 | 449 | ||
| 449 | return (bool)(freezer->state & CGROUP_FREEZING_SELF); | 450 | return (bool)(freezer->state & CGROUP_FREEZING_SELF); |
| 450 | } | 451 | } |
| 451 | 452 | ||
| 452 | static u64 freezer_parent_freezing_read(struct cgroup *cgroup, struct cftype *cft) | 453 | static u64 freezer_parent_freezing_read(struct cgroup_subsys_state *css, |
| 454 | struct cftype *cft) | ||
| 453 | { | 455 | { |
| 454 | struct freezer *freezer = cgroup_freezer(cgroup); | 456 | struct freezer *freezer = css_freezer(css); |
| 455 | 457 | ||
| 456 | return (bool)(freezer->state & CGROUP_FREEZING_PARENT); | 458 | return (bool)(freezer->state & CGROUP_FREEZING_PARENT); |
| 457 | } | 459 | } |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 8ce3fdc3dfcc..89b76e1d3aa1 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
| @@ -1603,9 +1603,10 @@ typedef enum { | |||
| 1603 | FILE_SPREAD_SLAB, | 1603 | FILE_SPREAD_SLAB, |
| 1604 | } cpuset_filetype_t; | 1604 | } cpuset_filetype_t; |
| 1605 | 1605 | ||
| 1606 | static int cpuset_write_u64(struct cgroup *cgrp, struct cftype *cft, u64 val) | 1606 | static int cpuset_write_u64(struct cgroup_subsys_state *css, struct cftype *cft, |
| 1607 | u64 val) | ||
| 1607 | { | 1608 | { |
| 1608 | struct cpuset *cs = cgroup_cs(cgrp); | 1609 | struct cpuset *cs = css_cs(css); |
| 1609 | cpuset_filetype_t type = cft->private; | 1610 | cpuset_filetype_t type = cft->private; |
| 1610 | int retval = -ENODEV; | 1611 | int retval = -ENODEV; |
| 1611 | 1612 | ||
| @@ -1650,9 +1651,10 @@ out_unlock: | |||
| 1650 | return retval; | 1651 | return retval; |
| 1651 | } | 1652 | } |
| 1652 | 1653 | ||
| 1653 | static int cpuset_write_s64(struct cgroup *cgrp, struct cftype *cft, s64 val) | 1654 | static int cpuset_write_s64(struct cgroup_subsys_state *css, struct cftype *cft, |
| 1655 | s64 val) | ||
| 1654 | { | 1656 | { |
| 1655 | struct cpuset *cs = cgroup_cs(cgrp); | 1657 | struct cpuset *cs = css_cs(css); |
| 1656 | cpuset_filetype_t type = cft->private; | 1658 | cpuset_filetype_t type = cft->private; |
| 1657 | int retval = -ENODEV; | 1659 | int retval = -ENODEV; |
| 1658 | 1660 | ||
| @@ -1676,10 +1678,10 @@ out_unlock: | |||
| 1676 | /* | 1678 | /* |
| 1677 | * Common handling for a write to a "cpus" or "mems" file. | 1679 | * Common handling for a write to a "cpus" or "mems" file. |
| 1678 | */ | 1680 | */ |
| 1679 | static int cpuset_write_resmask(struct cgroup *cgrp, struct cftype *cft, | 1681 | static int cpuset_write_resmask(struct cgroup_subsys_state *css, |
| 1680 | const char *buf) | 1682 | struct cftype *cft, const char *buf) |
| 1681 | { | 1683 | { |
| 1682 | struct cpuset *cs = cgroup_cs(cgrp); | 1684 | struct cpuset *cs = css_cs(css); |
| 1683 | struct cpuset *trialcs; | 1685 | struct cpuset *trialcs; |
| 1684 | int retval = -ENODEV; | 1686 | int retval = -ENODEV; |
| 1685 | 1687 | ||
| @@ -1758,13 +1760,12 @@ static size_t cpuset_sprintf_memlist(char *page, struct cpuset *cs) | |||
| 1758 | return count; | 1760 | return count; |
| 1759 | } | 1761 | } |
| 1760 | 1762 | ||
| 1761 | static ssize_t cpuset_common_file_read(struct cgroup *cgrp, | 1763 | static ssize_t cpuset_common_file_read(struct cgroup_subsys_state *css, |
| 1762 | struct cftype *cft, | 1764 | struct cftype *cft, struct file *file, |
| 1763 | struct file *file, | 1765 | char __user *buf, size_t nbytes, |
| 1764 | char __user *buf, | 1766 | loff_t *ppos) |
| 1765 | size_t nbytes, loff_t *ppos) | ||
| 1766 | { | 1767 | { |
| 1767 | struct cpuset *cs = cgroup_cs(cgrp); | 1768 | struct cpuset *cs = css_cs(css); |
| 1768 | cpuset_filetype_t type = cft->private; | 1769 | cpuset_filetype_t type = cft->private; |
| 1769 | char *page; | 1770 | char *page; |
| 1770 | ssize_t retval = 0; | 1771 | ssize_t retval = 0; |
| @@ -1794,9 +1795,9 @@ out: | |||
| 1794 | return retval; | 1795 | return retval; |
| 1795 | } | 1796 | } |
| 1796 | 1797 | ||
| 1797 | static u64 cpuset_read_u64(struct cgroup *cgrp, struct cftype *cft) | 1798 | static u64 cpuset_read_u64(struct cgroup_subsys_state *css, struct cftype *cft) |
| 1798 | { | 1799 | { |
| 1799 | struct cpuset *cs = cgroup_cs(cgrp); | 1800 | struct cpuset *cs = css_cs(css); |
| 1800 | cpuset_filetype_t type = cft->private; | 1801 | cpuset_filetype_t type = cft->private; |
| 1801 | switch (type) { | 1802 | switch (type) { |
| 1802 | case FILE_CPU_EXCLUSIVE: | 1803 | case FILE_CPU_EXCLUSIVE: |
| @@ -1825,9 +1826,9 @@ static u64 cpuset_read_u64(struct cgroup *cgrp, struct cftype *cft) | |||
| 1825 | return 0; | 1826 | return 0; |
| 1826 | } | 1827 | } |
| 1827 | 1828 | ||
| 1828 | static s64 cpuset_read_s64(struct cgroup *cgrp, struct cftype *cft) | 1829 | static s64 cpuset_read_s64(struct cgroup_subsys_state *css, struct cftype *cft) |
| 1829 | { | 1830 | { |
| 1830 | struct cpuset *cs = cgroup_cs(cgrp); | 1831 | struct cpuset *cs = css_cs(css); |
| 1831 | cpuset_filetype_t type = cft->private; | 1832 | cpuset_filetype_t type = cft->private; |
| 1832 | switch (type) { | 1833 | switch (type) { |
| 1833 | case FILE_SCHED_RELAX_DOMAIN_LEVEL: | 1834 | case FILE_SCHED_RELAX_DOMAIN_LEVEL: |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 622b7efc5ade..cc9a49266382 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
| @@ -7088,12 +7088,6 @@ static inline struct task_group *css_tg(struct cgroup_subsys_state *css) | |||
| 7088 | return css ? container_of(css, struct task_group, css) : NULL; | 7088 | return css ? container_of(css, struct task_group, css) : NULL; |
| 7089 | } | 7089 | } |
| 7090 | 7090 | ||
| 7091 | /* return corresponding task_group object of a cgroup */ | ||
| 7092 | static inline struct task_group *cgroup_tg(struct cgroup *cgrp) | ||
| 7093 | { | ||
| 7094 | return css_tg(cgroup_css(cgrp, cpu_cgroup_subsys_id)); | ||
| 7095 | } | ||
| 7096 | |||
| 7097 | static struct cgroup_subsys_state * | 7091 | static struct cgroup_subsys_state * |
| 7098 | cpu_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) | 7092 | cpu_cgroup_css_alloc(struct cgroup_subsys_state *parent_css) |
| 7099 | { | 7093 | { |
| @@ -7179,15 +7173,16 @@ static void cpu_cgroup_exit(struct cgroup_subsys_state *css, | |||
| 7179 | } | 7173 | } |
| 7180 | 7174 | ||
| 7181 | #ifdef CONFIG_FAIR_GROUP_SCHED | 7175 | #ifdef CONFIG_FAIR_GROUP_SCHED |
| 7182 | static int cpu_shares_write_u64(struct cgroup *cgrp, struct cftype *cftype, | 7176 | static int cpu_shares_write_u64(struct cgroup_subsys_state *css, |
| 7183 | u64 shareval) | 7177 | struct cftype *cftype, u64 shareval) |
| 7184 | { | 7178 | { |
| 7185 | return sched_group_set_shares(cgroup_tg(cgrp), scale_load(shareval)); | 7179 | return sched_group_set_shares(css_tg(css), scale_load(shareval)); |
| 7186 | } | 7180 | } |
| 7187 | 7181 | ||
| 7188 | static u64 cpu_shares_read_u64(struct cgroup *cgrp, struct cftype *cft) | 7182 | static u64 cpu_shares_read_u64(struct cgroup_subsys_state *css, |
| 7183 | struct cftype *cft) | ||
| 7189 | { | 7184 | { |
| 7190 | struct task_group *tg = cgroup_tg(cgrp); | 7185 | struct task_group *tg = css_tg(css); |
| 7191 | 7186 | ||
| 7192 | return (u64) scale_load_down(tg->shares); | 7187 | return (u64) scale_load_down(tg->shares); |
| 7193 | } | 7188 | } |
| @@ -7309,26 +7304,28 @@ long tg_get_cfs_period(struct task_group *tg) | |||
| 7309 | return cfs_period_us; | 7304 | return cfs_period_us; |
| 7310 | } | 7305 | } |
| 7311 | 7306 | ||
| 7312 | static s64 cpu_cfs_quota_read_s64(struct cgroup *cgrp, struct cftype *cft) | 7307 | static s64 cpu_cfs_quota_read_s64(struct cgroup_subsys_state *css, |
| 7308 | struct cftype *cft) | ||
| 7313 | { | 7309 | { |
| 7314 | return tg_get_cfs_quota(cgroup_tg(cgrp)); | 7310 | return tg_get_cfs_quota(css_tg(css)); |
| 7315 | } | 7311 | } |
| 7316 | 7312 | ||
| 7317 | static int cpu_cfs_quota_write_s64(struct cgroup *cgrp, struct cftype *cftype, | 7313 | static int cpu_cfs_quota_write_s64(struct cgroup_subsys_state *css, |
| 7318 | s64 cfs_quota_us) | 7314 | struct cftype *cftype, s64 cfs_quota_us) |
| 7319 | { | 7315 | { |
| 7320 | return tg_set_cfs_quota(cgroup_tg(cgrp), cfs_quota_us); | 7316 | return tg_set_cfs_quota(css_tg(css), cfs_quota_us); |
| 7321 | } | 7317 | } |
| 7322 | 7318 | ||
| 7323 | static u64 cpu_cfs_period_read_u64(struct cgroup *cgrp, struct cftype *cft) | 7319 | static u64 cpu_cfs_period_read_u64(struct cgroup_subsys_state *css, |
| 7320 | struct cftype *cft) | ||
| 7324 | { | 7321 | { |
| 7325 | return tg_get_cfs_period(cgroup_tg(cgrp)); | 7322 | return tg_get_cfs_period(css_tg(css)); |
| 7326 | } | 7323 | } |
| 7327 | 7324 | ||
| 7328 | static int cpu_cfs_period_write_u64(struct cgroup *cgrp, struct cftype *cftype, | 7325 | static int cpu_cfs_period_write_u64(struct cgroup_subsys_state *css, |
| 7329 | u64 cfs_period_us) | 7326 | struct cftype *cftype, u64 cfs_period_us) |
| 7330 | { | 7327 | { |
| 7331 | return tg_set_cfs_period(cgroup_tg(cgrp), cfs_period_us); | 7328 | return tg_set_cfs_period(css_tg(css), cfs_period_us); |
| 7332 | } | 7329 | } |
| 7333 | 7330 | ||
| 7334 | struct cfs_schedulable_data { | 7331 | struct cfs_schedulable_data { |
| @@ -7409,10 +7406,10 @@ static int __cfs_schedulable(struct task_group *tg, u64 period, u64 quota) | |||
| 7409 | return ret; | 7406 | return ret; |
| 7410 | } | 7407 | } |
| 7411 | 7408 | ||
| 7412 | static int cpu_stats_show(struct cgroup *cgrp, struct cftype *cft, | 7409 | static int cpu_stats_show(struct cgroup_subsys_state *css, struct cftype *cft, |
| 7413 | struct cgroup_map_cb *cb) | 7410 | struct cgroup_map_cb *cb) |
| 7414 | { | 7411 | { |
| 7415 | struct task_group *tg = cgroup_tg(cgrp); | 7412 | struct task_group *tg = css_tg(css); |
| 7416 | struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth; | 7413 | struct cfs_bandwidth *cfs_b = &tg->cfs_bandwidth; |
| 7417 | 7414 | ||
| 7418 | cb->fill(cb, "nr_periods", cfs_b->nr_periods); | 7415 | cb->fill(cb, "nr_periods", cfs_b->nr_periods); |
| @@ -7425,26 +7422,28 @@ static int cpu_stats_show(struct cgroup *cgrp, struct cftype *cft, | |||
| 7425 | #endif /* CONFIG_FAIR_GROUP_SCHED */ | 7422 | #endif /* CONFIG_FAIR_GROUP_SCHED */ |
| 7426 | 7423 | ||
| 7427 | #ifdef CONFIG_RT_GROUP_SCHED | 7424 | #ifdef CONFIG_RT_GROUP_SCHED |
| 7428 | static int cpu_rt_runtime_write(struct cgroup *cgrp, struct cftype *cft, | 7425 | static int cpu_rt_runtime_write(struct cgroup_subsys_state *css, |
| 7429 | s64 val) | 7426 | struct cftype *cft, s64 val) |
| 7430 | { | 7427 | { |
| 7431 | return sched_group_set_rt_runtime(cgroup_tg(cgrp), val); | 7428 | return sched_group_set_rt_runtime(css_tg(css), val); |
| 7432 | } | 7429 | } |
| 7433 | 7430 | ||
| 7434 | static s64 cpu_rt_runtime_read(struct cgroup *cgrp, struct cftype *cft) | 7431 | static s64 cpu_rt_runtime_read(struct cgroup_subsys_state *css, |
| 7432 | struct cftype *cft) | ||
| 7435 | { | 7433 | { |
| 7436 | return sched_group_rt_runtime(cgroup_tg(cgrp)); | 7434 | return sched_group_rt_runtime(css_tg(css)); |
| 7437 | } | 7435 | } |
| 7438 | 7436 | ||
| 7439 | static int cpu_rt_period_write_uint(struct cgroup *cgrp, struct cftype *cftype, | 7437 | static int cpu_rt_period_write_uint(struct cgroup_subsys_state *css, |
| 7440 | u64 rt_period_us) | 7438 | struct cftype *cftype, u64 rt_period_us) |
| 7441 | { | 7439 | { |
| 7442 | return sched_group_set_rt_period(cgroup_tg(cgrp), rt_period_us); | 7440 | return sched_group_set_rt_period(css_tg(css), rt_period_us); |
| 7443 | } | 7441 | } |
| 7444 | 7442 | ||
| 7445 | static u64 cpu_rt_period_read_uint(struct cgroup *cgrp, struct cftype *cft) | 7443 | static u64 cpu_rt_period_read_uint(struct cgroup_subsys_state *css, |
| 7444 | struct cftype *cft) | ||
| 7446 | { | 7445 | { |
| 7447 | return sched_group_rt_period(cgroup_tg(cgrp)); | 7446 | return sched_group_rt_period(css_tg(css)); |
| 7448 | } | 7447 | } |
| 7449 | #endif /* CONFIG_RT_GROUP_SCHED */ | 7448 | #endif /* CONFIG_RT_GROUP_SCHED */ |
| 7450 | 7449 | ||
diff --git a/kernel/sched/cpuacct.c b/kernel/sched/cpuacct.c index 1b784d9b3630..f64722ff0299 100644 --- a/kernel/sched/cpuacct.c +++ b/kernel/sched/cpuacct.c | |||
| @@ -38,12 +38,6 @@ static inline struct cpuacct *css_ca(struct cgroup_subsys_state *css) | |||
| 38 | return css ? container_of(css, struct cpuacct, css) : NULL; | 38 | return css ? container_of(css, struct cpuacct, css) : NULL; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | /* return cpu accounting group corresponding to this container */ | ||
| 42 | static inline struct cpuacct *cgroup_ca(struct cgroup *cgrp) | ||
| 43 | { | ||
| 44 | return css_ca(cgroup_css(cgrp, cpuacct_subsys_id)); | ||
| 45 | } | ||
| 46 | |||
| 47 | /* return cpu accounting group to which this task belongs */ | 41 | /* return cpu accounting group to which this task belongs */ |
| 48 | static inline struct cpuacct *task_ca(struct task_struct *tsk) | 42 | static inline struct cpuacct *task_ca(struct task_struct *tsk) |
| 49 | { | 43 | { |
| @@ -138,9 +132,9 @@ static void cpuacct_cpuusage_write(struct cpuacct *ca, int cpu, u64 val) | |||
| 138 | } | 132 | } |
| 139 | 133 | ||
| 140 | /* return total cpu usage (in nanoseconds) of a group */ | 134 | /* return total cpu usage (in nanoseconds) of a group */ |
| 141 | static u64 cpuusage_read(struct cgroup *cgrp, struct cftype *cft) | 135 | static u64 cpuusage_read(struct cgroup_subsys_state *css, struct cftype *cft) |
| 142 | { | 136 | { |
| 143 | struct cpuacct *ca = cgroup_ca(cgrp); | 137 | struct cpuacct *ca = css_ca(css); |
| 144 | u64 totalcpuusage = 0; | 138 | u64 totalcpuusage = 0; |
| 145 | int i; | 139 | int i; |
| 146 | 140 | ||
| @@ -150,10 +144,10 @@ static u64 cpuusage_read(struct cgroup *cgrp, struct cftype *cft) | |||
| 150 | return totalcpuusage; | 144 | return totalcpuusage; |
| 151 | } | 145 | } |
| 152 | 146 | ||
| 153 | static int cpuusage_write(struct cgroup *cgrp, struct cftype *cftype, | 147 | static int cpuusage_write(struct cgroup_subsys_state *css, struct cftype *cft, |
| 154 | u64 reset) | 148 | u64 reset) |
| 155 | { | 149 | { |
| 156 | struct cpuacct *ca = cgroup_ca(cgrp); | 150 | struct cpuacct *ca = css_ca(css); |
| 157 | int err = 0; | 151 | int err = 0; |
| 158 | int i; | 152 | int i; |
| 159 | 153 | ||
| @@ -169,10 +163,10 @@ out: | |||
| 169 | return err; | 163 | return err; |
| 170 | } | 164 | } |
| 171 | 165 | ||
| 172 | static int cpuacct_percpu_seq_read(struct cgroup *cgroup, struct cftype *cft, | 166 | static int cpuacct_percpu_seq_read(struct cgroup_subsys_state *css, |
| 173 | struct seq_file *m) | 167 | struct cftype *cft, struct seq_file *m) |
| 174 | { | 168 | { |
| 175 | struct cpuacct *ca = cgroup_ca(cgroup); | 169 | struct cpuacct *ca = css_ca(css); |
| 176 | u64 percpu; | 170 | u64 percpu; |
| 177 | int i; | 171 | int i; |
| 178 | 172 | ||
| @@ -189,10 +183,10 @@ static const char * const cpuacct_stat_desc[] = { | |||
| 189 | [CPUACCT_STAT_SYSTEM] = "system", | 183 | [CPUACCT_STAT_SYSTEM] = "system", |
| 190 | }; | 184 | }; |
| 191 | 185 | ||
| 192 | static int cpuacct_stats_show(struct cgroup *cgrp, struct cftype *cft, | 186 | static int cpuacct_stats_show(struct cgroup_subsys_state *css, |
| 193 | struct cgroup_map_cb *cb) | 187 | struct cftype *cft, struct cgroup_map_cb *cb) |
| 194 | { | 188 | { |
| 195 | struct cpuacct *ca = cgroup_ca(cgrp); | 189 | struct cpuacct *ca = css_ca(css); |
| 196 | int cpu; | 190 | int cpu; |
| 197 | s64 val = 0; | 191 | s64 val = 0; |
| 198 | 192 | ||
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index e2132435060f..bda8e44f6fde 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c | |||
| @@ -40,12 +40,6 @@ struct hugetlb_cgroup *hugetlb_cgroup_from_css(struct cgroup_subsys_state *s) | |||
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | static inline | 42 | static inline |
| 43 | struct hugetlb_cgroup *hugetlb_cgroup_from_cgroup(struct cgroup *cgroup) | ||
| 44 | { | ||
| 45 | return hugetlb_cgroup_from_css(cgroup_css(cgroup, hugetlb_subsys_id)); | ||
| 46 | } | ||
| 47 | |||
| 48 | static inline | ||
| 49 | struct hugetlb_cgroup *hugetlb_cgroup_from_task(struct task_struct *task) | 43 | struct hugetlb_cgroup *hugetlb_cgroup_from_task(struct task_struct *task) |
| 50 | { | 44 | { |
| 51 | return hugetlb_cgroup_from_css(task_css(task, hugetlb_subsys_id)); | 45 | return hugetlb_cgroup_from_css(task_css(task, hugetlb_subsys_id)); |
| @@ -248,14 +242,15 @@ void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages, | |||
| 248 | return; | 242 | return; |
| 249 | } | 243 | } |
| 250 | 244 | ||
| 251 | static ssize_t hugetlb_cgroup_read(struct cgroup *cgroup, struct cftype *cft, | 245 | static ssize_t hugetlb_cgroup_read(struct cgroup_subsys_state *css, |
| 252 | struct file *file, char __user *buf, | 246 | struct cftype *cft, struct file *file, |
| 253 | size_t nbytes, loff_t *ppos) | 247 | char __user *buf, size_t nbytes, |
| 248 | loff_t *ppos) | ||
| 254 | { | 249 | { |
| 255 | u64 val; | 250 | u64 val; |
| 256 | char str[64]; | 251 | char str[64]; |
| 257 | int idx, name, len; | 252 | int idx, name, len; |
| 258 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_cgroup(cgroup); | 253 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); |
| 259 | 254 | ||
| 260 | idx = MEMFILE_IDX(cft->private); | 255 | idx = MEMFILE_IDX(cft->private); |
| 261 | name = MEMFILE_ATTR(cft->private); | 256 | name = MEMFILE_ATTR(cft->private); |
| @@ -265,12 +260,12 @@ static ssize_t hugetlb_cgroup_read(struct cgroup *cgroup, struct cftype *cft, | |||
| 265 | return simple_read_from_buffer(buf, nbytes, ppos, str, len); | 260 | return simple_read_from_buffer(buf, nbytes, ppos, str, len); |
| 266 | } | 261 | } |
| 267 | 262 | ||
| 268 | static int hugetlb_cgroup_write(struct cgroup *cgroup, struct cftype *cft, | 263 | static int hugetlb_cgroup_write(struct cgroup_subsys_state *css, |
| 269 | const char *buffer) | 264 | struct cftype *cft, const char *buffer) |
| 270 | { | 265 | { |
| 271 | int idx, name, ret; | 266 | int idx, name, ret; |
| 272 | unsigned long long val; | 267 | unsigned long long val; |
| 273 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_cgroup(cgroup); | 268 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); |
| 274 | 269 | ||
| 275 | idx = MEMFILE_IDX(cft->private); | 270 | idx = MEMFILE_IDX(cft->private); |
| 276 | name = MEMFILE_ATTR(cft->private); | 271 | name = MEMFILE_ATTR(cft->private); |
| @@ -295,10 +290,11 @@ static int hugetlb_cgroup_write(struct cgroup *cgroup, struct cftype *cft, | |||
| 295 | return ret; | 290 | return ret; |
| 296 | } | 291 | } |
| 297 | 292 | ||
| 298 | static int hugetlb_cgroup_reset(struct cgroup *cgroup, unsigned int event) | 293 | static int hugetlb_cgroup_reset(struct cgroup_subsys_state *css, |
| 294 | unsigned int event) | ||
| 299 | { | 295 | { |
| 300 | int idx, name, ret = 0; | 296 | int idx, name, ret = 0; |
| 301 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_cgroup(cgroup); | 297 | struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); |
| 302 | 298 | ||
| 303 | idx = MEMFILE_IDX(event); | 299 | idx = MEMFILE_IDX(event); |
| 304 | name = MEMFILE_ATTR(event); | 300 | name = MEMFILE_ATTR(event); |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 32cca0f0af0d..ab64dfc84f8c 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
| @@ -483,7 +483,6 @@ enum res_type { | |||
| 483 | */ | 483 | */ |
| 484 | static DEFINE_MUTEX(memcg_create_mutex); | 484 | static DEFINE_MUTEX(memcg_create_mutex); |
| 485 | 485 | ||
| 486 | static inline | ||
| 487 | struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s) | 486 | struct mem_cgroup *mem_cgroup_from_css(struct cgroup_subsys_state *s) |
| 488 | { | 487 | { |
| 489 | return s ? container_of(s, struct mem_cgroup, css) : NULL; | 488 | return s ? container_of(s, struct mem_cgroup, css) : NULL; |
| @@ -1035,7 +1034,7 @@ static void memcg_check_events(struct mem_cgroup *memcg, struct page *page) | |||
| 1035 | preempt_enable(); | 1034 | preempt_enable(); |
| 1036 | } | 1035 | } |
| 1037 | 1036 | ||
| 1038 | struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont) | 1037 | static inline struct mem_cgroup *mem_cgroup_from_cont(struct cgroup *cont) |
| 1039 | { | 1038 | { |
| 1040 | return mem_cgroup_from_css(cgroup_css(cont, mem_cgroup_subsys_id)); | 1039 | return mem_cgroup_from_css(cgroup_css(cont, mem_cgroup_subsys_id)); |
| 1041 | } | 1040 | } |
| @@ -2951,10 +2950,10 @@ static struct kmem_cache *memcg_params_to_cache(struct memcg_cache_params *p) | |||
| 2951 | } | 2950 | } |
| 2952 | 2951 | ||
| 2953 | #ifdef CONFIG_SLABINFO | 2952 | #ifdef CONFIG_SLABINFO |
| 2954 | static int mem_cgroup_slabinfo_read(struct cgroup *cont, struct cftype *cft, | 2953 | static int mem_cgroup_slabinfo_read(struct cgroup_subsys_state *css, |
| 2955 | struct seq_file *m) | 2954 | struct cftype *cft, struct seq_file *m) |
| 2956 | { | 2955 | { |
| 2957 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 2956 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 2958 | struct memcg_cache_params *params; | 2957 | struct memcg_cache_params *params; |
| 2959 | 2958 | ||
| 2960 | if (!memcg_can_account_kmem(memcg)) | 2959 | if (!memcg_can_account_kmem(memcg)) |
| @@ -4999,9 +4998,10 @@ static int mem_cgroup_force_empty(struct mem_cgroup *memcg) | |||
| 4999 | return 0; | 4998 | return 0; |
| 5000 | } | 4999 | } |
| 5001 | 5000 | ||
| 5002 | static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event) | 5001 | static int mem_cgroup_force_empty_write(struct cgroup_subsys_state *css, |
| 5002 | unsigned int event) | ||
| 5003 | { | 5003 | { |
| 5004 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5004 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5005 | int ret; | 5005 | int ret; |
| 5006 | 5006 | ||
| 5007 | if (mem_cgroup_is_root(memcg)) | 5007 | if (mem_cgroup_is_root(memcg)) |
| @@ -5014,16 +5014,17 @@ static int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event) | |||
| 5014 | } | 5014 | } |
| 5015 | 5015 | ||
| 5016 | 5016 | ||
| 5017 | static u64 mem_cgroup_hierarchy_read(struct cgroup *cont, struct cftype *cft) | 5017 | static u64 mem_cgroup_hierarchy_read(struct cgroup_subsys_state *css, |
| 5018 | struct cftype *cft) | ||
| 5018 | { | 5019 | { |
| 5019 | return mem_cgroup_from_cont(cont)->use_hierarchy; | 5020 | return mem_cgroup_from_css(css)->use_hierarchy; |
| 5020 | } | 5021 | } |
| 5021 | 5022 | ||
| 5022 | static int mem_cgroup_hierarchy_write(struct cgroup *cont, struct cftype *cft, | 5023 | static int mem_cgroup_hierarchy_write(struct cgroup_subsys_state *css, |
| 5023 | u64 val) | 5024 | struct cftype *cft, u64 val) |
| 5024 | { | 5025 | { |
| 5025 | int retval = 0; | 5026 | int retval = 0; |
| 5026 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5027 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5027 | struct mem_cgroup *parent_memcg = mem_cgroup_from_css(css_parent(&memcg->css)); | 5028 | struct mem_cgroup *parent_memcg = mem_cgroup_from_css(css_parent(&memcg->css)); |
| 5028 | 5029 | ||
| 5029 | mutex_lock(&memcg_create_mutex); | 5030 | mutex_lock(&memcg_create_mutex); |
| @@ -5094,11 +5095,11 @@ static inline u64 mem_cgroup_usage(struct mem_cgroup *memcg, bool swap) | |||
| 5094 | return val << PAGE_SHIFT; | 5095 | return val << PAGE_SHIFT; |
| 5095 | } | 5096 | } |
| 5096 | 5097 | ||
| 5097 | static ssize_t mem_cgroup_read(struct cgroup *cont, struct cftype *cft, | 5098 | static ssize_t mem_cgroup_read(struct cgroup_subsys_state *css, |
| 5098 | struct file *file, char __user *buf, | 5099 | struct cftype *cft, struct file *file, |
| 5099 | size_t nbytes, loff_t *ppos) | 5100 | char __user *buf, size_t nbytes, loff_t *ppos) |
| 5100 | { | 5101 | { |
| 5101 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5102 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5102 | char str[64]; | 5103 | char str[64]; |
| 5103 | u64 val; | 5104 | u64 val; |
| 5104 | int name, len; | 5105 | int name, len; |
| @@ -5131,11 +5132,11 @@ static ssize_t mem_cgroup_read(struct cgroup *cont, struct cftype *cft, | |||
| 5131 | return simple_read_from_buffer(buf, nbytes, ppos, str, len); | 5132 | return simple_read_from_buffer(buf, nbytes, ppos, str, len); |
| 5132 | } | 5133 | } |
| 5133 | 5134 | ||
| 5134 | static int memcg_update_kmem_limit(struct cgroup *cont, u64 val) | 5135 | static int memcg_update_kmem_limit(struct cgroup_subsys_state *css, u64 val) |
| 5135 | { | 5136 | { |
| 5136 | int ret = -EINVAL; | 5137 | int ret = -EINVAL; |
| 5137 | #ifdef CONFIG_MEMCG_KMEM | 5138 | #ifdef CONFIG_MEMCG_KMEM |
| 5138 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5139 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5139 | /* | 5140 | /* |
| 5140 | * For simplicity, we won't allow this to be disabled. It also can't | 5141 | * For simplicity, we won't allow this to be disabled. It also can't |
| 5141 | * be changed if the cgroup has children already, or if tasks had | 5142 | * be changed if the cgroup has children already, or if tasks had |
| @@ -5151,7 +5152,7 @@ static int memcg_update_kmem_limit(struct cgroup *cont, u64 val) | |||
| 5151 | mutex_lock(&memcg_create_mutex); | 5152 | mutex_lock(&memcg_create_mutex); |
| 5152 | mutex_lock(&set_limit_mutex); | 5153 | mutex_lock(&set_limit_mutex); |
| 5153 | if (!memcg->kmem_account_flags && val != RESOURCE_MAX) { | 5154 | if (!memcg->kmem_account_flags && val != RESOURCE_MAX) { |
| 5154 | if (cgroup_task_count(cont) || memcg_has_children(memcg)) { | 5155 | if (cgroup_task_count(css->cgroup) || memcg_has_children(memcg)) { |
| 5155 | ret = -EBUSY; | 5156 | ret = -EBUSY; |
| 5156 | goto out; | 5157 | goto out; |
| 5157 | } | 5158 | } |
| @@ -5221,10 +5222,10 @@ out: | |||
| 5221 | * The user of this function is... | 5222 | * The user of this function is... |
| 5222 | * RES_LIMIT. | 5223 | * RES_LIMIT. |
| 5223 | */ | 5224 | */ |
| 5224 | static int mem_cgroup_write(struct cgroup *cont, struct cftype *cft, | 5225 | static int mem_cgroup_write(struct cgroup_subsys_state *css, struct cftype *cft, |
| 5225 | const char *buffer) | 5226 | const char *buffer) |
| 5226 | { | 5227 | { |
| 5227 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5228 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5228 | enum res_type type; | 5229 | enum res_type type; |
| 5229 | int name; | 5230 | int name; |
| 5230 | unsigned long long val; | 5231 | unsigned long long val; |
| @@ -5248,7 +5249,7 @@ static int mem_cgroup_write(struct cgroup *cont, struct cftype *cft, | |||
| 5248 | else if (type == _MEMSWAP) | 5249 | else if (type == _MEMSWAP) |
| 5249 | ret = mem_cgroup_resize_memsw_limit(memcg, val); | 5250 | ret = mem_cgroup_resize_memsw_limit(memcg, val); |
| 5250 | else if (type == _KMEM) | 5251 | else if (type == _KMEM) |
| 5251 | ret = memcg_update_kmem_limit(cont, val); | 5252 | ret = memcg_update_kmem_limit(css, val); |
| 5252 | else | 5253 | else |
| 5253 | return -EINVAL; | 5254 | return -EINVAL; |
| 5254 | break; | 5255 | break; |
| @@ -5297,9 +5298,9 @@ out: | |||
| 5297 | *memsw_limit = min_memsw_limit; | 5298 | *memsw_limit = min_memsw_limit; |
| 5298 | } | 5299 | } |
| 5299 | 5300 | ||
| 5300 | static int mem_cgroup_reset(struct cgroup *cont, unsigned int event) | 5301 | static int mem_cgroup_reset(struct cgroup_subsys_state *css, unsigned int event) |
| 5301 | { | 5302 | { |
| 5302 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5303 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5303 | int name; | 5304 | int name; |
| 5304 | enum res_type type; | 5305 | enum res_type type; |
| 5305 | 5306 | ||
| @@ -5332,17 +5333,17 @@ static int mem_cgroup_reset(struct cgroup *cont, unsigned int event) | |||
| 5332 | return 0; | 5333 | return 0; |
| 5333 | } | 5334 | } |
| 5334 | 5335 | ||
| 5335 | static u64 mem_cgroup_move_charge_read(struct cgroup *cgrp, | 5336 | static u64 mem_cgroup_move_charge_read(struct cgroup_subsys_state *css, |
| 5336 | struct cftype *cft) | 5337 | struct cftype *cft) |
| 5337 | { | 5338 | { |
| 5338 | return mem_cgroup_from_cont(cgrp)->move_charge_at_immigrate; | 5339 | return mem_cgroup_from_css(css)->move_charge_at_immigrate; |
| 5339 | } | 5340 | } |
| 5340 | 5341 | ||
| 5341 | #ifdef CONFIG_MMU | 5342 | #ifdef CONFIG_MMU |
| 5342 | static int mem_cgroup_move_charge_write(struct cgroup *cgrp, | 5343 | static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css, |
| 5343 | struct cftype *cft, u64 val) | 5344 | struct cftype *cft, u64 val) |
| 5344 | { | 5345 | { |
| 5345 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 5346 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5346 | 5347 | ||
| 5347 | if (val >= (1 << NR_MOVE_TYPE)) | 5348 | if (val >= (1 << NR_MOVE_TYPE)) |
| 5348 | return -EINVAL; | 5349 | return -EINVAL; |
| @@ -5357,7 +5358,7 @@ static int mem_cgroup_move_charge_write(struct cgroup *cgrp, | |||
| 5357 | return 0; | 5358 | return 0; |
| 5358 | } | 5359 | } |
| 5359 | #else | 5360 | #else |
| 5360 | static int mem_cgroup_move_charge_write(struct cgroup *cgrp, | 5361 | static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css, |
| 5361 | struct cftype *cft, u64 val) | 5362 | struct cftype *cft, u64 val) |
| 5362 | { | 5363 | { |
| 5363 | return -ENOSYS; | 5364 | return -ENOSYS; |
| @@ -5365,13 +5366,13 @@ static int mem_cgroup_move_charge_write(struct cgroup *cgrp, | |||
| 5365 | #endif | 5366 | #endif |
| 5366 | 5367 | ||
| 5367 | #ifdef CONFIG_NUMA | 5368 | #ifdef CONFIG_NUMA |
| 5368 | static int memcg_numa_stat_show(struct cgroup *cont, struct cftype *cft, | 5369 | static int memcg_numa_stat_show(struct cgroup_subsys_state *css, |
| 5369 | struct seq_file *m) | 5370 | struct cftype *cft, struct seq_file *m) |
| 5370 | { | 5371 | { |
| 5371 | int nid; | 5372 | int nid; |
| 5372 | unsigned long total_nr, file_nr, anon_nr, unevictable_nr; | 5373 | unsigned long total_nr, file_nr, anon_nr, unevictable_nr; |
| 5373 | unsigned long node_nr; | 5374 | unsigned long node_nr; |
| 5374 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5375 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5375 | 5376 | ||
| 5376 | total_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL); | 5377 | total_nr = mem_cgroup_nr_lru_pages(memcg, LRU_ALL); |
| 5377 | seq_printf(m, "total=%lu", total_nr); | 5378 | seq_printf(m, "total=%lu", total_nr); |
| @@ -5416,10 +5417,10 @@ static inline void mem_cgroup_lru_names_not_uptodate(void) | |||
| 5416 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); | 5417 | BUILD_BUG_ON(ARRAY_SIZE(mem_cgroup_lru_names) != NR_LRU_LISTS); |
| 5417 | } | 5418 | } |
| 5418 | 5419 | ||
| 5419 | static int memcg_stat_show(struct cgroup *cont, struct cftype *cft, | 5420 | static int memcg_stat_show(struct cgroup_subsys_state *css, struct cftype *cft, |
| 5420 | struct seq_file *m) | 5421 | struct seq_file *m) |
| 5421 | { | 5422 | { |
| 5422 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 5423 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5423 | struct mem_cgroup *mi; | 5424 | struct mem_cgroup *mi; |
| 5424 | unsigned int i; | 5425 | unsigned int i; |
| 5425 | 5426 | ||
| @@ -5503,17 +5504,18 @@ static int memcg_stat_show(struct cgroup *cont, struct cftype *cft, | |||
| 5503 | return 0; | 5504 | return 0; |
| 5504 | } | 5505 | } |
| 5505 | 5506 | ||
| 5506 | static u64 mem_cgroup_swappiness_read(struct cgroup *cgrp, struct cftype *cft) | 5507 | static u64 mem_cgroup_swappiness_read(struct cgroup_subsys_state *css, |
| 5508 | struct cftype *cft) | ||
| 5507 | { | 5509 | { |
| 5508 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 5510 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5509 | 5511 | ||
| 5510 | return mem_cgroup_swappiness(memcg); | 5512 | return mem_cgroup_swappiness(memcg); |
| 5511 | } | 5513 | } |
| 5512 | 5514 | ||
| 5513 | static int mem_cgroup_swappiness_write(struct cgroup *cgrp, struct cftype *cft, | 5515 | static int mem_cgroup_swappiness_write(struct cgroup_subsys_state *css, |
| 5514 | u64 val) | 5516 | struct cftype *cft, u64 val) |
| 5515 | { | 5517 | { |
| 5516 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 5518 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5517 | struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(&memcg->css)); | 5519 | struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(&memcg->css)); |
| 5518 | 5520 | ||
| 5519 | if (val > 100 || !parent) | 5521 | if (val > 100 || !parent) |
| @@ -5829,10 +5831,10 @@ static void mem_cgroup_oom_unregister_event(struct cgroup *cgrp, | |||
| 5829 | spin_unlock(&memcg_oom_lock); | 5831 | spin_unlock(&memcg_oom_lock); |
| 5830 | } | 5832 | } |
| 5831 | 5833 | ||
| 5832 | static int mem_cgroup_oom_control_read(struct cgroup *cgrp, | 5834 | static int mem_cgroup_oom_control_read(struct cgroup_subsys_state *css, |
| 5833 | struct cftype *cft, struct cgroup_map_cb *cb) | 5835 | struct cftype *cft, struct cgroup_map_cb *cb) |
| 5834 | { | 5836 | { |
| 5835 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 5837 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5836 | 5838 | ||
| 5837 | cb->fill(cb, "oom_kill_disable", memcg->oom_kill_disable); | 5839 | cb->fill(cb, "oom_kill_disable", memcg->oom_kill_disable); |
| 5838 | 5840 | ||
| @@ -5843,10 +5845,10 @@ static int mem_cgroup_oom_control_read(struct cgroup *cgrp, | |||
| 5843 | return 0; | 5845 | return 0; |
| 5844 | } | 5846 | } |
| 5845 | 5847 | ||
| 5846 | static int mem_cgroup_oom_control_write(struct cgroup *cgrp, | 5848 | static int mem_cgroup_oom_control_write(struct cgroup_subsys_state *css, |
| 5847 | struct cftype *cft, u64 val) | 5849 | struct cftype *cft, u64 val) |
| 5848 | { | 5850 | { |
| 5849 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp); | 5851 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 5850 | struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(&memcg->css)); | 5852 | struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(&memcg->css)); |
| 5851 | 5853 | ||
| 5852 | /* cannot set to root cgroup and only 0 and 1 are allowed */ | 5854 | /* cannot set to root cgroup and only 0 and 1 are allowed */ |
diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 7f1654d3cec7..2a8a736e95cc 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c | |||
| @@ -81,8 +81,8 @@ static struct vmpressure *cg_to_vmpressure(struct cgroup *cg) | |||
| 81 | 81 | ||
| 82 | static struct vmpressure *vmpressure_parent(struct vmpressure *vmpr) | 82 | static struct vmpressure *vmpressure_parent(struct vmpressure *vmpr) |
| 83 | { | 83 | { |
| 84 | struct cgroup *cg = vmpressure_to_css(vmpr)->cgroup; | 84 | struct cgroup_subsys_state *css = vmpressure_to_css(vmpr); |
| 85 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cg); | 85 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 86 | 86 | ||
| 87 | memcg = parent_mem_cgroup(memcg); | 87 | memcg = parent_mem_cgroup(memcg); |
| 88 | if (!memcg) | 88 | if (!memcg) |
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c index 8d095b4c2f6f..e00f60e5baea 100644 --- a/net/core/netprio_cgroup.c +++ b/net/core/netprio_cgroup.c | |||
| @@ -168,15 +168,14 @@ static void cgrp_css_free(struct cgroup_subsys_state *css) | |||
| 168 | kfree(css); | 168 | kfree(css); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | static u64 read_prioidx(struct cgroup *cgrp, struct cftype *cft) | 171 | static u64 read_prioidx(struct cgroup_subsys_state *css, struct cftype *cft) |
| 172 | { | 172 | { |
| 173 | return cgrp->id; | 173 | return css->cgroup->id; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | static int read_priomap(struct cgroup *cont, struct cftype *cft, | 176 | static int read_priomap(struct cgroup_subsys_state *css, struct cftype *cft, |
| 177 | struct cgroup_map_cb *cb) | 177 | struct cgroup_map_cb *cb) |
| 178 | { | 178 | { |
| 179 | struct cgroup_subsys_state *css = cgroup_css(cont, net_prio_subsys_id); | ||
| 180 | struct net_device *dev; | 179 | struct net_device *dev; |
| 181 | 180 | ||
| 182 | rcu_read_lock(); | 181 | rcu_read_lock(); |
| @@ -186,10 +185,9 @@ static int read_priomap(struct cgroup *cont, struct cftype *cft, | |||
| 186 | return 0; | 185 | return 0; |
| 187 | } | 186 | } |
| 188 | 187 | ||
| 189 | static int write_priomap(struct cgroup *cgrp, struct cftype *cft, | 188 | static int write_priomap(struct cgroup_subsys_state *css, struct cftype *cft, |
| 190 | const char *buffer) | 189 | const char *buffer) |
| 191 | { | 190 | { |
| 192 | struct cgroup_subsys_state *css = cgroup_css(cgrp, net_prio_subsys_id); | ||
| 193 | char devname[IFNAMSIZ + 1]; | 191 | char devname[IFNAMSIZ + 1]; |
| 194 | struct net_device *dev; | 192 | struct net_device *dev; |
| 195 | u32 prio; | 193 | u32 prio; |
diff --git a/net/ipv4/tcp_memcontrol.c b/net/ipv4/tcp_memcontrol.c index da14436c1735..8a57d79b0b16 100644 --- a/net/ipv4/tcp_memcontrol.c +++ b/net/ipv4/tcp_memcontrol.c | |||
| @@ -132,10 +132,10 @@ static int tcp_update_limit(struct mem_cgroup *memcg, u64 val) | |||
| 132 | return 0; | 132 | return 0; |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | static int tcp_cgroup_write(struct cgroup *cont, struct cftype *cft, | 135 | static int tcp_cgroup_write(struct cgroup_subsys_state *css, struct cftype *cft, |
| 136 | const char *buffer) | 136 | const char *buffer) |
| 137 | { | 137 | { |
| 138 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 138 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 139 | unsigned long long val; | 139 | unsigned long long val; |
| 140 | int ret = 0; | 140 | int ret = 0; |
| 141 | 141 | ||
| @@ -180,9 +180,9 @@ static u64 tcp_read_usage(struct mem_cgroup *memcg) | |||
| 180 | return res_counter_read_u64(&tcp->tcp_memory_allocated, RES_USAGE); | 180 | return res_counter_read_u64(&tcp->tcp_memory_allocated, RES_USAGE); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | static u64 tcp_cgroup_read(struct cgroup *cont, struct cftype *cft) | 183 | static u64 tcp_cgroup_read(struct cgroup_subsys_state *css, struct cftype *cft) |
| 184 | { | 184 | { |
| 185 | struct mem_cgroup *memcg = mem_cgroup_from_cont(cont); | 185 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
| 186 | u64 val; | 186 | u64 val; |
| 187 | 187 | ||
| 188 | switch (cft->private) { | 188 | switch (cft->private) { |
| @@ -202,13 +202,13 @@ static u64 tcp_cgroup_read(struct cgroup *cont, struct cftype *cft) | |||
| 202 | return val; | 202 | return val; |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | static int tcp_cgroup_reset(struct cgroup *cont, unsigned int event) | 205 | static int tcp_cgroup_reset(struct cgroup_subsys_state *css, unsigned int event) |
| 206 | { | 206 | { |
| 207 | struct mem_cgroup *memcg; | 207 | struct mem_cgroup *memcg; |
| 208 | struct tcp_memcontrol *tcp; | 208 | struct tcp_memcontrol *tcp; |
| 209 | struct cg_proto *cg_proto; | 209 | struct cg_proto *cg_proto; |
| 210 | 210 | ||
| 211 | memcg = mem_cgroup_from_cont(cont); | 211 | memcg = mem_cgroup_from_css(css); |
| 212 | cg_proto = tcp_prot.proto_cgroup(memcg); | 212 | cg_proto = tcp_prot.proto_cgroup(memcg); |
| 213 | if (!cg_proto) | 213 | if (!cg_proto) |
| 214 | return 0; | 214 | return 0; |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index dc3983835893..8ea1184cec92 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
| @@ -28,11 +28,6 @@ static inline struct cgroup_cls_state *css_cls_state(struct cgroup_subsys_state | |||
| 28 | return css ? container_of(css, struct cgroup_cls_state, css) : NULL; | 28 | return css ? container_of(css, struct cgroup_cls_state, css) : NULL; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | static inline struct cgroup_cls_state *cgrp_cls_state(struct cgroup *cgrp) | ||
| 32 | { | ||
| 33 | return css_cls_state(cgroup_css(cgrp, net_cls_subsys_id)); | ||
| 34 | } | ||
| 35 | |||
| 36 | static inline struct cgroup_cls_state *task_cls_state(struct task_struct *p) | 31 | static inline struct cgroup_cls_state *task_cls_state(struct task_struct *p) |
| 37 | { | 32 | { |
| 38 | return css_cls_state(task_css(p, net_cls_subsys_id)); | 33 | return css_cls_state(task_css(p, net_cls_subsys_id)); |
| @@ -87,14 +82,15 @@ static void cgrp_attach(struct cgroup_subsys_state *css, | |||
| 87 | } | 82 | } |
| 88 | } | 83 | } |
| 89 | 84 | ||
| 90 | static u64 read_classid(struct cgroup *cgrp, struct cftype *cft) | 85 | static u64 read_classid(struct cgroup_subsys_state *css, struct cftype *cft) |
| 91 | { | 86 | { |
| 92 | return cgrp_cls_state(cgrp)->classid; | 87 | return css_cls_state(css)->classid; |
| 93 | } | 88 | } |
| 94 | 89 | ||
| 95 | static int write_classid(struct cgroup *cgrp, struct cftype *cft, u64 value) | 90 | static int write_classid(struct cgroup_subsys_state *css, struct cftype *cft, |
| 91 | u64 value) | ||
| 96 | { | 92 | { |
| 97 | cgrp_cls_state(cgrp)->classid = (u32) value; | 93 | css_cls_state(css)->classid = (u32) value; |
| 98 | return 0; | 94 | return 0; |
| 99 | } | 95 | } |
| 100 | 96 | ||
diff --git a/security/device_cgroup.c b/security/device_cgroup.c index 7293ac49ba7b..e0ca464fa854 100644 --- a/security/device_cgroup.c +++ b/security/device_cgroup.c | |||
| @@ -289,10 +289,10 @@ static void set_majmin(char *str, unsigned m) | |||
| 289 | sprintf(str, "%u", m); | 289 | sprintf(str, "%u", m); |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | static int devcgroup_seq_read(struct cgroup *cgroup, struct cftype *cft, | 292 | static int devcgroup_seq_read(struct cgroup_subsys_state *css, |
| 293 | struct seq_file *m) | 293 | struct cftype *cft, struct seq_file *m) |
| 294 | { | 294 | { |
| 295 | struct dev_cgroup *devcgroup = cgroup_to_devcgroup(cgroup); | 295 | struct dev_cgroup *devcgroup = css_to_devcgroup(css); |
| 296 | struct dev_exception_item *ex; | 296 | struct dev_exception_item *ex; |
| 297 | char maj[MAJMINLEN], min[MAJMINLEN], acc[ACCLEN]; | 297 | char maj[MAJMINLEN], min[MAJMINLEN], acc[ACCLEN]; |
| 298 | 298 | ||
| @@ -669,13 +669,13 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, | |||
| 669 | return rc; | 669 | return rc; |
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | static int devcgroup_access_write(struct cgroup *cgrp, struct cftype *cft, | 672 | static int devcgroup_access_write(struct cgroup_subsys_state *css, |
| 673 | const char *buffer) | 673 | struct cftype *cft, const char *buffer) |
| 674 | { | 674 | { |
| 675 | int retval; | 675 | int retval; |
| 676 | 676 | ||
| 677 | mutex_lock(&devcgroup_mutex); | 677 | mutex_lock(&devcgroup_mutex); |
| 678 | retval = devcgroup_update_access(cgroup_to_devcgroup(cgrp), | 678 | retval = devcgroup_update_access(css_to_devcgroup(css), |
| 679 | cft->private, buffer); | 679 | cft->private, buffer); |
| 680 | mutex_unlock(&devcgroup_mutex); | 680 | mutex_unlock(&devcgroup_mutex); |
| 681 | return retval; | 681 | return retval; |
