[PATCH] kernel preemption bits (1/2)
Two big ouches in x86 entry.S: (1) Up until 2.5.20, we were not properly reading the irq_stat and bh_count values from the right CPU. Brian Gerst sent you a patch to fix this. This raises the question: why was this not a problem? Seems we do not need this check at all as having a nonzero irq_star or bh_count implies having a nonzero preempt_count, which we test for above. Thus this patch removes those tests and the related defines. (2) What if it is possible to preempt even with interrupts disabled? Turns out it is. Consider if we take an exception (say, for a TLB miss) and enter resume_kernel and preempt. Even if interrupts are disabled, an exception can occur and end up in resume_kernel. We need to check to make sure interrupts are not off, to ensure we are not coming off an unmasked exception. Even with the added check from issue #2, we have less code after #1 so we can walk away with a bugfix and an optimization here. ;) Thanks to George Anzinger, with whom I actually had #2 bite me, and who helped with these issues.
Showing
Please register or sign in to comment