File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -4412,6 +4412,15 @@ struct gendisk *blk_mq_alloc_disk_for_queue(struct request_queue *q,
4412
4412
}
4413
4413
EXPORT_SYMBOL (blk_mq_alloc_disk_for_queue );
4414
4414
4415
+ /*
4416
+ * Only hctx removed from cpuhp list can be reused
4417
+ */
4418
+ static bool blk_mq_hctx_is_reusable (struct blk_mq_hw_ctx * hctx )
4419
+ {
4420
+ return hlist_unhashed (& hctx -> cpuhp_online ) &&
4421
+ hlist_unhashed (& hctx -> cpuhp_dead );
4422
+ }
4423
+
4415
4424
static struct blk_mq_hw_ctx * blk_mq_alloc_and_init_hctx (
4416
4425
struct blk_mq_tag_set * set , struct request_queue * q ,
4417
4426
int hctx_idx , int node )
@@ -4421,7 +4430,7 @@ static struct blk_mq_hw_ctx *blk_mq_alloc_and_init_hctx(
4421
4430
/* reuse dead hctx first */
4422
4431
spin_lock (& q -> unused_hctx_lock );
4423
4432
list_for_each_entry (tmp , & q -> unused_hctx_list , hctx_list ) {
4424
- if (tmp -> numa_node == node ) {
4433
+ if (tmp -> numa_node == node && blk_mq_hctx_is_reusable ( tmp ) ) {
4425
4434
hctx = tmp ;
4426
4435
break ;
4427
4436
}
You can’t perform that action at this time.
0 commit comments