Jan Beulich
2010-Dec-17 09:44 UTC
[Xen-devel] [PATCH] linux-2.6.18/netback: Re-factor net_tx_action_dealloc() slightly
From: Paul Durrant <paul.durrant@citrix.com>
Subject: Re-factor net_tx_action_dealloc() slightly.
There is no need for processing of the pending_inuse list to be within
the dealloc_prod/cons loop.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@novell.com>
--- sle10sp4-2010-12-15.orig/drivers/xen/netback/netback.c
+++ sle10sp4-2010-12-15/drivers/xen/netback/netback.c
@@ -924,7 +924,6 @@ inline static void net_tx_action_dealloc
u16 pending_idx;
PEND_RING_IDX dc, dp;
netif_t *netif;
- int ret;
LIST_HEAD(list);
dc = dealloc_cons;
@@ -959,11 +958,17 @@ inline static void net_tx_action_dealloc
gop++;
}
- if (netbk_copy_skb_mode != NETBK_DELAYED_COPY_SKB ||
- list_empty(&pending_inuse_head))
- break;
+ } while (dp != dealloc_prod);
+
+ dealloc_cons = dc;
- /* Copy any entries that have been pending for too long. */
+ if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref,
+ tx_unmap_ops, gop - tx_unmap_ops))
+ BUG();
+
+ /* Copy any entries that have been pending for too long. */
+ if (netbk_copy_skb_mode == NETBK_DELAYED_COPY_SKB &&
+ !list_empty(&pending_inuse_head)) {
list_for_each_entry_safe(inuse, n, &pending_inuse_head, list) {
if (time_after(inuse->alloc_time + HZ / 2, jiffies))
break;
@@ -985,13 +990,7 @@ inline static void net_tx_action_dealloc
break;
}
- } while (dp != dealloc_prod);
-
- dealloc_cons = dc;
-
- ret = HYPERVISOR_grant_table_op(
- GNTTABOP_unmap_grant_ref, tx_unmap_ops, gop - tx_unmap_ops);
- BUG_ON(ret);
+ }
list_for_each_entry_safe(inuse, n, &list, list) {
pending_idx = inuse - pending_inuse;
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel