Re: [RFC][PATCHv4 0/7] printk: introduce printing kernel threads

From: Petr Mladek
Date: Fri Jun 30 2017 - 08:15:09 EST


On Thu 2017-06-29 16:56:30, Sergey Senozhatsky wrote:
> yeah, I agree and understand that per-CPU printk kthreads
> is a bit... too much.
>
> it was just a quick idea and I just gave it a try. but there
> are some potential takeaways from the series (not sure if you
> looked at the last patches of the series).
>
> with per-CPU kthreads we easily
>
> 1) can be quite flexible
> there can be only certain CPUs that will take over printing duty.
> so if you system has, say, IRQ affinity set up or anything else
> that is critical, you can forbid printk offloading to those CPUs.
> so "important" CPUs will not print out more than atomic_limit chars,
> the rest of the job will be handled by "less important" CPUs.
>
> * this can be achieved with a single printk kthread.
> but still, that's something I haven't thought about before this
> series.

Sounds interesting. Well, I would prefer to leave this for
further optimization. It is a completely new area and it might
open another can of worms.

> 2) can offload printing to other CPUs from vprintk_emit()
> and avoid any of scheduler->timekeeping->etc. paths. which will
> replace printk_deferred().

I probably miss something. There is still called wake_up_process()
in this patchset and we could not do this in some scheduler and
timekeeping paths. Also we must not take the console_lock() in
these paths because it calls wake_up_process() as well. But
we want to flush few lines when possible.

Best Regards,
Petr