aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ratelimit.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-04-08 07:36:36 -0400
committerIngo Molnar <mingo@elte.hu>2010-04-08 07:37:18 -0400
commitca7e0c612005937a4a5a75d3fed90459993de65c (patch)
treeb574fc0f0189b52ffc87ba20c418228db556faa1 /lib/ratelimit.c
parent8141d0050d76e5695011b5ab577ec66fb51a998c (diff)
parentf5284e7635787224dda1a2bf82a4c56b1c75671f (diff)
Merge branch 'linus' into perf/core
Semantic conflict: arch/x86/kernel/cpu/perf_event_intel_ds.c Merge reason: pick up latest fixes, fix the conflict Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'lib/ratelimit.c')
-rw-r--r--lib/ratelimit.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index 09f5ce1810dc..027a03f4c56d 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -16,9 +16,14 @@
16/* 16/*
17 * __ratelimit - rate limiting 17 * __ratelimit - rate limiting
18 * @rs: ratelimit_state data 18 * @rs: ratelimit_state data
19 * @func: name of calling function
19 * 20 *
20 * This enforces a rate limit: not more than @rs->ratelimit_burst callbacks 21 * This enforces a rate limit: not more than @rs->burst callbacks
21 * in every @rs->ratelimit_jiffies 22 * in every @rs->interval
23 *
24 * RETURNS:
25 * 0 means callbacks will be suppressed.
26 * 1 means go ahead and do it.
22 */ 27 */
23int ___ratelimit(struct ratelimit_state *rs, const char *func) 28int ___ratelimit(struct ratelimit_state *rs, const char *func)
24{ 29{
@@ -35,7 +40,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
35 * the entity that is holding the lock already: 40 * the entity that is holding the lock already:
36 */ 41 */
37 if (!spin_trylock_irqsave(&rs->lock, flags)) 42 if (!spin_trylock_irqsave(&rs->lock, flags))
38 return 1; 43 return 0;
39 44
40 if (!rs->begin) 45 if (!rs->begin)
41 rs->begin = jiffies; 46 rs->begin = jiffies;