public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <rml@ximian.com>
To: Julien.Soula@lifl.fr
Cc: linux-kernel@vger.kernel.org
Subject: Re: use of PREEMPT_ACTIVE ?
Date: Thu, 18 Mar 2004 15:06:13 -0500	[thread overview]
Message-ID: <1079640373.6363.14.camel@localhost> (raw)
In-Reply-To: <20040318195130.GA26321@foudroyante.lifl.fr>

On Thu, 2004-03-18 at 14:51, Julien.Soula@lifl.fr wrote:

> the PREEMPT_ACTIVE flag set by preempt_schedule() or during return of
> interrupt / exception / syscall. And it's tested in schedule() to
> avoid some operations like deactivate_task().
> 
> Our purpose is to force deactivation of the task. So we planned to set
> task state to TASK_INTERRUPTIBLE value and then to call
> schedule(). However the PREEMPT_ACTIVE flag can prevent it.
> 
> So what is the significance of the PREEMPT_ACTIVE flag and the test in
> schedule() ?

It lets a task be preempted when state != TASK_RUNNING.  By preventing
the task from being deactivated, it can be rescheduled correctly. 
Otherwise, a task that was, say, TASK_INTERRUPTIBLE could be preempted
before it put itself on a wait queue.

Marking the task that is preempted is a simple solution to the race.

If you want to force the deactivation of the task, there is really no
difference.  Set it to TASK_INTERRUPTIBLE, do whatever you need to do,
and call schedule().

PREEMPT_ACTIVE is unrelated to what you want to do.

	Robert Love



      reply	other threads:[~2004-03-18 20:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-18 19:51 use of PREEMPT_ACTIVE ? Julien.Soula
2004-03-18 20:06 ` Robert Love [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=1079640373.6363.14.camel@localhost \
    --to=rml@ximian.com \
    --cc=Julien.Soula@lifl.fr \
    --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