Re: Can any one tell me why cond_resched in do_select?

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Wang Nan <wn.at.lkml@...>
Cc: <linux-kernel@...>, Ingo Molnar <mingo@...>
Date: Sunday, January 27, 2008 - 2:00 am

> On Thu, 24 Jan 2008 03:01:53 +0800 "Wang Nan" <wn.at.lkml@gmail.com> wrote:

It does look a bit odd.  IIRC, cond_resched() is special, in that if it is
called in state TASK_INTERRUPTIBLE it will _not_ return in state
TASK_RUNNING after having called schedule().

Search for PREEMPT_ACTIVE in kernel/sched.c.  See if you can work out what
this code:


	if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
		if (unlikely((prev->state & TASK_INTERRUPTIBLE) &&
				unlikely(signal_pending(prev)))) {
			prev->state = TASK_RUNNING;
		} else {
			deactivate_task(rq, prev, 1);
		}
		switch_count = &prev->nvcsw;
	}

is doing, then send a patch which adds the missing comment :)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Can any one tell me why cond_resched in do_select?, Andrew Morton, (Sun Jan 27, 2:00 am)