Each nbd doit only touches one device's state, and the global state (nbd_index_idr and nbd_total_devices) is accessed briefly under nbd_index_mutex. genl_mutex nevertheless serializes the whole genetlink doit path. The cost that matters is teardown: nbd_disconnect_and_put() calls flush_workqueue() while holding genl_mutex, so a disconnect blocks every other device for the duration of the flush. Enable parallel_ops; the preceding patches make sure no handler relies on genl_mutex for correctness. Test with a minimal netlink client in an 8-vCPU KVM guest, 32 devices x 10 connect/disconnect cycles, median of 3 runs: parallel_ops=0: 378 ms parallel_ops=1: 27 ms Connect-only and status do not improve, since their critical sections are short. Suggested-by: Xiu Jianfeng Assisted-by: LLM Signed-off-by: Yang Erkun --- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index cf2a47fc572d..6a7060773e27 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -2542,6 +2542,7 @@ static struct genl_family nbd_genl_family __ro_after_init = { .hdrsize = 0, .name = NBD_GENL_FAMILY_NAME, .version = NBD_GENL_VERSION, + .parallel_ops = 1, .module = THIS_MODULE, .small_ops = nbd_connect_genl_ops, .n_small_ops = ARRAY_SIZE(nbd_connect_genl_ops), -- 2.52.0