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 @@ -4278,6 +4278,15 @@ struct gendisk *blk_mq_alloc_disk_for_queue(struct request_queue *q,
4278
4278
}
4279
4279
EXPORT_SYMBOL (blk_mq_alloc_disk_for_queue );
4280
4280
4281
+ /*
4282
+ * Only hctx removed from cpuhp list can be reused
4283
+ */
4284
+ static bool blk_mq_hctx_is_reusable (struct blk_mq_hw_ctx * hctx )
4285
+ {
4286
+ return hlist_unhashed (& hctx -> cpuhp_online ) &&
4287
+ hlist_unhashed (& hctx -> cpuhp_dead );
4288
+ }
4289
+
4281
4290
static struct blk_mq_hw_ctx * blk_mq_alloc_and_init_hctx (
4282
4291
struct blk_mq_tag_set * set , struct request_queue * q ,
4283
4292
int hctx_idx , int node )
@@ -4287,7 +4296,7 @@ static struct blk_mq_hw_ctx *blk_mq_alloc_and_init_hctx(
4287
4296
/* reuse dead hctx first */
4288
4297
spin_lock (& q -> unused_hctx_lock );
4289
4298
list_for_each_entry (tmp , & q -> unused_hctx_list , hctx_list ) {
4290
- if (tmp -> numa_node == node ) {
4299
+ if (tmp -> numa_node == node && blk_mq_hctx_is_reusable ( tmp ) ) {
4291
4300
hctx = tmp ;
4292
4301
break ;
4293
4302
}
You can’t perform that action at this time.
0 commit comments