linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Robert Love <rml@tech9.net>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	Linus Torvalds <torvalds@transmeta.com>,
	Andrew Morton <akpm@zip.com.au>, <ingo@redhat.com>,
	<linux-kernel@vger.kernel.org>, <trivial@rustcorp.com.au>
Subject: Re: [PATCH] de-xchg fork.c
Date: Mon, 23 Sep 2002 20:56:10 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0209232054140.32763-100000@localhost.localdomain> (raw)
In-Reply-To: <1032805833.25756.17.camel@phantasy>


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)


      reply	other threads:[~2002-09-23 18:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0209232054140.32763-100000@localhost.localdomain \
    --to=mingo@elte.hu \
    --cc=akpm@zip.com.au \
    --cc=ingo@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@tech9.net \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@transmeta.com \
    --cc=trivial@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).