Re: [RFC][PATCH] bug: Add _ONCE logic to report_bug()

From: Ingo Molnar
Date: Sat Feb 25 2017 - 04:19:42 EST



* Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

>
> Josh suggested moving the _ONCE logic inside the trap handler, using a
> bit in the bug_entry::flags field, avoiding the need for the extra
> variable.

This looks interesting, as the _ONCE() methods of warning are far more
user-friendly than WARN() spam.

> Sadly this only works for WARN_ON_ONCE(), since the others have
> printk() statements prior to triggering the trap.

Which one is problematic to convert, WARN_ONCE()?

> Still, this saves some text and data:
>
> text data bss dec hex filename
> 10469505 4443448 843776 15756729 f06db9 defconfig-build/vmlinux-ud0
> 10452803 4442616 843776 15739195 f0293b defconfig-build/vmlinux-ud0-once
>
> (Only compile tested on x86_64 so far.)

That looks pretty sweet, as various almost never triggered _ONCE() checks tend to
disturb the generated machine code quite a bit ...

Thanks,

Ingo