Re: [PATCH -v2 1/2] ratelimit: Extend to print suppressed messages on release

From: Joe Perches
Date: Wed Jun 29 2016 - 06:25:07 EST


On Wed, 2016-06-29 at 11:56 +0200, Borislav Petkov wrote:
> From: Borislav Petkov <bp@xxxxxxx>
>
> Extend the ratelimiting facility to print the amount of suppressed lines
> when it is being released.
>
> Separated from a previous patch by Linus.
[]
> diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
[]
> @@ -15,6 +19,7 @@ struct ratelimit_state {
>   int printed;
>   int missed;
>   unsigned long begin;
> + unsigned long flags;
>  };

There are a lot of ratelimit_state structs used in the kernel.
Every printk like <foo>_ratelimited uses a static one.

It'd likely be better to reduce the struct ratelimit_state
size rather than expand it.

burst and printed could probably become s16 or even s8.
flags could be u8 until necessary to expand.