mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Should we use preempt_disable() in sleep_on_common()?
@ 2009-12-03  6:49 liu pf
  2009-12-03  7:07 ` Arjan van de Ven
  2009-12-03  7:57 ` Dmitry Adamushko
  0 siblings, 2 replies; 9+ messages in thread
From: liu pf @ 2009-12-03  6:49 UTC (permalink / raw)
  To: linux-kernel

Hi:

I am puzzled with the following scenario. Could anyone enlighten me?

Thanks
pfliu


static long __sched
sleep_on_common(wait_queue_head_t *q, int state, long timeout)
{
    unsigned long flags;
    wait_queue_t wait;

    init_waitqueue_entry(&wait, current);

    __set_current_state(state);

    ==========>suppose that after task A  set state=TASK_INTERRUPTIBLE
, it is preempted by task B.

    spin_lock_irqsave(&q->lock, flags);
...............................................................
}

asmlinkage void __sched schedule(void)
{
.......................................................................................................
    if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
        if (unlikely(signal_pending_state(prev->state, prev)))
            prev->state = TASK_RUNNING;
        else
            deactivate_task(rq, prev, 1);
       =============>This will remove task A from rq, but there are no
wait queue referring to A, so we lose A.
        switch_count = &prev->nvcsw;
    }

..................................................................................................
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-12-03  8:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-03  6:49 Should we use preempt_disable() in sleep_on_common()? liu pf
2009-12-03  7:07 ` Arjan van de Ven
2009-12-03  7:12   ` Dmitry Torokhov
2009-12-03  7:15     ` Dmitry Torokhov
2009-12-03  8:15     ` liu pf
2009-12-03  8:22       ` Dmitry Torokhov
2009-12-03  8:53         ` liu pf
2009-12-03  7:57 ` Dmitry Adamushko
2009-12-03  8:01   ` liu pf

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®