Messages in this thread |  | | From | Duncan Sands <> | | Subject | Re: Use of yield() in the kernel | | Date | Sat, 19 Oct 2002 14:25:34 +0200 |
| |
> > 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); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |