lkml.org 
[lkml]   [2016]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -v3.1 1/2] ratelimit: Extend to print suppressed messages on release
On Wed, 6 Jul 2016 15:28:00 +0200
Borislav Petkov <bp@alien8.de> wrote:

> extern struct ratelimit_state printk_ratelimit_state;
> diff --git a/lib/ratelimit.c b/lib/ratelimit.c
> index 2c5de86460c5..734cba5c8842 100644
> --- a/lib/ratelimit.c
> +++ b/lib/ratelimit.c
> @@ -46,12 +46,15 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
> rs->begin = jiffies;
>
> if (time_is_before_jiffies(rs->begin + rs->interval)) {
> - if (rs->missed)
> - printk(KERN_WARNING "%s: %d callbacks suppressed\n",
> - func, rs->missed);
> - rs->begin = jiffies;
> - rs->printed = 0;
> - rs->missed = 0;
> + if (rs->missed) {
> + if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) {
> + pr_warn("%s: %d callbacks suppressed\n", func, rs->missed);
> + rs->missed = 0;
> + }
> +
> + rs->begin = jiffies;
> + rs->printed = 0;
> + }

Hmm, the above changes the previous logic. That seems wrong.

Before:

if (rs->missed)
[...]
rs->begin = jiffies;
rs->printed = 0;

after:

if (rs->missed) {
rs->begin = jiffies;
rs->printed = 0;
}

I think you wanted:

if (rs->missed) {
if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) {
[..]
rs->missed = 0;
}
}
rs->begin = jiffies;
rs->printed = 0;

-- Steve



> }
> if (rs->burst && rs->burst > rs->printed) {
> rs->printed++;

\
 
 \ /
  Last update: 2016-07-06 16:21    [W:0.068 / U:4.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site