mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-04 05:11:46 +00:00
sched: Fix race in task_group()
Stefan reported a crash on a kernel before a3e5d1091c
("sched:
Don't call task_group() too many times in set_task_rq()"), he
found the reason to be that the multiple task_group()
invocations in set_task_rq() returned different values.
Looking at all that I found a lack of serialization and plain
wrong comments.
The below tries to fix it using an extra pointer which is
updated under the appropriate scheduler locks. Its not pretty,
but I can't really see another way given how all the cgroup
stuff works.
Reported-and-tested-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1340364965.18025.71.camel@twins
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
88b8dac0a1
commit
8323f26ce3
4 changed files with 33 additions and 16 deletions
|
@ -123,8 +123,17 @@ extern struct group_info init_groups;
|
|||
|
||||
extern struct cred init_cred;
|
||||
|
||||
extern struct task_group root_task_group;
|
||||
|
||||
#ifdef CONFIG_CGROUP_SCHED
|
||||
# define INIT_CGROUP_SCHED(tsk) \
|
||||
.sched_task_group = &root_task_group,
|
||||
#else
|
||||
# define INIT_CGROUP_SCHED(tsk)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PERF_EVENTS
|
||||
# define INIT_PERF_EVENTS(tsk) \
|
||||
# define INIT_PERF_EVENTS(tsk) \
|
||||
.perf_event_mutex = \
|
||||
__MUTEX_INITIALIZER(tsk.perf_event_mutex), \
|
||||
.perf_event_list = LIST_HEAD_INIT(tsk.perf_event_list),
|
||||
|
@ -161,6 +170,7 @@ extern struct cred init_cred;
|
|||
}, \
|
||||
.tasks = LIST_HEAD_INIT(tsk.tasks), \
|
||||
INIT_PUSHABLE_TASKS(tsk) \
|
||||
INIT_CGROUP_SCHED(tsk) \
|
||||
.ptraced = LIST_HEAD_INIT(tsk.ptraced), \
|
||||
.ptrace_entry = LIST_HEAD_INIT(tsk.ptrace_entry), \
|
||||
.real_parent = &tsk, \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue