Skip to contentSkip to conversation

virtio_net: do not rate limit counter increments

PATCH In review Rick Jones 4 participants 4 messages Mar 27, 2012 – Mar 28, 2012

Subsystems (4)
lore
Share & tools
lore

Rick Jones

author
#0 lore raw

PATCH 1/1 virtio_net: do not rate limit counter increments

From: Rick Jones <[email protected]>

While it is desirable to rate limit certain messages, it is not desirable to rate limit the incrementing of counters associated with those messages.

---

Compiled, and run briefly in a 1 vCPU guest under a netperf workload.

drivers/net/virtio_net.c +4 -3
index 019da01..4de2760 100644
@@ -625,12 +625,13 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	/* This can happen with OOM and indirect buffers. */
 	if (unlikely(capacity < 0)) {
-		if (net_ratelimit()) {
-			if (likely(capacity == -ENOMEM)) {
+		if (likely(capacity == -ENOMEM)) {
+			if (net_ratelimit()) {
 				dev_warn(&dev->dev,
 					 "TX queue failure: out of memory\n");
 			} else {
-				dev->stats.tx_fifo_errors++;
+			dev->stats.tx_fifo_errors++;
+			if (net_ratelimit())
 				dev_warn(&dev->dev,
 					 "Unexpected TX queue failure: %d\n",
 					 capacity);
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · On Tue, 27 Mar 2012 10:28:09 -0700 (PDT), [email protected] (Rick Jones)…

From: Rick Jones <[email protected]>

While it is desirable to rate limit certain messages, it is not desirable to rate limit the incrementing of counters associated with those messages.

Thanks!
Rusty.

Quoted 22 lines
drivers/net/virtio_net.c +4 -3
index 019da01..4de2760 100644
@@ -625,12 +625,13 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	/* This can happen with OOM and indirect buffers. */
 	if (unlikely(capacity < 0)) {
-		if (net_ratelimit()) {
-			if (likely(capacity == -ENOMEM)) {
+		if (likely(capacity == -ENOMEM)) {
+			if (net_ratelimit()) {
 				dev_warn(&dev->dev,
 					 "TX queue failure: out of memory\n");
 			} else {
-				dev->stats.tx_fifo_errors++;
+			dev->stats.tx_fifo_errors++;
+			if (net_ratelimit())
 				dev_warn(&dev->dev,
 					 "Unexpected TX queue failure: %d\n",
 					 capacity);
Signature · 1 line
  How could I marry someone with more hair than me?  http://baldalex.org
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Rick Jones
Quoted 7 lines · Rick Jones

From: Rick Jones <[email protected]>

While it is desirable to rate limit certain messages, it is not desirable to rate limit the incrementing of counters associated with those messages.

Dave, can you apply pls? Thanks!

Quoted 26 lines

---

Compiled, and run briefly in a 1 vCPU guest under a netperf workload.

drivers/net/virtio_net.c +4 -3
index 019da01..4de2760 100644
@@ -625,12 +625,13 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	/* This can happen with OOM and indirect buffers. */
 	if (unlikely(capacity < 0)) {
-		if (net_ratelimit()) {
-			if (likely(capacity == -ENOMEM)) {
+		if (likely(capacity == -ENOMEM)) {
+			if (net_ratelimit()) {
 				dev_warn(&dev->dev,
 					 "TX queue failure: out of memory\n");
 			} else {
-				dev->stats.tx_fifo_errors++;
+			dev->stats.tx_fifo_errors++;
+			if (net_ratelimit())
 				dev_warn(&dev->dev,
 					 "Unexpected TX queue failure: %d\n",
 					 capacity);
maintainer
#3 lore raw

From: "Michael S. Tsirkin" <[email protected]>
Date: Wed, 28 Mar 2012 10:30:46 +0200

Quoted 7 lines · Rick Jones
Quoted 6 lines

From: Rick Jones <[email protected]>

While it is desirable to rate limit certain messages, it is not desirable to rate limit the incrementing of counters associated with those messages.

Quoted 6 lines
Quoted 1 line

Dave, can you apply pls? Thanks!

Done.