public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roger Larsson <roger.larsson@norran.net>
To: Robert Love <rml@tech9.net>, Linus Torvalds <torvalds@transmeta.com>
Cc: Dave Hansen <haveblue@us.ibm.com>,
	"Adam J. Richter" <adam@yggdrasil.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() at boot time
Date: Thu, 4 Apr 2002 23:34:04 +0200	[thread overview]
Message-ID: <200204042334.04367.roger.larsson@norran.net> (raw)
In-Reply-To: <Pine.LNX.4.33.0204041113410.12895-100000@penguin.transmeta.com> <1017948383.22303.537.camel@phantasy>

On torsdagen den 4 april 2002 21.26, Robert Love wrote:
> On Thu, 2002-04-04 at 14:14, Linus Torvalds wrote:
> > The answer is that preempt_schedule() illegally sets
> >
> > 	current->state = TASK_RUNNING;
> >
> > without asking the process whether that's OK. The SMP code never does
> > anything like that.
>
> Well Ingo added that ;)
>
> We used to just set a flag in the preempt_count that marked the task as
> preempted and made sure on its next trip into schedule it ran again.
>

How about doing:

asmlinkage void preempt_schedule(void)
{
	unsigned long saved_state;

	if (unlikely(preempt_get_count()))
		return;

	preempt_disable(); /* or use an atomic operation */
	saved_state = current->state;
	current->state = TASK_RUNNING;
	preempt_enable_no_resched(); /* we are scheduling anyway... */
	schedule();
	current->state = saved_state;
}

It is unlikely to get preemption between schedule() and the
setting since schedule it self checks - the window is small.
And when it hits if will correctly restore the correct value.

Note this code does not need to solve the FLAG problem.

	 current->state |= FLAG
	* PREEMPT *
		current->state |= FLAG
		schedule()
		current->state &= ~FLAG
	schedule() with flag disabled


/RogerL

-- 
Roger Larsson
Skellefteå
Sweden


  parent reply	other threads:[~2002-04-04 21:33 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-04 11:59 Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() at boot time Adam J. Richter
2002-04-04 12:56 ` Stelian Pop
2002-04-04 13:40   ` Alessandro Suardi
2002-04-04 16:23 ` David C. Hansen
2002-04-04 18:28   ` Dave Hansen
2002-04-04 18:51     ` Robert Love
2002-04-04 19:14       ` Linus Torvalds
2002-04-04 19:26         ` Robert Love
2002-04-04 19:41           ` Dave Hansen
2002-04-04 20:02             ` Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() atboot time george anzinger
2002-04-04 20:54           ` Andrew Morton
2002-04-04 21:34           ` Roger Larsson [this message]
2002-04-04 22:38             ` Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() at boot time Andrew Morton
2002-04-04 22:42               ` Linus Torvalds
2002-04-04 22:54                 ` Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() atboot time Andrew Morton
2002-04-04 23:07                 ` Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() at boot time Robert Love
2002-04-04 23:42                   ` Linus Torvalds
2002-04-04 23:47                     ` Robert Love
2002-04-04 23:55                       ` Linus Torvalds
2002-04-05  0:03                         ` [PATCH] preemptive kernel behavior change: don't be rude Robert Love
2002-04-05  1:51                           ` george anzinger
2002-04-05  2:06                             ` Robert Love
2002-04-04 22:55               ` Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() at boot time Robert Love
2002-04-04 23:10                 ` Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() atboot time Andrew Morton
2002-04-04 23:16                   ` Robert Love
2002-04-04 19:13     ` Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() at boot time Linus Torvalds
2002-04-04 19:16       ` Robert Love
2002-04-04 19:45         ` Linus Torvalds
2002-04-04 20:09           ` Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() atboot time george anzinger
2002-04-04 19:48       ` george anzinger

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=200204042334.04367.roger.larsson@norran.net \
    --to=roger.larsson@norran.net \
    --cc=adam@yggdrasil.com \
    --cc=haveblue@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@tech9.net \
    --cc=torvalds@transmeta.com \
    /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