]> err.no Git - linux-2.6/commitdiff
qeth: enforce a rate limit for inbound scatter gather messages
authorFrank Blaschka <frank.blaschka@de.ibm.com>
Wed, 29 Aug 2007 09:26:53 +0000 (11:26 +0200)
committerJeff Garzik <jeff@garzik.org>
Fri, 31 Aug 2007 10:52:57 +0000 (06:52 -0400)
under memory pressure scatter gather mode switching messages must be
rate limited.

Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: Ursula Braun <braunu@de.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/s390/net/qeth_main.c

index ba10d42a1a56cd5d655a6de68abf91bbfae0f5d2..610d27cfd28bc6b37610dc8f2908812415997059 100644 (file)
@@ -2803,13 +2803,16 @@ qeth_queue_input_buffer(struct qeth_card *card, int index)
                if (newcount < count) {
                        /* we are in memory shortage so we switch back to
                           traditional skb allocation and drop packages */
-                       if (atomic_cmpxchg(&card->force_alloc_skb, 0, 1))
-                               printk(KERN_WARNING
-                                       "qeth: switch to alloc skb\n");
+                       if (!atomic_read(&card->force_alloc_skb) &&
+                           net_ratelimit())
+                               PRINT_WARN("Switch to alloc skb\n");
+                       atomic_set(&card->force_alloc_skb, 3);
                        count = newcount;
                } else {
-                       if (atomic_cmpxchg(&card->force_alloc_skb, 1, 0))
-                               printk(KERN_WARNING "qeth: switch to sg\n");
+                       if ((atomic_read(&card->force_alloc_skb) == 1) &&
+                           net_ratelimit())
+                               PRINT_WARN("Switch to sg\n");
+                       atomic_add_unless(&card->force_alloc_skb, -1, 0);
                }
 
                /*