Cc: stable@vger.kernel.org # v5.17+
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- kernel/cgroup/cgroup.c | 77 +++++++++++++++++++++++++++++-------------
- kernel/cgroup/cpuset.c | 3 +-
- 2 files changed, 55 insertions(+), 25 deletions(-)
+ kernel/cgroup/cgroup.c | 78 ++++++++++++++++++++++++++++++++++---------------
+ kernel/cgroup/cpuset.c | 3 -
+ 2 files changed, 56 insertions(+), 25 deletions(-)
-diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
-index c2af09b4bca62..43f9bfedd890c 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
-@@ -2376,6 +2376,47 @@ int task_cgroup_path(struct task_struct *task, char *buf, size_t buflen)
- }
+@@ -30,6 +30,7 @@
+
+ #include "cgroup-internal.h"
+
++#include <linux/cpu.h>
+ #include <linux/cred.h>
+ #include <linux/errno.h>
+ #include <linux/init_task.h>
+@@ -2377,6 +2378,47 @@ int task_cgroup_path(struct task_struct
EXPORT_SYMBOL_GPL(task_cgroup_path);
-+/**
+ /**
+ * cgroup_attach_lock - Lock for ->attach()
+ * @lock_threadgroup: whether to down_write cgroup_threadgroup_rwsem
+ *
+ cpus_read_unlock();
+}
+
- /**
++/**
* cgroup_migrate_add_task - add a migration target task to a migration context
* @task: target task
-@@ -2857,8 +2898,7 @@ int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader,
+ * @mgctx: target migration context
+@@ -2857,8 +2899,7 @@ int cgroup_attach_task(struct cgroup *ds
}
struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup,
{
struct task_struct *tsk;
pid_t pid;
-@@ -2875,12 +2915,8 @@ struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup,
+@@ -2875,12 +2916,8 @@ struct task_struct *cgroup_procs_write_s
* Therefore, we can skip the global lock.
*/
lockdep_assert_held(&cgroup_mutex);
rcu_read_lock();
if (pid) {
-@@ -2911,17 +2947,14 @@ struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup,
+@@ -2911,17 +2948,14 @@ struct task_struct *cgroup_procs_write_s
goto out_unlock_rcu;
out_unlock_threadgroup:
{
struct cgroup_subsys *ss;
int ssid;
-@@ -2929,8 +2962,8 @@ void cgroup_procs_write_finish(struct task_struct *task, bool locked)
+@@ -2929,8 +2963,8 @@ void cgroup_procs_write_finish(struct ta
/* release reference from cgroup_procs_write_start() */
put_task_struct(task);
for_each_subsys(ss, ssid)
if (ss->post_attach)
ss->post_attach();
-@@ -3007,8 +3040,7 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
+@@ -3007,8 +3041,7 @@ static int cgroup_update_dfl_csses(struc
* write-locking can be skipped safely.
*/
has_tasks = !list_empty(&mgctx.preloaded_src_csets);
/* NULL dst indicates self on default hierarchy */
ret = cgroup_migrate_prepare_dst(&mgctx);
-@@ -3029,8 +3061,7 @@ static int cgroup_update_dfl_csses(struct cgroup *cgrp)
+@@ -3029,8 +3062,7 @@ static int cgroup_update_dfl_csses(struc
ret = cgroup_migrate_execute(&mgctx);
out_finish:
cgroup_migrate_finish(&mgctx);
return ret;
}
-@@ -4859,13 +4890,13 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of,
+@@ -4859,13 +4891,13 @@ static ssize_t cgroup_procs_write(struct
struct task_struct *task;
const struct cred *saved_cred;
ssize_t ret;
ret = PTR_ERR_OR_ZERO(task);
if (ret)
goto out_unlock;
-@@ -4891,7 +4922,7 @@ static ssize_t cgroup_procs_write(struct kernfs_open_file *of,
+@@ -4891,7 +4923,7 @@ static ssize_t cgroup_procs_write(struct
ret = cgroup_attach_task(dst_cgrp, task, true);
out_finish:
out_unlock:
cgroup_kn_unlock(of->kn);
-diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
-index b02eca235ba3f..9ba94a9a67aa4 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
-@@ -2204,7 +2204,7 @@ static void cpuset_attach(struct cgroup_taskset *tset)
+@@ -2204,7 +2204,7 @@ static void cpuset_attach(struct cgroup_
cgroup_taskset_first(tset, &css);
cs = css_cs(css);
percpu_down_write(&cpuset_rwsem);
/* prepare for attach */
-@@ -2260,7 +2260,6 @@ static void cpuset_attach(struct cgroup_taskset *tset)
+@@ -2260,7 +2260,6 @@ static void cpuset_attach(struct cgroup_
wake_up(&cpuset_attach_wq);
percpu_up_write(&cpuset_rwsem);
}
/* The various types of files and directories in a cpuset file system */
---
-2.35.1
-