Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1430788

Re: [PATCH] printk: introduce should_ignore_loglevel()

From Petr Mladek <pmladek@suse.com>
Newsgroups linux.kernel
Subject Re: [PATCH] printk: introduce should_ignore_loglevel()
Date 2016-06-24 18:10 +0200
Message-ID <rNBQ5-1SP-1@gated-at.bofh.it> (permalink)
References <rNfPz-4cB-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] printk: introduce should_ignore_loglevel() Petr Mladek <pmladek@suse.com> - 2016-06-24 18:10 +0200
  Re: [PATCH] printk: introduce should_ignore_loglevel() Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-06-25 07:30 +0200
    Re: [PATCH] printk: introduce should_ignore_loglevel() Petr Mladek <pmladek@suse.com> - 2016-06-27 11:30 +0200
      Re: [PATCH] printk: introduce should_ignore_loglevel() Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-06-27 15:10 +0200

csiph-web