Skip to contentSkip to conversation

jiffies doesn't increase while doing mdelay() ?

DISCUSSION James Yu 2 participants 2 messages Mar 30, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

James Yu

author
#1 lore raw

Dear all,

I am doing the following in a kernel thread :

===== code segment=====
prink("before mdelay:%d, ", jiffies);
mdelay(300); // delay 300ms
printk("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]

#2 lore raw
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 300ms
printk("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..