Re: [PATCH 0/3] dm-verity: optionally use tasklets in dm-verity
From: Sebastian Andrzej Siewior
Date: Mon Aug 15 2022 - 07:35:34 EST
On 2022-07-22 13:12:36 [-0400], Mike Snitzer wrote:
> On Fri, Jul 22 2022 at 12:41P -0400,
> Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>
> > We've been tying to kill off task lets for about 15 years. I don't
> > think adding new users will make you a whole lot of friends..
>
> I don't have perspective on how serious that effort is. But ~2 years
> ago DM introduced another consumer of tasklets in dm-crypt, see:
> 39d42fa96ba1 dm crypt: add flags to optionally bypass kcryptd workqueues
I tried to get rid of the in_atomic() as it appeared work "magic" in
there and in ended in a pointless discussion…
> Given that, and other numerous users, is the effort to remove tasklets
> valid? What is the alternative to tasklets?
The tasklets end up as anonymous load in the system. It is usually not
visible due to the way accounting usually works (yes we do have full
accounting) and you can't distinguish between work from USB-cam,
storage, … if everything is fed into the same context. This becomes a
problem on a smaller/ slower system of one softirq throttles the other
(say the webcam processing gets delayed due to other tasklets).
With the tasklet/BH context you need to disable BH while acquiring a
spin_lock() so this ends up a per-CPU BKL since a random spin_lock_bh()
is also synchronised again the timer as well as large parts of the
networking subsystem and so on. This seems not to bother anyone in
general it becomes a problem on PREEMPT_RT where this becomes visible.
In general, a tasklet runs after the interrupt handler and were
introduced a long time ago, before we had threaded interrupts available.
Therefore threaded interrupts are a good substitute.
> Mike
Sebastian