mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Duncan Sands <baldrick@wanadoo.fr>
To: Mark Mielke <mark@mark.mielke.cc>
Cc: Pavel Machek <pavel@ucw.cz>,
	linux-kernel@vger.kernel.org, Andrew Morton <akpm@digeo.com>
Subject: Re: Use of yield() in the kernel
Date: Tue, 22 Oct 2002 20:58:55 +0200	[thread overview]
Message-ID: <200210222058.55621.baldrick@wanadoo.fr> (raw)
In-Reply-To: <20021022172404.GB1314@mark.mielke.cc>

On Tuesday 22 October 2002 19:24, Mark Mielke wrote:
> Would it be sensible to add a "yield_short()" function to the kernel?

You can do:

set_current_state(TASK_RUNNING);
schedule();

I'm not clear on what you are guaranteed to get - for example,
it looks as if it can sometimes return without sleeping at all.
There is also cond_resched(), which is

static inline void cond_resched(void)
{
        if (need_resched())
                __cond_resched();
}

void __cond_resched(void)
{
        set_current_state(TASK_RUNNING);
        schedule();
}

I don't know when need_resched evaluates to true, I haven't
had time to look into this yet.

Ciao, Duncan.

  reply	other threads:[~2002-10-22 18:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-15 13:36 Duncan Sands
2002-10-15 15:15 ` Ingo Molnar
2002-10-15 17:12 ` John Levon
2002-10-17  6:36   ` Duncan Sands
2002-10-18 18:26 ` Pavel Machek
2002-10-19 12:25   ` Duncan Sands
2002-10-19 22:00     ` Pavel Machek
2002-10-20  9:10       ` Duncan Sands
2002-10-22 17:24         ` Mark Mielke
2002-10-22 18:58           ` Duncan Sands [this message]
2002-10-25 14:15           ` Duncan Sands
2002-10-20 11:22       ` Duncan Sands
2002-10-15 16:20 Marc-Christian Petersen
2002-10-15 16:27 ` Duncan Sands
2002-10-25  8:43   ` Duncan Sands

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=200210222058.55621.baldrick@wanadoo.fr \
    --to=baldrick@wanadoo.fr \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@mark.mielke.cc \
    --cc=pavel@ucw.cz \
    /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®