Skip to contentSkip to conversation

Fix logical and operator at interrupt handler thread

PATCH In review Geunsik Lim 2 participants 3 messages Feb 1, 2012 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix logical and operator at interrupt handler thread

From: Geunsik Lim <[email protected]>

'&' is a bitwise operation. (e.g: a & b )
Use '&&' and-operator instead of '&' bitwise operator.

---
 kernel/irq/manage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/irq/manage.c +1 -1
index a9a9dbe..c0730ad 100644
@@ -773,7 +773,7 @@ static int irq_thread(void *data)
 			struct irqaction *action);
 	int wake;
 
-	if (force_irqthreads & test_bit(IRQTF_FORCED_THREAD,
+	if (force_irqthreads && test_bit(IRQTF_FORCED_THREAD,
 					&action->thread_flags))
 		handler_fn = irq_forced_thread_fn;
 	else
Signature · 1 line
1.7.8.1
#1 lore raw
Quoted 15 lines · Geunsik Lim

From: Geunsik Lim <[email protected]>

'&' is a bitwise operation. (e.g: a & b )
Use '&&' and-operator instead of '&' bitwise operator.

---
 kernel/irq/manage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/irq/manage.c +0 -0
index a9a9dbe..c0730ad 100644

kernel/irq/manage.c static int irq_thread(void *data) · line 779

Quoted 8 lines
kernel/irq/manage.c +1 -1
@@ -773,7 +773,7 @@ static int irq_thread(void *data)
 			struct irqaction *action);
 	int wake;
 
-	if (force_irqthreads & test_bit(IRQTF_FORCED_THREAD,
+	if (force_irqthreads && test_bit(IRQTF_FORCED_THREAD,
 					&action->thread_flags))
 		handler_fn = irq_forced_thread_fn;
 	else

This was intentional, to have a single conditional move :

ffffffff810b0868:       0f b6 15 19 f5 bd 00    movzbl 0xbdf519(%rip),%edx        # ffffffff81c8fd88 <force_irqthreads>
ffffffff810b086f:       49 89 c5                mov    %rax,%r13
ffffffff810b0872:       48 8b 43 40             mov    0x40(%rbx),%rax
ffffffff810b0876:       be 01 00 00 00          mov    $0x1,%esi
ffffffff810b087b:       48 c1 e8 04             shr    $0x4,%rax
ffffffff810b087f:       85 c2                   test   %eax,%edx
ffffffff810b0881:       48 c7 c0 80 0a 0b 81    mov    $0xffffffff810b0a80,%rax
ffffffff810b0888:       48 c7 c2 40 dc 80 81    mov    $0xffffffff8180dc40,%rdx
ffffffff810b088f:       4c 0f 44 f8             cmove  %rax,%r15

I guess you could instead use jump_label here to shorten the code.

#2 lore raw
Quoted 1 line · Eric Dumazet

I guess you could instead use jump_label here to shorten the code.

(since its not hot path anyway, its probably not worth it)