Re: A question about runqueue

From: Chen Bin (sunwen_ling_at_tom.com)
Date: 11/17/03


Date: 16 Nov 2003 15:56:10 -0800

Kasper Dupont <kasperd@daimi.au.dk> wrote in message news:<3FB75672.83AF2531@daimi.au.dk>...
> Chen Bin wrote:
> >
> > HI,
> >
> > I notice that in arch/i386/kernel/semaphore.c,if a task is going to be
> > blocked,its state is changed BUT not dequeued from the per cpu's
> > runqueue.But when it is waken up,the activate_task actually enqueue to
> > the runqueue,is it right?
>
> I think the dequeueing is done by this piece of code from
> schedule() in kernel/sched.c:
>
> switch (prev->state) {
> case TASK_INTERRUPTIBLE:
> if (unlikely(signal_pending(prev))) {
> prev->state = TASK_RUNNING;
> break;
> }
> default:
> deactivate_task(prev, rq);
> case TASK_RUNNING:
> ;
> }
>
> Also AFAIR the enqueueing code actually checks if it is
> on the list before inserting it.

Thank you very much.

I want to know if I don't use a waitqueue,how can I destroy the whole
waitqueue after I have called DECLEAR_WAIT_QUEUE_HEAD to establish a
new queue?

Thanks in advance.

Chen Bin