Re: [PATCH v3 4/4] xen/console: reduce number of printouts in __printk_ratelimit()

Jan Beulich <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
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.

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.