* rate limiting error messages
@ 2001-03-29 16:41 Eli Carter
2001-03-29 17:15 ` Khalid Aziz
0 siblings, 1 reply; 2+ messages in thread
From: Eli Carter @ 2001-03-29 16:41 UTC (permalink / raw)
To: linux-kernel
Can someone point me to a "standard way" of doing rate limiting of error
messages in the kernel?
TIA,
Eli
-----------------------. Rule of Accuracy: When working toward
Eli Carter | the solution of a problem, it always
eli.carter(at)inet.com `------------------ helps if you know the answer.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: rate limiting error messages
2001-03-29 16:41 rate limiting error messages Eli Carter
@ 2001-03-29 17:15 ` Khalid Aziz
0 siblings, 0 replies; 2+ messages in thread
From: Khalid Aziz @ 2001-03-29 17:15 UTC (permalink / raw)
To: Eli Carter; +Cc: linux-kernel
Eli Carter wrote:
>
> Can someone point me to a "standard way" of doing rate limiting of error
> messages in the kernel?
>
> TIA,
>
> Eli
> -----------------------. Rule of Accuracy: When working toward
> Eli Carter | the solution of a problem, it always
> eli.carter(at)inet.com `------------------ helps if you know the answer.
Here is how it is done in IA-64 kernel:
static int
within_logging_rate_limit (void)
{
static unsigned long count, last_time;
if (count > 5 && jiffies - last_time > 5*HZ)
count = 0;
if (++count < 5) {
last_time = jiffies;
return 1;
}
return 0;
}
If this fundction returns 0, error messages have been rate limited. This
code is not MP-safe. So, if you need your code to be MP-safe, you may
need to rewrite it somewhat.
--
Khalid
====================================================================
Khalid Aziz Linux Development Laboratory
(970)898-9214 Hewlett-Packard
khalid@fc.hp.com Fort Collins, CO
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2001-03-29 17:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-29 16:41 rate limiting error messages Eli Carter
2001-03-29 17:15 ` Khalid Aziz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox