jiffies doesn't increase while doing mdelay() ?
A message that is not in the archive (sent off-list or not yet received): [email protected]
Dear all,
I am doing the following in a kernel thread :
===== code segment=====prink("before mdelay:%d, ", jiffies);
mdelay(300); // delay 300msprintk("after mdelay:%d\n", jiffies);
===== code segment=====
However, jiffies before and after doing mdelay are the same!!! Can someone please explain why jiffies doesn't change ?
Cheers,
--
James
[email protected]
Quoted 4 lines · James Yu
Dear all,
I am doing the following in a kernel thread :
Quoted 8 lines
===== code segment=====
prink("before mdelay:%d, ", jiffies);
mdelay(300); // delay 300msprintk("after mdelay:%d\n", jiffies);
===== code segment=====However, jiffies before and after doing mdelay are the same!!! Can someone please explain why jiffies doesn't change ?
first of all you should use msleep() not mdelay() for such long delays...
second if you have interrupts disables (for example via spin_lock_irqsave) this is normal (and the reason why your code is evil): The timer interrupt that normally increments jiffies can't happen because you disabled it..