diff options
| author | 2026-10-01 11:10:47 +0800 | |
|---|---|---|
| committer | 2026-10-01 08:35:31 -0600 | |
| commit | 812485c8ff2609489b164415befc7189965e1b38 (patch) | |
| tree | 4e2112de035a527dde2cf4bdd1161be2b4c18deb /scripts/Makefile.thinlto | |
| parent | ublk: don't use an I/O scheduler by default (diff) | |
ublk: drop the device reference outside ublk_ctl_mutex in DEL_DEV
ublk_ctrl_del_dev() drops its reference to the device while holding the
global ublk_ctl_mutex. When this is the last reference, ublk_cdev_rel()
frees the tag set, and blk_mq_free_tag_set() waits for the pending SRCU
callbacks of the tag set with srcu_barrier(). Every DEL_DEV thus waits
for an SRCU grace period with the mutex held, and deleting devices from
several threads serializes on it.
The release path doesn't need ublk_ctl_mutex. The device number is freed
under ublk_idr_lock, and the last reference is already dropped without
the mutex when the ublk server still has the char device open at
DEL_DEV time, from ublk_ch_release_work_fn().
Drop the reference after unlocking ublk_ctl_mutex.
ublk null target, 4000 single-queue devices, STOP_DEV + DEL_DEV issued
from N threads, 16 vCPU KVM guest:
threads before after
1 77.6 s 77.6 s
4 20.1 s 19.4 s
8 19.3 s 9.0 s
16 19.2 s 4.1 s
Signed-off-by: Qiliang Yuan <odys.yuan@gmail.com>
Reviewed-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20261001-bug-ublk-del-dev-put-unlocked-v1-1-18e9bb9be727@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
