All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Gui-Dong Han <hanguidong02@gmail.com>
Cc: Josef Bacik <josef@toxicpanda.com>, Jens Axboe <axboe@kernel.dk>,
	cgroups@vger.kernel.org, linux-block@vger.kernel.org,
	Jia-Ju Bai <baijiaju1990@gmail.com>
Subject: Re: [PATCH] blk-cgroup: publish delay before enabling throttling
Date: Mon, 30 Nov 2026 07:00:16 -1000	[thread overview]
Message-ID: <442deed128ab064df56fd74a4100b8f5@kernel.org> (raw)
In-Reply-To: <20261130133403.3789095-1-hanguidong02@gmail.com>

Hello, Gui-Dong.

On Mon, Nov 30, 2026 at 09:34:03PM +0800, Gui-Dong Han wrote:
> blkcg_set_delay() sets blkg->use_delay to -1 before storing
> blkg->delay_nsec, so another CPU can see throttling enabled with a zero
> or stale delay:
...
> Store delay_nsec before enabling use_delay, and pair
> atomic_try_cmpxchg() with atomic_read_acquire(&blkg->use_delay) in
> blkcg_maybe_throttle_blkg() so the delay_nsec load is ordered after the
> use_delay check.

The race window is tiny and the effect is transient. AFAICS, the worst that
can happen is a task skipping one throttle or sleeping once on the previous
delay, and the delay mechanism is approximate to begin with. I don't think
this matters in practice and wouldn't call the current code broken. Maybe
this just needs a comment noting that the reader can see use_delay and
delay_nsec out of sync and that it's harmless?

Thanks.

--
tejun

      reply	other threads:[~2026-11-30 17:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 13:34 [PATCH] blk-cgroup: publish delay before enabling throttling Gui-Dong Han
2026-11-30 17:00 ` Tejun Heo [this message]

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=442deed128ab064df56fd74a4100b8f5@kernel.org \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=baijiaju1990@gmail.com \
    --cc=cgroups@vger.kernel.org \
    --cc=hanguidong02@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@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.