public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Yu Kuai <yukuai1@huaweicloud.com>, axboe@kernel.dk
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	yukuai3@huawei.com, yi.zhang@huawei.com, yangerkun@huawei.com
Subject: Re: [PATCH RFC 5/7] blk-mq: record the number of times fail to get driver tag while sharing tags
Date: Thu, 6 Jul 2023 11:18:41 -0700	[thread overview]
Message-ID: <d533a9d7-8fbc-4adf-e4a2-5a5a47a00470@acm.org> (raw)
In-Reply-To: <20230618160738.54385-6-yukuai1@huaweicloud.com>

On 6/18/23 09:07, Yu Kuai wrote:
> +static void update_tag_sharing_busy(struct tag_sharing *tag_sharing)
> +{
> +	unsigned int count = atomic_inc_return(&tag_sharing->fail_count);
> +	unsigned long last_period = READ_ONCE(tag_sharing->period);
> +
> +	if (time_after(jiffies, last_period + HZ) &&
> +	    cmpxchg_relaxed(&tag_sharing->period, last_period, jiffies) ==
> +			    last_period)
> +		atomic_sub(count / 2, &tag_sharing->fail_count);
> +}

For new code, try_cmpxchg_relaxed() is preferred over cmpxchg_relaxed().

>   struct tag_sharing {
>   	struct list_head	node;
>   	unsigned int		available_tags;
> +	atomic_t		fail_count;
> +	unsigned long		period;
>   };

Please consider renaming "period" into "latest_reduction" or any other name
that make the purpose of this member clear.

Thanks,

Bart.


  reply	other threads:[~2023-07-06 18:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-18 16:07 [PATCH RFC 0/7] blk-mq: improve tag fair sharing Yu Kuai
2023-06-18 16:07 ` [PATCH RFC 1/7] blk-mq: factor out a structure from blk_mq_tags to control tag sharing Yu Kuai
2023-07-06 17:43   ` Bart Van Assche
2023-06-18 16:07 ` [PATCH RFC 2/7] blk-mq: delay tag fair sharing until fail to get driver tag Yu Kuai
2023-06-19  5:55   ` Hannes Reinecke
2023-06-19  6:07     ` Yu Kuai
2023-07-06 18:00   ` Bart Van Assche
2023-06-18 16:07 ` [PATCH RFC 3/7] blk-mq: support to track active queues from blk_mq_tags Yu Kuai
2023-07-06 18:01   ` Bart Van Assche
2023-06-18 16:07 ` [PATCH RFC 4/7] blk-mq: precalculate available tags for hctx_may_queue() Yu Kuai
2023-07-06 18:13   ` Bart Van Assche
2023-06-18 16:07 ` [PATCH RFC 5/7] blk-mq: record the number of times fail to get driver tag while sharing tags Yu Kuai
2023-07-06 18:18   ` Bart Van Assche [this message]
2023-06-18 16:07 ` [PATCH RFC 6/7] blk-mq: move active request counter to struct tag_sharing Yu Kuai
2023-06-18 16:07 ` [PATCH RFC 7/7] blk-mq: allow shared queue to get more driver tags Yu Kuai
2023-06-20 15:20 ` [PATCH RFC 0/7] blk-mq: improve tag fair sharing Bart Van Assche
2023-07-03 13:29   ` Yu Kuai
2023-07-03 18:08     ` Bart Van Assche
2023-07-05  3:17       ` Yu Kuai
2023-07-06 18:43         ` Bart Van Assche
2023-07-07  1:15           ` Yu Kuai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d533a9d7-8fbc-4adf-e4a2-5a5a47a00470@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai1@huaweicloud.com \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox