linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] de-xchg fork.c
@ 2002-09-23  1:06 Rusty Russell
  2002-09-22  0:48 ` Pavel Machek
  2002-09-23 18:31 ` Ingo Molnar
  0 siblings, 2 replies; 5+ messages in thread
From: Rusty Russell @ 2002-09-23  1:06 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, ingo, linux-kernel, trivial

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.

Hey, at least it wasn't:
	if (likely(tsk = xchg(task_cache + cpu, tsk))) {

Cheers,
Rusty.

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;
 	}
 }
 

--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-09-24 20:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-23  1:06 [PATCH] de-xchg fork.c Rusty Russell
2002-09-22  0:48 ` Pavel Machek
2002-09-23 18:31 ` Ingo Molnar
2002-09-23 18:30   ` Robert Love
2002-09-23 18:56     ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).