提交 50ce749d 编写于 作者: H Heiko Carstens

s390/irq: use hlists for external interrupt handler array

Use hlists for the hashed array of external interrupt handlers.
Reduces the size of the array by 50% (2KB).
Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
上级 8237ac3c
...@@ -196,13 +196,13 @@ asmlinkage void do_softirq(void) ...@@ -196,13 +196,13 @@ asmlinkage void do_softirq(void)
* ext_int_hash[index] is the list head for all external interrupts that hash * ext_int_hash[index] is the list head for all external interrupts that hash
* to this index. * to this index.
*/ */
static struct list_head ext_int_hash[256]; static struct hlist_head ext_int_hash[256];
struct ext_int_info { struct ext_int_info {
ext_int_handler_t handler; ext_int_handler_t handler;
u16 code; struct hlist_node entry;
struct list_head entry;
struct rcu_head rcu; struct rcu_head rcu;
u16 code;
}; };
/* ext_int_hash_lock protects the handler lists for external interrupts */ /* ext_int_hash_lock protects the handler lists for external interrupts */
...@@ -227,7 +227,7 @@ int register_external_interrupt(u16 code, ext_int_handler_t handler) ...@@ -227,7 +227,7 @@ int register_external_interrupt(u16 code, ext_int_handler_t handler)
index = ext_hash(code); index = ext_hash(code);
spin_lock_irqsave(&ext_int_hash_lock, flags); spin_lock_irqsave(&ext_int_hash_lock, flags);
list_add_rcu(&p->entry, &ext_int_hash[index]); hlist_add_head_rcu(&p->entry, &ext_int_hash[index]);
spin_unlock_irqrestore(&ext_int_hash_lock, flags); spin_unlock_irqrestore(&ext_int_hash_lock, flags);
return 0; return 0;
} }
...@@ -240,9 +240,9 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler) ...@@ -240,9 +240,9 @@ int unregister_external_interrupt(u16 code, ext_int_handler_t handler)
int index = ext_hash(code); int index = ext_hash(code);
spin_lock_irqsave(&ext_int_hash_lock, flags); spin_lock_irqsave(&ext_int_hash_lock, flags);
list_for_each_entry_rcu(p, &ext_int_hash[index], entry) { hlist_for_each_entry_rcu(p, &ext_int_hash[index], entry) {
if (p->code == code && p->handler == handler) { if (p->code == code && p->handler == handler) {
list_del_rcu(&p->entry); hlist_del_rcu(&p->entry);
kfree_rcu(p, rcu); kfree_rcu(p, rcu);
} }
} }
...@@ -264,12 +264,12 @@ static irqreturn_t do_ext_interrupt(int irq, void *dummy) ...@@ -264,12 +264,12 @@ static irqreturn_t do_ext_interrupt(int irq, void *dummy)
index = ext_hash(ext_code.code); index = ext_hash(ext_code.code);
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(p, &ext_int_hash[index], entry) hlist_for_each_entry_rcu(p, &ext_int_hash[index], entry) {
if (likely(p->code == ext_code.code)) if (unlikely(p->code != ext_code.code))
p->handler(ext_code, regs->int_parm, continue;
regs->int_parm_long); p->handler(ext_code, regs->int_parm, regs->int_parm_long);
}
rcu_read_unlock(); rcu_read_unlock();
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -283,7 +283,7 @@ void __init init_ext_interrupts(void) ...@@ -283,7 +283,7 @@ void __init init_ext_interrupts(void)
int idx; int idx;
for (idx = 0; idx < ARRAY_SIZE(ext_int_hash); idx++) for (idx = 0; idx < ARRAY_SIZE(ext_int_hash); idx++)
INIT_LIST_HEAD(&ext_int_hash[idx]); INIT_HLIST_HEAD(&ext_int_hash[idx]);
irq_set_chip_and_handler(EXT_INTERRUPT, irq_set_chip_and_handler(EXT_INTERRUPT,
&dummy_irq_chip, handle_percpu_irq); &dummy_irq_chip, handle_percpu_irq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册