Re: [PATCH 4/8] blk-mq: Facilitate a shared sbitmap per tagset

John Garry
2019-11-26T13:59:44Z

> + blk_mq_free_tags(tags);
> }
>
> struct blk_mq_tags *blk_mq_alloc_rq_map(struct blk_mq_tag_set *set,
> unsigned int hctx_idx,
> unsigned int nr_tags,
> - unsigned int reserved_tags)
> + unsigned int reserved_tags,
> + bool shared_tags)
> {
> struct blk_mq_tags *tags;
> int node;
> @@ -2096,8 +2098,9 @@ struct blk_mq_tags *blk_mq_alloc_rq_map(struct blk_mq_tag_set *set,
> if (node == NUMA_NO_NODE)
> node = set->numa_node;
>
> - tags = blk_mq_init_tags(nr_tags, reserved_tags, node,
> - BLK_MQ_FLAG_TO_ALLOC_POLICY(set->flags));
> + tags = blk_mq_init_tags(set, nr_tags, reserved_tags, node,
> + BLK_MQ_FLAG_TO_ALLOC_POLICY(set->flags),
> + shared_tags);
> if (!tags)
> return NULL;
>
> @@ -2105,7 +2108,8 @@ struct blk_mq_tags *blk_mq_alloc_rq_map(struct blk_mq_tag_set *set,
> GFP_NOIO | __GFP_NOWARN | __GFP_NORETRY,
> node);
> if (!tags->rqs) {
> - blk_mq_free_tags(tags);
> + if (!blk_mq_is_sbitmap_shared(set))
> + blk_mq_free_tags(tags);

Don't we still need to free the tags memory but not have the
blk_mq_free_tags()->sbitmap_queue_free() calls in case of shared tags?

> return NULL;
> }
>
> @@ -2114,7 +2118,8 @@ struct blk_mq_tags *blk_mq_alloc_rq_map(struct blk_mq_tag_set *set,
> node);
> if (!tags->static_rqs) {
> kfree(tags->rqs);
> - blk_mq_free_tags(tags);
> + if (!blk_mq_is_sbitmap_shared(set))
> + blk_mq_free_tags(tags);
> return NULL;
> }