Re: [RFC][PATCH 0/2] preempt: Track unmatched preempt_enable() topreempt_disable()

From: Steven Rostedt
Date: Thu Jan 16 2014 - 14:00:12 EST

On Thu, 16 Jan 2014 19:42:51 +0100
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> Suppose a reschedule interrupt happens in the middle; we set
> NEED_RESCHED but won't act because preempt is disabled.
> When we hit preempt_enable() we'll call into preempt_schedule() but fail
> because preemptible() finds irqs_disabled().
> And in the end we do not schedule, but have NEED_RESCHED set.

Ah! Interesting. Actually, you don't even need the first part. That
happens simply with:


<interrupt - set need_resched>


I think we can get lockdep to trigger on that. I have ideas to make
preempt tracer do that, which shouldn't be too hard to convert to

It looks that all we need to do is check for anytime we have interrupts
becoming disabled with preemption disabled, and then enable preemption
without first enabling interrupts. This should be able to be driven by
state of the task or CPU even.

I can see if I can whip up a patch to do that.

-- Steve
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at