Skip to contentSkip to conversation

Should we relax in udelay()?

PATCH Matthew Wilcox 2 participants 2 messages Dec 14, 2004 – Dec 16, 2004

lore
Share & tools
lore
#0 lore raw

Would the following patch be a good idea? Obviously, this is a busy-loop, but does itc tick correctly while we're relaxing?

Index: include/asm-ia64/delay.h
=================================RCS file: /var/cvs/linux-2.6/include/asm-ia64/delay.h,v retrieving revision 1.4

include/asm-ia64/delay.h +1 -1
diff -u -p -r1.4 delay.h
@@ -91,7 +91,7 @@ udelay (unsigned long usecs)
 	unsigned long cycles = usecs*local_cpu_data->cyc_per_usec;
 
 	while (ia64_get_itc() - start < cycles)
-		/* skip */;
+		cpu_relax();
 }
 
 #endif /* _ASM_IA64_DELAY_H */
Signature · 6 lines
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Matthew Wilcox

Matthew> Would the following patch be a good idea?

I think so.

Matthew> Obviously, this is a busy-loop, but does itc tick correctly Matthew> while we're relaxing?

Yes.

	--david