Skip to content

Commit

Permalink
ipoib: Make ipoib_warn ratelimited
Browse files Browse the repository at this point in the history
In certain cases it's possible to be flooded by warning messages. To
cope with such situations make the ipoib_warn macro be ratelimited.
To prevent accidental limiting of legitimate, bursty messages make
the limit fairly liberal by allowing up to 100 messages in 10 seconds.

Signed-off-by: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
kernel@kyup.com authored and Doug Ledford committed Oct 7, 2016
1 parent fb6375d commit 32f7451
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/infiniband/ulp/ipoib/ipoib.h
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,13 @@ static inline void ipoib_unregister_debugfs(void) { }
#define ipoib_printk(level, priv, format, arg...) \
printk(level "%s: " format, ((struct ipoib_dev_priv *) priv)->dev->name , ## arg)
#define ipoib_warn(priv, format, arg...) \
ipoib_printk(KERN_WARNING, priv, format , ## arg)
do { \
static DEFINE_RATELIMIT_STATE(_rs, \
10 * HZ /*10 seconds */, \
100); \
if (__ratelimit(&_rs)) \
ipoib_printk(KERN_WARNING, priv, format , ## arg);\
} while (0)

extern int ipoib_sendq_size;
extern int ipoib_recvq_size;
Expand Down

0 comments on commit 32f7451

Please sign in to comment.