Skip to contentSkip to conversation

revert bh_lru_lock() to preempt_disable()

PATCH In review Daniel Walker 2 participants 5 messages Apr 22, 2006 – May 3, 2006 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 revert bh_lru_lock() to preempt_disable()

The bh_lru_lock() was set to disable interrupt to protect
from IPI's, which are only on SMP . So I don't think it's needed in UP PREEMPT_RT configs.

fs/buffer.c +1 -1
Index: linux-2.6.16/fs/buffer.c
===================================================================
@@ -1326,7 +1326,7 @@ struct bh_lru {
 
 static DEFINE_PER_CPU(struct bh_lru, bh_lrus) = {{ NULL }};
 
-#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT_RT)
+#if defined(CONFIG_SMP) 
 #define bh_lru_lock()	local_irq_disable()
 #define bh_lru_unlock()	local_irq_enable()
 #else
#1 lore raw
Quoted 3 lines · Daniel Walker

The bh_lru_lock() was set to disable interrupt to protect from
IPI's, which are only on SMP . So I don't think it's needed in UP PREEMPT_RT configs.

i agree that this is a problem, but the fix is incorrect. What would be the right approach is to convert the PER_CPU bh_lrus to PER_CPU_LOCKED, and to use the appropriate primitives to use them. That automatically makes this code rt-safe. (it isnt right now)

Ingo

#2 lore raw
Quoted 10 lines · Ingo Molnar
Quoted 3 lines · Daniel Walker

The bh_lru_lock() was set to disable interrupt to protect from
IPI's, which are only on SMP . So I don't think it's needed in UP PREEMPT_RT configs.

i agree that this is a problem, but the fix is incorrect. What would be the right approach is to convert the PER_CPU bh_lrus to PER_CPU_LOCKED, and to use the appropriate primitives to use them. That automatically makes this code rt-safe. (it isnt right now)

Hmm, in UP it should be safe to access per cpu data under either a preempt_disable or local_irq_disable . I'm not sure how RT changes that .. Is there some other part of the code that isn't rt-safe, which I've overlooked ?

Daniel

#3 lore raw
Quoted 9 lines · Daniel Walker
Quoted 4 lines

i agree that this is a problem, but the fix is incorrect. What would be the right approach is to convert the PER_CPU bh_lrus to PER_CPU_LOCKED, and to use the appropriate primitives to use them. That automatically makes this code rt-safe. (it isnt right now)

Hmm, in UP it should be safe to access per cpu data under either a preempt_disable or local_irq_disable . I'm not sure how RT changes that .. Is there some other part of the code that isn't rt-safe, which I've overlooked ?

hm, you are right - that code can be in a preempt-off section. I've applied your patch.

Ingo

#4 lore raw
Quoted 7 lines · Ingo Molnar
Quoted 5 lines · Daniel Walker
Quoted 4 lines

i agree that this is a problem, but the fix is incorrect. What would be the right approach is to convert the PER_CPU bh_lrus to PER_CPU_LOCKED, and to use the appropriate primitives to use them. That automatically makes this code rt-safe. (it isnt right now)

Quoted 7 lines
Quoted 4 lines

Hmm, in UP it should be safe to access per cpu data under either a preempt_disable or local_irq_disable . I'm not sure how RT changes that .. Is there some other part of the code that isn't rt-safe, which I've overlooked ?

hm, you are right - that code can be in a preempt-off section. I've applied your patch.

We could switch it to locked types if it's a latency concern..

Daniel