diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index 7a799c4..689bbaf 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c @@ -109,6 +109,7 @@ struct blk_mq_tags *blk_mq_init_tags(unsigned int total_tags, { unsigned int nr_tags, nr_cache; struct blk_mq_tags *tags; + unsigned int num_cpus; int ret; if (total_tags > BLK_MQ_TAG_MAX) { @@ -121,7 +122,8 @@ struct blk_mq_tags *blk_mq_init_tags(unsigned int total_tags, return NULL; nr_tags = total_tags - reserved_tags; - nr_cache = nr_tags / num_possible_cpus(); + num_cpus = min(8U, num_online_cpus()); + nr_cache = nr_tags / num_cpus; if (nr_cache < BLK_MQ_TAG_CACHE_MIN) nr_cache = BLK_MQ_TAG_CACHE_MIN;