diff options
| -rw-r--r-- | lib/ratelimit.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/ratelimit.c b/lib/ratelimit.c index 0e2c28e8a0ca..69bfcacda16d 100644 --- a/lib/ratelimit.c +++ b/lib/ratelimit.c | |||
| @@ -28,7 +28,15 @@ int __ratelimit(struct ratelimit_state *rs) | |||
| 28 | if (!rs->interval) | 28 | if (!rs->interval) |
| 29 | return 1; | 29 | return 1; |
| 30 | 30 | ||
| 31 | spin_lock_irqsave(&rs->lock, flags); | 31 | /* |
| 32 | * If we contend on this state's lock then almost | ||
| 33 | * by definition we are too busy to print a message, | ||
| 34 | * in addition to the one that will be printed by | ||
| 35 | * the entity that is holding the lock already: | ||
| 36 | */ | ||
| 37 | if (!spin_trylock_irqsave(&rs->lock, flags)) | ||
| 38 | return 1; | ||
| 39 | |||
| 32 | if (!rs->begin) | 40 | if (!rs->begin) |
| 33 | rs->begin = jiffies; | 41 | rs->begin = jiffies; |
| 34 | 42 | ||
