From: Jun Sun <jsun@mvista.com>
To: linux-kernel@vger.kernel.org
Subject: [Fwd: lost need_resched flag re-introduced?]
Date: Wed, 06 Dec 2000 17:13:16 -0800 [thread overview]
Message-ID: <3A2EE42C.F59317E9@mvista.com> (raw)
I did not get reply from Linus. Now try my luck with the kernel mailing
list. Please cc your reply to my email account. I stopped watching the
mailing list anymore.
Thanks.
Jun
Jun Sun wrote:
>
> Linus,
>
> A while back I reported the lost need_resched flag bug ( it happens if
> need_resched is set right before switch_to() is called). Later on a one-line
> fix is added to __schedule_tail().
>
> current->need_resched |= prev->need_resched;
>
> I looked at the latest kernel and found this one is gone. Is the lost
> need_resched problem taken care of in some other way? Or is it re-introduced?
>
> In any case, I was going to propose a minor fix over the original one-line
> fix. See the patch below.
>
> On RISC machines, the original fix leaves a small window for setting the wrong
> flag. A pseudo assembly code for the original fix is shown as follows:
>
> 1. load current->need_resched to R1
> 2. load prev->need_resched to R2
> 3. R1 = R1 | R2
> 4. store R1 to current->need_resched
>
> If at 1) both need_resched flags are 0, and an interrupt happens between 1)
> and 4), which sets current->resched to 1, we will have wrong result for
> current->need_resched after step 4).
>
> Jun
>
> inux/kernel/sched.c: 1.1 1.2 jsun 00/10/31 10:22:44 (modified, needs delta)
>
> @@ -455,7 +455,9 @@
> */
> static inline void __schedule_tail(struct task_struct *prev)
> {
> - current->need_resched |= prev->need_resched;
> + if (prev->need_resched) {
> + current->need_resched = 1;
> + }
> #ifdef CONFIG_SMP
> if ((prev->state == TASK_RUNNING) &&
> (prev != idle_task(smp_processor_id()))) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next reply other threads:[~2000-12-07 1:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-12-07 1:13 Jun Sun [this message]
2000-12-07 17:21 ` [Fwd: lost need_resched flag re-introduced?] kuznet
2000-12-07 18:51 ` Jun Sun
2000-12-07 18:56 ` kuznet
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=3A2EE42C.F59317E9@mvista.com \
--to=jsun@mvista.com \
--cc=linux-kernel@vger.kernel.org \
/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