From: Roger Larsson <roger.larsson@norran.net>
To: Robert Love <rml@tech9.net>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] preemptive kernel behavior change: don't be rude
Date: Fri, 5 Apr 2002 22:03:09 +0200 [thread overview]
Message-ID: <200204052203.09716.roger.larsson@norran.net> (raw)
In-Reply-To: <Pine.LNX.4.33.0204041740220.7731-100000@penguin.transmeta.com> <1017976155.22299.746.camel@phantasy>
Hi Robert,
This does not look symmetrical, add and sub and bitops...
> +#define PREEMPT_ACTIVE 0x4000000
> + /*
> + * if entering from preempt_schedule, off a kernel preemption,
> + * go straight to picking the next task.
> + */
> + if (unlikely(preempt_get_count() & PREEMPT_ACTIVE))
> + goto pick_next_task;
> +
> + do {
> + current_thread_info()->preempt_count += PREEMPT_ACTIVE;
> + schedule();
> + current_thread_info()->preempt_count -= PREEMPT_ACTIVE;
> + barrier();
And since it has to be zero to end up in the routine anyway...
asmlinkage void preempt_schedule(void)
{
BUG_ON(current_thread_info()->preempt_count != 0);
do {
/* Problem: suppose a new interrupt happens before we got to set
* preempt_count... then we will call this routine recursively.
* innermost will select the correct process, but wont it be scheduled
* away in enclosing preempt_schedule() - schedule() will be called
* with PREEMPT_ACTIVE but not TIF_NEED_RESCHED...
* (goto pick_next_task) */
current_thread_info()->preempt_count = PREEMPT_ACTIVE;
/* interrupts here might cause calls to preempt_schedule() but those will
bounce off above since preempt_count != 0 */
schedule();
current_thread_info()->preempt_count = 0;
/* interrupt here will possibly preempt the right process - no problem */
/* need to check if any interrupt happened during the preemption off time,
* this case is in fact unlikely */
while (unlikely(test_thread_flag(TIF_NEED_RESCHED)));
}
/RogerL
--
Roger Larsson
Skellefteå
Sweden
next prev parent reply other threads:[~2002-04-05 20:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.33.0204041740220.7731-100000@penguin.transmeta.com>
2002-04-05 3:09 ` Robert Love
2002-04-05 20:03 ` Roger Larsson [this message]
2002-04-04 23:55 Patch: linux-2.5.8-pre1/kernel/exit.c change caused BUG() at boot time 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
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=200204052203.09716.roger.larsson@norran.net \
--to=roger.larsson@norran.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@tech9.net \
/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
all inboxes | Powered by JetHome®