On Tue, 2004-07-06 at 00:08 -0400, ml@skeletoid.org wrote: > In the schedule() function, there is this line: > > if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { > > I wonder why the right part is needed. > PREEMPT_ACTIVE is defined to 0x4000000, > so, even if preempt_count() return 0,1,2,.. it will always be 0 when we do the > logical AND with 0x4000000. So !0 become true, therefore the right side is > always true. Maybe am I missing something? You are. The preempt count is actually _set_ to PREEMPT_ACTIVE. You can see this in the very file you referenced. So the check is not whether or not preempt_count() is returning any value, but whether or not it has been and'ed (or set to) PREEMPT_ACTIVE. This flag is used to delineate whether or not the current schedule is occurring off of a kernel preemption. Robert Love -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/