lkml.org 
[lkml]   [2007]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectThe purpose and implementation of cond_resched()
I have a question about cond_resched().

What is the condition under which I should invoke cond_resched() irreplaceably?

For example, I see the following code in ksoftirqd(),

preempt_enable_no_resched();
cond_resched();
preempt_disable();

But I do not understand why I should not write the following code,

preempt_enable();
preempt_disable();

Are the above two pieces of code equal in functionality?

On the other hand, I see cond_resched() check and set PREEMPT_ACTIVE.
I currently do not understand why it should do this, since I think
PREEMPT_ACTIVE is only used to be set in the return-from-interrupt
code in order to prevent schedule() from removing task from run queue
unpredictably. But for cond_resched(), which is a planned voluntary
switch, why does it also deal with this flag?
-
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/

\
 
 \ /
  Last update: 2007-02-21 17:17    [W:0.026 / U:1.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site