lkml.org 
[lkml]   [2002]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] de-xchg fork.c
Hi!

> Don't know who put this in for 2.5.38.
>
> I realize that using xchg() makes you 'leet. But doing an atomic op
> where none is required is suboptimal and confusing.

Well, atomic op is also more expensive. i think ingo did this. Ingo, is
patch below safe? It is faster *and* it works on 386.
Pavel

> diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.38/kernel/fork.c working-2.5.38-unxchg/kernel/fork.c
> --- linux-2.5.38/kernel/fork.c 2002-09-21 13:55:19.000000000 +1000
> +++ working-2.5.38-unxchg/kernel/fork.c 2002-09-23 11:00:31.000000000 +1000
> @@ -64,11 +64,12 @@ void __put_task_struct(struct task_struc
> } else {
> int cpu = smp_processor_id();
>
> - 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;
> }
> }

--
Philips Velo 1: 1"x4"x8", 300gram, 60, 12MB, 40bogomips, linux, mutt,
details at http://atrey.karlin.mff.cuni.cz/~pavel/velo/index.html.

-
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/

\
 
 \ /
  Last update: 2005-03-22 13:29    [W:0.045 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site