Commit 94eda096 authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] de-xchg fork.c

This fixes all xchg()'s and a preemption bug.
parent 817fdd72
......@@ -62,13 +62,15 @@ void __put_task_struct(struct task_struct *tsk)
free_thread_info(tsk->thread_info);
kmem_cache_free(task_struct_cachep,tsk);
} else {
int cpu = smp_processor_id();
int cpu = get_cpu();
tsk = xchg(task_cache + cpu, tsk);
tsk = task_cache[cpu];
if (tsk) {
free_thread_info(tsk->thread_info);
kmem_cache_free(task_struct_cachep,tsk);
}
task_cache[cpu] = current;
put_cpu();
}
}
......@@ -126,8 +128,11 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
{
struct task_struct *tsk;
struct thread_info *ti;
int cpu = get_cpu();
tsk = xchg(task_cache + smp_processor_id(), NULL);
tsk = task_cache[cpu];
task_cache[cpu] = NULL;
put_cpu();
if (!tsk) {
ti = alloc_thread_info();
if (!ti)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment