lkml.org 
[lkml]   [2016]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] printk: introduce should_ignore_loglevel()
On Fri 2016-06-24 01:33:02, Sergey Senozhatsky wrote:
> The thing here is this deferred `level >= console_loglevel' check. We are
> wasting CPU cycles on sprintfs/memcpy/etc. preparing the messages that we
> will eventually drop.
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
> kernel/printk/printk.c | 25 +++++++++++++++++++------
> 1 file changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 414a89f..bfb766b 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -987,6 +987,11 @@ module_param(ignore_loglevel, bool, S_IRUGO | S_IWUSR);
> MODULE_PARM_DESC(ignore_loglevel,
> "ignore loglevel setting (prints all kernel messages to the console)");
>
> +static bool should_ignore_loglevel(int level)
> +{
> + return (level >= console_loglevel && !ignore_loglevel);

The patch looks fine. It is nice optimization.

I was just quite confused by the name of this function. A function
called should_ignore_loglevel() should not return false when
ignore_loglevel variable is true.

I would call it ignore_message() or ignore_message_on_console() or so.

Best Regards,
Petr

\
 
 \ /
  Last update: 2016-06-24 18:41    [W:0.067 / U:1.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site