lkml.org 
[lkml]   [2023]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH RFC 4/7] blk-mq: precalculate available tags for hctx_may_queue()
From
On 6/18/23 09:07, Yu Kuai wrote:
> +static void blk_mq_update_available_driver_tags(struct blk_mq_hw_ctx *hctx)
> +{
> + struct blk_mq_tags *tags = hctx->tags;
> + unsigned int nr_tags;
> + struct tag_sharing *tag_sharing;
> +
> + if (tags->ctl.share_queues <= 1)
> + nr_tags = tags->nr_tags;
> + else
> + nr_tags = max((tags->nr_tags + tags->ctl.share_queues - 1) /
> + tags->ctl.share_queues, 4U);
> +
> + list_for_each_entry(tag_sharing, &tags->ctl.head, node)
> + tag_sharing->available_tags = nr_tags;
> +}

Since READ_ONCE() is used to read the available_tags member, WRITE_ONCE()
should be used to update that member, even if a spinlock is held around
the update.

Thanks,

Bart.

\
 
 \ /
  Last update: 2023-07-06 20:13    [W:0.103 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site