Re: [RFC][PATCHv3 2/5] printk: introduce printing kernel thread

Sergey Senozhatsky
2017-07-05T16:37:57Z

Hello,

On (07/02/17 22:27), Pavel Machek wrote:
[..]
> > +#define PRINTK_FLOOD_DEFAULT_DELAY 10
> > +
> > int printk_delay_msec __read_mostly;
>
> = 10;

the idea is to throttle printk() only (and as long as) when we see
that something is not right. like when we added 4 (a random number)
times more messages that we were able to print so far. printk_delay_msec
would throttle all printk calls. there is a difference.

there are some cases that are sort of broken with this automatic
throttling. the simples one is printk() under console_lock().
the harder one is throttling printk() from IRQ context. that
can be risky, in theory. may be I'm overcomplicating here; if
the system has hard locked up due to printk throttling from IRQ,
then probably it was going to lockup anyway.

need to check sysrq-t case, tho.

> > + if (console_seen < 4 * console_to_see) {
> > + if (printk_delay_msec)
> > + __printk_delay(printk_delay_msec);
> > + else
> > + __printk_delay(PRINTK_FLOOD_DEFAULT_DELAY);
>
> And get rid of if () here? We want to enable delays of 0...

this if () is totally useless and stupid, yes. realized after I sent
the mail.

-ss