-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'core-printk-for-linus' of git://git.kernel.org/pub/scm/…
…linux/kernel/git/tip/linux-2.6-tip * 'core-printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: ratelimit: Make suppressed output messages more useful printk: Remove ratelimit.h from kernel.h ratelimit: Fix/allow use in atomic contexts ratelimit: Use per ratelimit context locking
- Loading branch information
Showing
8 changed files
with
61 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
#ifndef _LINUX_RATELIMIT_H | ||
#define _LINUX_RATELIMIT_H | ||
|
||
#include <linux/param.h> | ||
#include <linux/spinlock_types.h> | ||
|
||
#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) | ||
#define DEFAULT_RATELIMIT_BURST 10 | ||
#define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) | ||
#define DEFAULT_RATELIMIT_BURST 10 | ||
|
||
struct ratelimit_state { | ||
int interval; | ||
int burst; | ||
int printed; | ||
int missed; | ||
unsigned long begin; | ||
spinlock_t lock; /* protect the state */ | ||
|
||
int interval; | ||
int burst; | ||
int printed; | ||
int missed; | ||
unsigned long begin; | ||
}; | ||
|
||
#define DEFINE_RATELIMIT_STATE(name, interval, burst) \ | ||
struct ratelimit_state name = {interval, burst,} | ||
#define DEFINE_RATELIMIT_STATE(name, interval_init, burst_init) \ | ||
\ | ||
struct ratelimit_state name = { \ | ||
.lock = __SPIN_LOCK_UNLOCKED(name.lock), \ | ||
.interval = interval_init, \ | ||
.burst = burst_init, \ | ||
} | ||
|
||
extern int ___ratelimit(struct ratelimit_state *rs, const char *func); | ||
#define __ratelimit(state) ___ratelimit(state, __func__) | ||
|
||
extern int __ratelimit(struct ratelimit_state *rs); | ||
#endif | ||
#endif /* _LINUX_RATELIMIT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters