From b0ea1feeefe084d787ebbd2de78441f4c896fa9e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 29 Aug 2022 13:09:11 +0200 Subject: [PATCH] Revert "ANDROID: cgroup: Add android_rvh_cgroup_force_kthread_migration" This reverts commit d4f032e36b84cba331ff9b5e16aa4d447c44391a as it causes merge conflicts in 6.0-rc2. If it is still needed in an Android kernel release, it can be added back into a release-specific branch at a later point in time. Bug: 184594949 Cc: Pavankumar Kondeti Cc: Shaleen Agrawal Signed-off-by: Greg Kroah-Hartman Change-Id: I5d2ff43a1e4e14308c41cfd5d2d752836a134ae0 --- drivers/android/vendor_hooks.c | 1 - include/trace/hooks/cgroup.h | 3 --- kernel/cgroup/cgroup-internal.h | 3 +-- kernel/cgroup/cgroup-v1.c | 2 +- kernel/cgroup/cgroup.c | 11 +++-------- 5 files changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 4b8b2735f2ad..7a9858df90cf 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -110,7 +110,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ptype_head); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_allow_domain_state); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_enter); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpuidle_psci_exit); -EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cgroup_force_kthread_migration); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_tick); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_check_preempt_wakeup_ignore); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_replace_next_task_fair); diff --git a/include/trace/hooks/cgroup.h b/include/trace/hooks/cgroup.h index 95d271f1638c..75521077bfc6 100644 --- a/include/trace/hooks/cgroup.h +++ b/include/trace/hooks/cgroup.h @@ -17,9 +17,6 @@ struct cgroup_taskset; DECLARE_HOOK(android_vh_cgroup_attach, TP_PROTO(struct cgroup_subsys *ss, struct cgroup_taskset *tset), TP_ARGS(ss, tset)) -DECLARE_RESTRICTED_HOOK(android_rvh_cgroup_force_kthread_migration, - TP_PROTO(struct task_struct *tsk, struct cgroup *dst_cgrp, bool *force_migration), - TP_ARGS(tsk, dst_cgrp, force_migration), 1); #endif #include diff --git a/kernel/cgroup/cgroup-internal.h b/kernel/cgroup/cgroup-internal.h index 0c1f127a3044..36b740cb3d59 100644 --- a/kernel/cgroup/cgroup-internal.h +++ b/kernel/cgroup/cgroup-internal.h @@ -251,8 +251,7 @@ int cgroup_migrate(struct task_struct *leader, bool threadgroup, int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader, bool threadgroup); struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, - bool *locked, - struct cgroup *dst_cgrp); + bool *locked) __acquires(&cgroup_threadgroup_rwsem); void cgroup_procs_write_finish(struct task_struct *task, bool locked) __releases(&cgroup_threadgroup_rwsem); diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index 412fc16981bf..4f2e1c7998d4 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -501,7 +501,7 @@ static ssize_t __cgroup1_procs_write(struct kernfs_open_file *of, if (!cgrp) return -ENODEV; - task = cgroup_procs_write_start(buf, threadgroup, &locked, cgrp); + task = cgroup_procs_write_start(buf, threadgroup, &locked); ret = PTR_ERR_OR_ZERO(task); if (ret) goto out_unlock; diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index d2857b3c7c48..864a6236aa97 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -2847,13 +2847,11 @@ int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader, } struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, - bool *locked, - struct cgroup *dst_cgrp) + bool *locked) __acquires(&cgroup_threadgroup_rwsem) { struct task_struct *tsk; pid_t pid; - bool force_migration = false; if (kstrtoint(strstrip(buf), 0, &pid) || pid < 0) return ERR_PTR(-EINVAL); @@ -2888,16 +2886,13 @@ struct task_struct *cgroup_procs_write_start(char *buf, bool threadgroup, if (threadgroup) tsk = tsk->group_leader; - if (tsk->flags & PF_KTHREAD) - trace_android_rvh_cgroup_force_kthread_migration(tsk, dst_cgrp, &force_migration); - /* * kthreads may acquire PF_NO_SETAFFINITY during initialization. * If userland migrates such a kthread to a non-root cgroup, it can * become trapped in a cpuset, or RT kthread may be born in a * cgroup with no rt_runtime allocated. Just say no. */ - if (!force_migration && (tsk->no_cgroup_migration || (tsk->flags & PF_NO_SETAFFINITY))) { + if (tsk->no_cgroup_migration || (tsk->flags & PF_NO_SETAFFINITY)) { tsk = ERR_PTR(-EINVAL); goto out_unlock_threadgroup; } @@ -4989,7 +4984,7 @@ static ssize_t __cgroup_procs_write(struct kernfs_open_file *of, char *buf, if (!dst_cgrp) return -ENODEV; - task = cgroup_procs_write_start(buf, threadgroup, &locked, dst_cgrp); + task = cgroup_procs_write_start(buf, threadgroup, &locked); ret = PTR_ERR_OR_ZERO(task); if (ret) goto out_unlock;