Question abount bh_lru_lock()

Rock Lee rocklee_104 at outlook.com
Mon Mar 23 02:53:39 EDT 2015


Hi, all:
Going through fs/buffer.c, I find that
bh_lru_lock() is a macro which can be local_irq_disable() or
preempt_disable().

#ifdef CONFIG_SMP
#define bh_lru_lock()	local_irq_disable()
#define bh_lru_unlock()	local_irq_enable()
#else
#define bh_lru_lock()	preempt_disable()
#define bh_lru_unlock()	preempt_enable()
#endif

In SMP system, bh_lru_lock just disables local interrupt, if current
kernel is preemptible, how can bh_lru_lock protect critical region?

or

In UP system, is making the kernel just non-preemptible safe enough when 
an interrupt occur and its handler may modify critical region?



More information about the Kernelnewbies mailing list