Re: [PATCH printk v1 10/13] printk: add kthread console printers

From: John Ogness
Date: Tue Feb 08 2022 - 06:33:38 EST


On 2022-02-08, Hillf Danton <hdanton@xxxxxxxx> wrote:
> On Mon, 7 Feb 2022 20:49:20 +0106 John Ogness wrote:
>> Create a kthread for each console to perform console printing. During
>> normal operation (@system_state == SYSTEM_RUNNING), the kthread
>> printers are responsible for all printing on their respective
>> consoles.
>
> The code becomes simpler if the kthread is replaced with a workqueue
> work, given the system workers.

We do not want multiple console printers blocking each other. We also
would not want the consoles blocking non-printk work items for extended
periods of time. So we would likely need a dedicated worker per
console. I'm not convinced the code would look simpler just by changing
the deferred work API. But perhaps the kernel community wants to get
away from manual kthread management in general. (??)

I am now pondering if there is some technical advantages to
workqueues. I suppose with dedicated workers, you could still easily
adjust CPU affinities and scheduling policies/priorites from userspace,
like with kthreads. But is there some advantage over kthreads?

John Ogness