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
So,
What should be the value of preempt_count for preemption.
Is it PREEMPT_ACTIVE or other value.
IS there any documentation on kernel preemption for us to read. I have read your interview with Kernel Trap and your article on 2.6 internals. That was really fruitful for me. IS Anythig more available?
Thanks
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/