The HyperNews Linux KHG Discussion Pages
Next-in-Thread Next Message Previous Message Next Thread

Disagree: Bug in printk description!

Forum: Supporting Functions
Date: Wed, 19 Feb 1997 01:43:48 GMT
From: Theodore Ts'o <tytso@mit.edu>

The printk description states that (and I quote):

``printk() may cause implicit I/O, if the memory being accessed has been swapped out, and therefore pre-emption may occur at this point. Also, printk() will set the interrupt enable flag, so never use it in code protected by cli(). Because it causes I/O, it is not safe to use in protected code anyway, even it if didn't set the interrupt enable flag.''

This is wrong! First of all, printk accesses kernel memory, which is never swapped out. Hence, there is no risk of causing implicit I/O. Secondly, printk doesn't use sti(); it uses save_flags()/restore_flags(), so it's safe to use it in an interrupt routine (although it will do horrible things to your interrupt latency, so you obviously only use it for debugging).

Next-in-Thread Next Message Previous Message Next Thread

to: "Bug in printk description!"

Subscribe Membership Move/Remove Admin Mode Show Frames Help for HyperNews 1.9.4