1 From: jbeulich@novell.com
2 Subject: netback: reduce overhead of IRQ recording
3 Patch-mainline: obsolete
5 Since both NR_PIRQS and NR_DYNIRQS are no longer hardcoded, the
6 (memory) overhead of tracking which ones to send notifications to can
7 be pretty unbounded. Also, store the dynirq rather than the raw irq
8 to push up the limit where the type of notify_list needs to become
9 'int' rather than 'u16'.
11 --- head-2009-02-02.orig/drivers/xen/netback/interface.c 2009-02-02 09:40:43.000000000 +0100
12 +++ head-2009-02-02/drivers/xen/netback/interface.c 2009-02-02 10:20:51.000000000 +0100
13 @@ -280,6 +280,7 @@ int netif_map(netif_t *netif, unsigned l
14 netif->dev->name, netif);
17 + BUG_ON(err < DYNIRQ_BASE || err >= DYNIRQ_BASE + NR_DYNIRQS);
19 disable_irq(netif->irq);
21 --- head-2009-02-02.orig/drivers/xen/netback/netback.c 2008-12-23 09:35:35.000000000 +0100
22 +++ head-2009-02-02/drivers/xen/netback/netback.c 2008-12-23 09:35:42.000000000 +0100
23 @@ -580,8 +580,12 @@ static void net_rx_action(unsigned long
24 static mmu_update_t rx_mmu[NET_RX_RING_SIZE];
25 static gnttab_transfer_t grant_trans_op[NET_RX_RING_SIZE];
26 static gnttab_copy_t grant_copy_op[NET_RX_RING_SIZE];
27 - static unsigned char rx_notify[NR_IRQS];
28 + static DECLARE_BITMAP(rx_notify, NR_DYNIRQS);
29 +#if NR_DYNIRQS <= 0x10000
30 static u16 notify_list[NET_RX_RING_SIZE];
32 + static int notify_list[NET_RX_RING_SIZE];
34 static struct netbk_rx_meta meta[NET_RX_RING_SIZE];
36 struct netrx_pending_operations npo = {
37 @@ -730,11 +734,9 @@ static void net_rx_action(unsigned long
40 RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&netif->rx, ret);
42 - if (ret && !rx_notify[irq]) {
44 + irq = netif->irq - DYNIRQ_BASE;
45 + if (ret && !__test_and_set_bit(irq, rx_notify))
46 notify_list[notify_nr++] = irq;
49 if (netif_queue_stopped(netif->dev) &&
50 netif_schedulable(netif) &&
51 @@ -748,8 +750,8 @@ static void net_rx_action(unsigned long
53 while (notify_nr != 0) {
54 irq = notify_list[--notify_nr];
56 - notify_remote_via_irq(irq);
57 + __clear_bit(irq, rx_notify);
58 + notify_remote_via_irq(irq + DYNIRQ_BASE);
61 /* More work to do? */