lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3b5caa0e-e63b-3652-cd64-e6cdb9323242@acm.org>
Date:   Thu, 6 Jul 2023 11:13:07 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     Yu Kuai <yukuai1@...weicloud.com>, axboe@...nel.dk
Cc:     linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        yukuai3@...wei.com, yi.zhang@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH RFC 4/7] blk-mq: precalculate available tags for
 hctx_may_queue()

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ