All of
 help / color / mirror / Atom feed
From: Tejun Heo <>
To: Jens Axboe <>
Subject: [PATCH block-5.15] blk-cgroup: blk_cgroup_bio_start() should use irq-safe operations on blkg->iostat_cpu
Date: Thu, 14 Oct 2021 13:20:22 -1000	[thread overview]
Message-ID: <> (raw)

c3df5fb57fe8 ("cgroup: rstat: fix A-A deadlock on 32bit around
u64_stats_sync") made u64_stats updates irq-safe to avoid A-A deadlocks.
Unfortunately, the conversion missed one in blk_cgroup_bio_start(). Fix it.

Fixes: 2d146aa3aa84 ("mm: memcontrol: switch to rstat")
Cc: # v5.13+
Signed-off-by: Tejun Heo <>
 block/blk-cgroup.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 31fe9be179d99..7d0509d9f4ea8 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1906,10 +1906,11 @@ void blk_cgroup_bio_start(struct bio *bio)
 	int rwd = blk_cgroup_io_type(bio), cpu;
 	struct blkg_iostat_set *bis;
+	unsigned long flags;
 	cpu = get_cpu();
 	bis = per_cpu_ptr(bio->bi_blkg->iostat_cpu, cpu);
-	u64_stats_update_begin(&bis->sync);
+	flags = u64_stats_update_begin_irqsave(&bis->sync);
 	 * If the bio is flagged with BIO_CGROUP_ACCT it means this is a split
@@ -1921,7 +1922,7 @@ void blk_cgroup_bio_start(struct bio *bio)
-	u64_stats_update_end(&bis->sync);
+	u64_stats_update_end_irqrestore(&bis->sync, flags);
 	if (cgroup_subsys_on_dfl(io_cgrp_subsys))
 		cgroup_rstat_updated(bio->bi_blkg->blkcg->css.cgroup, cpu);

             reply	other threads:[~2021-10-14 23:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14 23:20 Tejun Heo [this message]
2021-10-17 16:40 ` Jens Axboe

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:

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

  git send-email \ \ \ \ \ \
    --subject='Re: [PATCH block-5.15] blk-cgroup: blk_cgroup_bio_start() should use irq-safe operations on blkg->iostat_cpu' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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.