mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Duncan Sands <baldrick@wanadoo.fr>
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@digeo.com>
Subject: Re: Use of yield() in the kernel
Date: Sat, 19 Oct 2002 14:25:34 +0200	[thread overview]
Message-ID: <200210191425.34627.baldrick@wanadoo.fr> (raw)
In-Reply-To: <20021018182558.GD237@elf.ucw.cz>

> > Here is the list of files using yield(), excluding non-i386 arch specific
> > files:
>
> ...
>
> > kernel/suspend.c
>
> This is okay.

Hi Pavel, I agree.  I have some questions about the code though:
when you come across a thread with (p->flags & PF_FROZEN), why
break out of the loop?  Why not just skip this thread and go on to the
next one?  Also, does it matter if the code doing the freezing is itself
frozen?

Ciao, Duncan.

PS: Here is the code, for reference:

        do {
                todo = 0;
                read_lock(&tasklist_lock);
                do_each_thread(g, p) {
                        unsigned long flags;
                        INTERESTING(p);
                        if (p->flags & PF_FROZEN)
                                continue;

                        /* FIXME: smp problem here: we may not access other proc
ess' flags
                           without locking */
                        p->flags |= PF_FREEZE;
                        spin_lock_irqsave(&p->sig->siglock, flags);
                        signal_wake_up(p);
                        spin_unlock_irqrestore(&p->sig->siglock, flags);
                        todo++;
                } while_each_thread(g, p);
                read_unlock(&tasklist_lock);
                yield();
                if (time_after(jiffies, start_time + TIMEOUT)) {
                        printk( "\n" );
                        return todo;
                }
        } while(todo);

  reply	other threads:[~2002-10-19 12:19 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 [this message]
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
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=200210191425.34627.baldrick@wanadoo.fr \
    --to=baldrick@wanadoo.fr \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --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®