Well maybe we should change local_irq_save/restore in general?
The result would be:
if (!in_interrupt())
local_irq_disable()
<critical section>
if (!in_interrupt())
local_irq_enable();
Somehow we need to remember that we disabled interrupts.
Then it get more complicated.
int interrupts_disabled = 0;
if (!in_interrupt()) {
local_irq_disable():
interrrupts_disabled = 1;
}
<critical section>
if (interrupts_disabled)
local_irq_enable();
Not sure that this actually better.
The statistics code surely does not rely on that.
-