Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.arcetri.astro.it/irlab/doc/library/linux/khg/HyperNews/get/devices/reference/13.html
Дата изменения: Thu Mar 23 12:37:28 2000
Дата индексирования: Wed Sep 15 04:25:31 2010
Кодировка:

Поисковые слова: п п п п п п п п п п п п п п п п п п п п п п
Bug in printk description! The HyperNews Linux KHG Discussion Pages

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).