Re: [PATCH v3 4/4] xen/console: reduce number of printouts in __printk_ratelimit()
| Newsgroups | org.xenproject.lists.xen-devel |
|---|---|
| Message-ID | <alrlAq2/8HHkL8ty@kraken> |
On Thu, Jul 16, 2026 at 05:49:35PM +0200, Jan Beulich wrote: > On 15.07.2026 22:19, [email protected] wrote: > > From: Denis Mukhin <[email protected]> > > > > Fold several __putstr() calls into one around notification of how many > > messages have been rate-limited. > > > > Not a functional change. > > > > Signed-off-by: Denis Mukhin <[email protected]> > > Hmm, the upsides and downsides aren't being discussed at all. You're ... > > > --- a/xen/drivers/char/console.c > > +++ b/xen/drivers/char/console.c > > @@ -1303,15 +1303,15 @@ bool __printk_ratelimit(unsigned int ratelimit_ms, > > spin_unlock(&ratelimit_lock); > > if ( lost ) > > { > > - char lost_str[10]; > > + char msg[64]; > > + > > + snprintf(msg, sizeof(msg), > > + "printk: %u messages suppressed\n", lost); > > > > - snprintf(lost_str, sizeof(lost_str), "%u", lost); > > /* console_lock may already be acquired by printk(). */ > > rspin_lock(&console_lock); > > printk_start_of_line(CONSOLE_PREFIX); > > - __putstr("printk: "); > > - __putstr(lost_str); > > - __putstr(" messages suppressed.\n"); > > + __putstr(msg); > > rspin_unlock(&console_lock); > > } > > local_irq_restore(flags); > > ... trading slightly smaller code size + slightly better performance for > slightly bigger stack utilization. It's not entirely obvious that this is > a good deal. Thanks for the feedback! I will drop that patch from the series.