Re: [RFC][PATCHv3 1/5] printk: move printk_pending out of per-cpu

From: Petr Mladek
Date: Thu May 25 2017 - 08:11:16 EST


On Tue 2017-05-09 17:28:55, Sergey Senozhatsky wrote:
> Do not keep `printk_pending' in per-CPU area. We set the following bits
> of printk_pending:
> a) PRINTK_PENDING_WAKEUP
> when we need to wakeup klogd
> b) PRINTK_PENDING_OUTPUT
> when there is a pending output from deferred printk and we need
> to call console_unlock().
>
> So none of the bits control/represent a state of a particular CPU and,
> basically, they should be global instead.
>
> Besides we will use `printk_pending' to control printk kthread, so this
> patch is also a preparation work.
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
> Suggested-by: Petr Mladek <pmladek@xxxxxxxx>
> ---
> kernel/printk/printk.c | 26 ++++++++++++--------------
> 1 file changed, 12 insertions(+), 14 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index a1aecf44ab07..2cb7f4753b76 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -401,6 +401,14 @@ DEFINE_RAW_SPINLOCK(logbuf_lock);
> printk_safe_exit_irqrestore(flags); \
> } while (0)
>
> +/*
> + * Delayed printk version, for scheduler-internal messages:
> + */
> +#define PRINTK_PENDING_WAKEUP 0x01
> +#define PRINTK_PENDING_OUTPUT 0x02
> +
> +static unsigned long printk_pending;
> +
> #ifdef CONFIG_PRINTK

The variable is used only when CONFIG_PRINTK is defined at
the moment, so this produces a warning about an unused variable.

Otherwise, the patch looks fine to me.

Best Regards,
Petr