diff options
-rw-r--r-- | block/blk-cgroup.c | 2 | ||||
-rw-r--r-- | include/linux/cgroup.h | 12 | ||||
-rw-r--r-- | kernel/cgroup.c | 16 | ||||
-rw-r--r-- | kernel/cgroup_freezer.c | 2 | ||||
-rw-r--r-- | kernel/cpuset.c | 15 | ||||
-rw-r--r-- | kernel/events/core.c | 2 | ||||
-rw-r--r-- | kernel/sched/core.c | 4 | ||||
-rw-r--r-- | net/core/netprio_cgroup.c | 2 | ||||
-rw-r--r-- | net/sched/cls_cgroup.c | 2 |
9 files changed, 28 insertions, 29 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 4b40640240a4..54ad00292edf 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -891,7 +891,7 @@ static int blkcg_can_attach(struct cgroup_subsys_state *css, | |||
891 | int ret = 0; | 891 | int ret = 0; |
892 | 892 | ||
893 | /* task_lock() is needed to avoid races with exit_io_context() */ | 893 | /* task_lock() is needed to avoid races with exit_io_context() */ |
894 | cgroup_taskset_for_each(task, css->cgroup, tset) { | 894 | cgroup_taskset_for_each(task, css, tset) { |
895 | task_lock(task); | 895 | task_lock(task); |
896 | ioc = task->io_context; | 896 | ioc = task->io_context; |
897 | if (ioc && atomic_read(&ioc->nr_tasks) > 1) | 897 | if (ioc && atomic_read(&ioc->nr_tasks) > 1) |
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index b065d24486e6..d9a970568be9 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h | |||
@@ -562,20 +562,22 @@ int cgroup_task_count(const struct cgroup *cgrp); | |||
562 | struct cgroup_taskset; | 562 | struct cgroup_taskset; |
563 | struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset); | 563 | struct task_struct *cgroup_taskset_first(struct cgroup_taskset *tset); |
564 | struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset); | 564 | struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset); |
565 | struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset); | 565 | struct cgroup_subsys_state *cgroup_taskset_cur_css(struct cgroup_taskset *tset, |
566 | int subsys_id); | ||
566 | int cgroup_taskset_size(struct cgroup_taskset *tset); | 567 | int cgroup_taskset_size(struct cgroup_taskset *tset); |
567 | 568 | ||
568 | /** | 569 | /** |
569 | * cgroup_taskset_for_each - iterate cgroup_taskset | 570 | * cgroup_taskset_for_each - iterate cgroup_taskset |
570 | * @task: the loop cursor | 571 | * @task: the loop cursor |
571 | * @skip_cgrp: skip if task's cgroup matches this, %NULL to iterate through all | 572 | * @skip_css: skip if task's css matches this, %NULL to iterate through all |
572 | * @tset: taskset to iterate | 573 | * @tset: taskset to iterate |
573 | */ | 574 | */ |
574 | #define cgroup_taskset_for_each(task, skip_cgrp, tset) \ | 575 | #define cgroup_taskset_for_each(task, skip_css, tset) \ |
575 | for ((task) = cgroup_taskset_first((tset)); (task); \ | 576 | for ((task) = cgroup_taskset_first((tset)); (task); \ |
576 | (task) = cgroup_taskset_next((tset))) \ | 577 | (task) = cgroup_taskset_next((tset))) \ |
577 | if (!(skip_cgrp) || \ | 578 | if (!(skip_css) || \ |
578 | cgroup_taskset_cur_cgroup((tset)) != (skip_cgrp)) | 579 | cgroup_taskset_cur_css((tset), \ |
580 | (skip_css)->ss->subsys_id) != (skip_css)) | ||
579 | 581 | ||
580 | /* | 582 | /* |
581 | * Control Group subsystem type. | 583 | * Control Group subsystem type. |
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index a71f2e0f9711..e5bfb2a81dcb 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -1907,18 +1907,20 @@ struct task_struct *cgroup_taskset_next(struct cgroup_taskset *tset) | |||
1907 | EXPORT_SYMBOL_GPL(cgroup_taskset_next); | 1907 | EXPORT_SYMBOL_GPL(cgroup_taskset_next); |
1908 | 1908 | ||
1909 | /** | 1909 | /** |
1910 | * cgroup_taskset_cur_cgroup - return the matching cgroup for the current task | 1910 | * cgroup_taskset_cur_css - return the matching css for the current task |
1911 | * @tset: taskset of interest | 1911 | * @tset: taskset of interest |
1912 | * @subsys_id: the ID of the target subsystem | ||
1912 | * | 1913 | * |
1913 | * Return the cgroup for the current (last returned) task of @tset. This | 1914 | * Return the css for the current (last returned) task of @tset for |
1914 | * function must be preceded by either cgroup_taskset_first() or | 1915 | * subsystem specified by @subsys_id. This function must be preceded by |
1915 | * cgroup_taskset_next(). | 1916 | * either cgroup_taskset_first() or cgroup_taskset_next(). |
1916 | */ | 1917 | */ |
1917 | struct cgroup *cgroup_taskset_cur_cgroup(struct cgroup_taskset *tset) | 1918 | struct cgroup_subsys_state *cgroup_taskset_cur_css(struct cgroup_taskset *tset, |
1919 | int subsys_id) | ||
1918 | { | 1920 | { |
1919 | return tset->cur_cgrp; | 1921 | return cgroup_css(tset->cur_cgrp, subsys_id); |
1920 | } | 1922 | } |
1921 | EXPORT_SYMBOL_GPL(cgroup_taskset_cur_cgroup); | 1923 | EXPORT_SYMBOL_GPL(cgroup_taskset_cur_css); |
1922 | 1924 | ||
1923 | /** | 1925 | /** |
1924 | * cgroup_taskset_size - return the number of tasks in taskset | 1926 | * cgroup_taskset_size - return the number of tasks in taskset |
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index 5cd2b6d55243..224da9aa27f5 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c | |||
@@ -189,7 +189,7 @@ static void freezer_attach(struct cgroup_subsys_state *new_css, | |||
189 | * current state before executing the following - !frozen tasks may | 189 | * current state before executing the following - !frozen tasks may |
190 | * be visible in a FROZEN cgroup and frozen tasks in a THAWED one. | 190 | * be visible in a FROZEN cgroup and frozen tasks in a THAWED one. |
191 | */ | 191 | */ |
192 | cgroup_taskset_for_each(task, new_css->cgroup, tset) { | 192 | cgroup_taskset_for_each(task, new_css, tset) { |
193 | if (!(freezer->state & CGROUP_FREEZING)) { | 193 | if (!(freezer->state & CGROUP_FREEZING)) { |
194 | __thaw_task(task); | 194 | __thaw_task(task); |
195 | } else { | 195 | } else { |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 39e52175f4af..bf69717325b4 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -119,12 +119,6 @@ static inline struct cpuset *css_cs(struct cgroup_subsys_state *css) | |||
119 | return css ? container_of(css, struct cpuset, css) : NULL; | 119 | return css ? container_of(css, struct cpuset, css) : NULL; |
120 | } | 120 | } |
121 | 121 | ||
122 | /* Retrieve the cpuset for a cgroup */ | ||
123 | static inline struct cpuset *cgroup_cs(struct cgroup *cgrp) | ||
124 | { | ||
125 | return css_cs(cgroup_css(cgrp, cpuset_subsys_id)); | ||
126 | } | ||
127 | |||
128 | /* Retrieve the cpuset for a task */ | 122 | /* Retrieve the cpuset for a task */ |
129 | static inline struct cpuset *task_cs(struct task_struct *task) | 123 | static inline struct cpuset *task_cs(struct task_struct *task) |
130 | { | 124 | { |
@@ -1459,7 +1453,7 @@ static int cpuset_can_attach(struct cgroup_subsys_state *css, | |||
1459 | (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))) | 1453 | (cpumask_empty(cs->cpus_allowed) || nodes_empty(cs->mems_allowed))) |
1460 | goto out_unlock; | 1454 | goto out_unlock; |
1461 | 1455 | ||
1462 | cgroup_taskset_for_each(task, css->cgroup, tset) { | 1456 | cgroup_taskset_for_each(task, css, tset) { |
1463 | /* | 1457 | /* |
1464 | * Kthreads which disallow setaffinity shouldn't be moved | 1458 | * Kthreads which disallow setaffinity shouldn't be moved |
1465 | * to a new cpuset; we don't want to change their cpu | 1459 | * to a new cpuset; we don't want to change their cpu |
@@ -1511,9 +1505,10 @@ static void cpuset_attach(struct cgroup_subsys_state *css, | |||
1511 | struct mm_struct *mm; | 1505 | struct mm_struct *mm; |
1512 | struct task_struct *task; | 1506 | struct task_struct *task; |
1513 | struct task_struct *leader = cgroup_taskset_first(tset); | 1507 | struct task_struct *leader = cgroup_taskset_first(tset); |
1514 | struct cgroup *oldcgrp = cgroup_taskset_cur_cgroup(tset); | 1508 | struct cgroup_subsys_state *oldcss = cgroup_taskset_cur_css(tset, |
1509 | cpuset_subsys_id); | ||
1515 | struct cpuset *cs = css_cs(css); | 1510 | struct cpuset *cs = css_cs(css); |
1516 | struct cpuset *oldcs = cgroup_cs(oldcgrp); | 1511 | struct cpuset *oldcs = css_cs(oldcss); |
1517 | struct cpuset *cpus_cs = effective_cpumask_cpuset(cs); | 1512 | struct cpuset *cpus_cs = effective_cpumask_cpuset(cs); |
1518 | struct cpuset *mems_cs = effective_nodemask_cpuset(cs); | 1513 | struct cpuset *mems_cs = effective_nodemask_cpuset(cs); |
1519 | 1514 | ||
@@ -1527,7 +1522,7 @@ static void cpuset_attach(struct cgroup_subsys_state *css, | |||
1527 | 1522 | ||
1528 | guarantee_online_mems(mems_cs, &cpuset_attach_nodemask_to); | 1523 | guarantee_online_mems(mems_cs, &cpuset_attach_nodemask_to); |
1529 | 1524 | ||
1530 | cgroup_taskset_for_each(task, css->cgroup, tset) { | 1525 | cgroup_taskset_for_each(task, css, tset) { |
1531 | /* | 1526 | /* |
1532 | * can_attach beforehand should guarantee that this doesn't | 1527 | * can_attach beforehand should guarantee that this doesn't |
1533 | * fail. TODO: have a better way to handle failure here | 1528 | * fail. TODO: have a better way to handle failure here |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 9705a0ed1dce..c199c4f24910 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -7816,7 +7816,7 @@ static void perf_cgroup_attach(struct cgroup_subsys_state *css, | |||
7816 | { | 7816 | { |
7817 | struct task_struct *task; | 7817 | struct task_struct *task; |
7818 | 7818 | ||
7819 | cgroup_taskset_for_each(task, css->cgroup, tset) | 7819 | cgroup_taskset_for_each(task, css, tset) |
7820 | task_function_call(task, __perf_cgroup_move, task); | 7820 | task_function_call(task, __perf_cgroup_move, task); |
7821 | } | 7821 | } |
7822 | 7822 | ||
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index cc9a49266382..a7122d5b8310 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -7135,7 +7135,7 @@ static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css, | |||
7135 | { | 7135 | { |
7136 | struct task_struct *task; | 7136 | struct task_struct *task; |
7137 | 7137 | ||
7138 | cgroup_taskset_for_each(task, css->cgroup, tset) { | 7138 | cgroup_taskset_for_each(task, css, tset) { |
7139 | #ifdef CONFIG_RT_GROUP_SCHED | 7139 | #ifdef CONFIG_RT_GROUP_SCHED |
7140 | if (!sched_rt_can_attach(css_tg(css), task)) | 7140 | if (!sched_rt_can_attach(css_tg(css), task)) |
7141 | return -EINVAL; | 7141 | return -EINVAL; |
@@ -7153,7 +7153,7 @@ static void cpu_cgroup_attach(struct cgroup_subsys_state *css, | |||
7153 | { | 7153 | { |
7154 | struct task_struct *task; | 7154 | struct task_struct *task; |
7155 | 7155 | ||
7156 | cgroup_taskset_for_each(task, css->cgroup, tset) | 7156 | cgroup_taskset_for_each(task, css, tset) |
7157 | sched_move_task(task); | 7157 | sched_move_task(task); |
7158 | } | 7158 | } |
7159 | 7159 | ||
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c index e00f60e5baea..d9cd627e6a16 100644 --- a/net/core/netprio_cgroup.c +++ b/net/core/netprio_cgroup.c | |||
@@ -224,7 +224,7 @@ static void net_prio_attach(struct cgroup_subsys_state *css, | |||
224 | struct task_struct *p; | 224 | struct task_struct *p; |
225 | void *v; | 225 | void *v; |
226 | 226 | ||
227 | cgroup_taskset_for_each(p, css->cgroup, tset) { | 227 | cgroup_taskset_for_each(p, css, tset) { |
228 | task_lock(p); | 228 | task_lock(p); |
229 | v = (void *)(unsigned long)task_netprioidx(p); | 229 | v = (void *)(unsigned long)task_netprioidx(p); |
230 | iterate_fd(p->files, 0, update_netprio, v); | 230 | iterate_fd(p->files, 0, update_netprio, v); |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index 8ea1184cec92..867b4a3e3980 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -74,7 +74,7 @@ static void cgrp_attach(struct cgroup_subsys_state *css, | |||
74 | struct task_struct *p; | 74 | struct task_struct *p; |
75 | void *v; | 75 | void *v; |
76 | 76 | ||
77 | cgroup_taskset_for_each(p, css->cgroup, tset) { | 77 | cgroup_taskset_for_each(p, css, tset) { |
78 | task_lock(p); | 78 | task_lock(p); |
79 | v = (void *)(unsigned long)task_cls_classid(p); | 79 | v = (void *)(unsigned long)task_cls_classid(p); |
80 | iterate_fd(p->files, 0, update_classid, v); | 80 | iterate_fd(p->files, 0, update_classid, v); |