dm-crypt: export sysfs of all workqueues
authoryangerkun <yangerkun@huawei.com>
Tue, 11 Jul 2023 06:11:29 +0000 (14:11 +0800)
committerMike Snitzer <snitzer@kernel.org>
Tue, 16 Apr 2024 15:34:47 +0000 (11:34 -0400)
commit2285e1496dc68787a626145cfb0904a1b6cc5501
tree2bc6c5285399d2a942b647883420600b1ebaa9d4
parent5268de78e1e61c828174cb2ac7d9c566a97cce69
dm-crypt: export sysfs of all workqueues

Once there is a heavy IO load, so many encrypt/decrypt work will occupy
all of the cpu, which may lead to the poor performance for other service.
So the improved visibility and controls over dm-crypt workqueues, as
was offered with commit a2b8b2d97567 ("dm crypt: export sysfs of
kcryptd workqueue"), seems necessary. By exporting dm-crypt's
workqueues in sysfs, the entry like cpumask/max_active and so on can
help us to limit the CPU usage for encrypt/decrypt work.

However, commit a2b8b2d97567 did not consider that DM table reload
will call .ctr before .dtr, so the reload for dm-crypt failed because
the same sysfs name was present. This was the original need for commit
48b0777cd93d ("Revert "dm crypt: export sysfs of kcryptd workqueue"").

Reintroduce the use of WQ_SYSFS, and use it for both the IO and crypt
workqueues, but make the workqueue names include a unique id (via ida)
to allow both old and new sysfs entries to coexist.

Signed-off-by: yangerkun <yangerkun@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
drivers/md/dm-crypt.c