Re: [PATCH] de-xchg fork.c

From: Ingo Molnar (mingo@elte.hu)
Date: Mon Sep 23 2002 - 13:56:10 EST


On 23 Sep 2002, Robert Love wrote:

> > + task_cache[cpu] = current;
> > }
> > }
>
> I think you need get/put_cpu() here, too?

you are right - new patch attached.

        Ingo

--- linux/kernel/fork.c.orig Mon Sep 23 20:28:36 2002
+++ linux/kernel/fork.c Mon Sep 23 20:55:08 2002
@@ -62,13 +62,15 @@
                 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 @@
 {
         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)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Sep 23 2002 - 22:00:39 EST