Re: [PATCH 7/8] dm-crypt: Convert from tasklet to BH workqueue
From: Tejun Heo
Date: Tue Jan 30 2024 - 10:53:44 EST
Hello,
On Tue, Jan 30, 2024 at 11:46:45AM +0100, Sebastian Andrzej Siewior wrote:
> On 2024-01-29 23:11:54 [-1000], Tejun Heo wrote:
> > if (in_hardirq() || irqs_disabled()) {
> > - io->in_tasklet = true;
> > - tasklet_init(&io->tasklet, kcryptd_crypt_tasklet, (unsigned long)&io->work);
> > - tasklet_schedule(&io->tasklet);
> > + INIT_WORK(&io->work, kcryptd_crypt);
> > + queue_work(system_bh_wq, &io->work);
>
> Why do we need the tasklet here in the first place? Couldn't we use
> workqueue? As per comment, the request originates in hardirq and then it
> is moved to tasklet. Couldn't it be moved to workqueue regardless?
Yes, you can and if you replace that system_bh_wq with system_wq, or
system_highpri_wq, everything should be fine in terms of correctness.
However, that would mean that the work item now would always incur a
scheduling latency which can be lengthy in certain circumstances. Whether
that's an actual problem for the subsystem at hand, I have no idea.
Thanks.
--
tejun