All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Tao Cui <cui.tao@linux.dev>
Cc: axboe@kernel.dk, josef@toxicpanda.com, cgroups@vger.kernel.org,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tao Cui <cuitao@kylinos.cn>
Subject: Re: [PATCH v2] block/blk-iocost: read ioc_pd_stat params inside ioc->lock
Date: Mon, 3 Aug 2026 06:47:27 -1000	[thread overview]
Message-ID: <anDGH6An5b_HI8pj@slm.duckdns.org> (raw)
In-Reply-To: <20260803132201.135355-1-cui.tao@linux.dev>

On Mon, Aug 03, 2026 at 09:22:01PM +0800, Tao Cui wrote:
> @@ -3092,9 +3092,12 @@ static void ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
>  {
>  	struct ioc_gq *iocg = pd_to_iocg(pd);
>  	struct ioc *ioc = iocg->ioc;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&ioc->lock, flags);
>  
>  	if (!ioc->enabled)
> -		return;
> +		goto out;
>  
>  	if (iocg->level == 0) {
>  		unsigned vp10k = DIV64_U64_ROUND_CLOSEST(
> @@ -3110,6 +3113,8 @@ static void ioc_pd_stat(struct blkg_policy_data *pd, struct seq_file *s)
>  			iocg->last_stat.wait_us,
>  			iocg->last_stat.indebt_us,
>  			iocg->last_stat.indelay_us);
> +out:
> +	spin_unlock_irqrestore(&ioc->lock, flags);
>  }

There's nothing in this function that requires synchronized reads. Might as
well just annotate them with data_race(). Otherwise, this can lead to a lot
of lock operations when there are a lot of cgroups and high frequency stat
reads.

Thanks.

-- 
tejun

  reply	other threads:[~2026-08-03 16:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 13:22 [PATCH v2] block/blk-iocost: read ioc_pd_stat params inside ioc->lock Tao Cui
2026-08-03 16:47 ` Tejun Heo [this message]
2026-08-04  3:04   ` Tao Cui

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=anDGH6An5b_HI8pj@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=cui.tao@linux.dev \
    --cc=cuitao@kylinos.cn \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.