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