提交 82a543fe 编写于 作者: Z Zhang Qiao 提交者: Yongqiang Liu

Revert "sched: Fix yet more sched_fork() races"

hulk inclusion
category: bugfix
bugzilla: 186973, https://gitee.com/openeuler/kernel/issues/I5CA6K
CVE: NA

--------------------------------

This reverts commit af98db5f.
the patch af98db5f("sched: Fix yet more sched_fork()") may
be cause a process sleep at cgroup_post_fork()->freezer_fork()
while taking group_threadgroup_rwsem lock long time, it cause
a problem that other tasks will wait while fork child process
and the system will stall.
Signed-off-by: NZhang Qiao <zhangqiao22@huawei.com>
Reviewed-by: NChen Hui <judy.chenhui@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 ae7a0c91
...@@ -33,7 +33,7 @@ extern asmlinkage void schedule_tail(struct task_struct *prev); ...@@ -33,7 +33,7 @@ extern asmlinkage void schedule_tail(struct task_struct *prev);
extern void init_idle(struct task_struct *idle, int cpu); extern void init_idle(struct task_struct *idle, int cpu);
extern int sched_fork(unsigned long clone_flags, struct task_struct *p); extern int sched_fork(unsigned long clone_flags, struct task_struct *p);
extern void sched_cgroup_fork(struct task_struct *p); extern void sched_post_fork(struct task_struct *p);
extern void sched_dead(struct task_struct *p); extern void sched_dead(struct task_struct *p);
void __noreturn do_task_dead(void); void __noreturn do_task_dead(void);
......
...@@ -2063,17 +2063,6 @@ static __latent_entropy struct task_struct *copy_process( ...@@ -2063,17 +2063,6 @@ static __latent_entropy struct task_struct *copy_process(
if (retval) if (retval)
goto bad_fork_free_futex_mutex; goto bad_fork_free_futex_mutex;
/*
* Now that the cgroups are pinned, re-clone the parent cgroup and put
* the new task on the correct runqueue. All this *before* the task
* becomes visible.
*
* This isn't part of ->can_fork() because while the re-cloning is
* cgroup specific, it unconditionally needs to place the task on a
* runqueue.
*/
sched_cgroup_fork(p);
/* /*
* From this point on we must avoid any synchronous user-space * From this point on we must avoid any synchronous user-space
* communication until we take the tasklist-lock. In particular, we do * communication until we take the tasklist-lock. In particular, we do
...@@ -2182,6 +2171,7 @@ static __latent_entropy struct task_struct *copy_process( ...@@ -2182,6 +2171,7 @@ static __latent_entropy struct task_struct *copy_process(
proc_fork_connector(p); proc_fork_connector(p);
cgroup_post_fork(p); cgroup_post_fork(p);
sched_post_fork(p);
cgroup_threadgroup_change_end(current); cgroup_threadgroup_change_end(current);
perf_event_fork(p); perf_event_fork(p);
......
...@@ -2357,9 +2357,8 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p) ...@@ -2357,9 +2357,8 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p)
return 0; return 0;
} }
void sched_cgroup_fork(struct task_struct *p) void sched_post_fork(struct task_struct *p)
{ {
unsigned long flags; unsigned long flags;
/* /*
...@@ -2370,9 +2369,6 @@ void sched_cgroup_fork(struct task_struct *p) ...@@ -2370,9 +2369,6 @@ void sched_cgroup_fork(struct task_struct *p)
* Silence PROVE_RCU. * Silence PROVE_RCU.
*/ */
raw_spin_lock_irqsave(&p->pi_lock, flags); raw_spin_lock_irqsave(&p->pi_lock, flags);
#ifdef CONFIG_CGROUP_SCHED
p->sched_task_group = task_group(current);
#endif
rseq_migrate(p); rseq_migrate(p);
/* /*
* We're setting the CPU for the first time, we don't migrate, * We're setting the CPU for the first time, we don't migrate,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册