Skip to content

Commit fb6ad4a

Browse files
htejunMike Snitzer
authored andcommitted
dm-crypt: Convert from tasklet to BH workqueue
The only generic interface to execute asynchronously in the BH context is tasklet; however, it's marked deprecated and has some design flaws. To replace tasklets, BH workqueue support was recently added. A BH workqueue behaves similarly to regular workqueues except that the queued work items are executed in the BH context. This commit converts dm-crypt from tasklet to BH workqueue. It backfills tasklet code that was removed with commit 0a9bab3 ("dm-crypt, dm-verity: disable tasklets") and tweaks to use BH workqueue. Like a regular workqueue, a BH workqueue allows freeing the currently executing work item. Converting from tasklet to BH workqueue removes the need for deferring bio_endio() again to a work item, which was buggy anyway. I tested this lightly with "--perf-no_read_workqueue --perf-no_write_workqueue" + some code modifications, but would really -appreciate if someone who knows the code base better could take a look. Signed-off-by: Tejun Heo <[email protected]> Link: http://lkml.kernel.org/r/[email protected] [snitzer: rebase ontop of commit 0a9bab3 reduced this commit's changes] Signed-off-by: Mike Snitzer <[email protected]>
1 parent c6df327 commit fb6ad4a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/md/dm-crypt.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,11 @@ static void kcryptd_queue_crypt(struct dm_crypt_io *io)
22962296
* irqs_disabled(): the kernel may run some IO completion from the idle thread, but
22972297
* it is being executed with irqs disabled.
22982298
*/
2299-
if (!(in_hardirq() || irqs_disabled())) {
2299+
if (in_hardirq() || irqs_disabled()) {
2300+
INIT_WORK(&io->work, kcryptd_crypt);
2301+
queue_work(system_bh_wq, &io->work);
2302+
return;
2303+
} else {
23002304
kcryptd_crypt(&io->work);
23012305
return;
23022306
}

0 commit comments

Comments
 (0)