* [PATCH] net: netif_tx_queue_stopped too expensive
@ 2009-04-28 9:32 Eric Dumazet
2009-04-28 11:44 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2009-04-28 9:32 UTC (permalink / raw)
To: David S. Miller; +Cc: Linux Netdev List, Tom Herbert
netif_tx_queue_stopped(txq) is most of the time false.
Yet its cost is very expensive on SMP.
static inline int netif_tx_queue_stopped(const struct netdev_queue *dev_queue)
{
return test_bit(__QUEUE_STATE_XOFF, &dev_queue->state);
}
I saw this on oprofile hunting and bnx2 driver bnx2_tx_int().
We probably should split "struct netdev_queue" in two parts, one
being read mostly.
__netif_tx_lock() touches _xmit_lock & xmit_lock_owner, these
deserve a separate cache line.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 2e7783f..1caaebb 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -447,12 +447,18 @@ enum netdev_queue_state_t
};
struct netdev_queue {
+/*
+ * read mostly part
+ */
struct net_device *dev;
struct Qdisc *qdisc;
unsigned long state;
- spinlock_t _xmit_lock;
- int xmit_lock_owner;
struct Qdisc *qdisc_sleeping;
+/*
+ * write mostly part
+ */
+ spinlock_t _xmit_lock ____cacheline_aligned_in_smp;
+ int xmit_lock_owner;
} ____cacheline_aligned_in_smp;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: netif_tx_queue_stopped too expensive
2009-04-28 9:32 [PATCH] net: netif_tx_queue_stopped too expensive Eric Dumazet
@ 2009-04-28 11:44 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-04-28 11:44 UTC (permalink / raw)
To: dada1; +Cc: netdev, therbert
From: Eric Dumazet <dada1@cosmosbay.com>
Date: Tue, 28 Apr 2009 11:32:20 +0200
> netif_tx_queue_stopped(txq) is most of the time false.
>
> Yet its cost is very expensive on SMP.
...
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Fair enough, applied to net-next-2.6, thanks Eric.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-28 11:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-28 9:32 [PATCH] net: netif_tx_queue_stopped too expensive Eric Dumazet
2009-04-28 11:44 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).