linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: Faiz Abbas <faiz_abbas@ti.com>,
	cgroups@vger.kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, lizefan@huawei.com,
	hannes@cmpxchg.org, kernel-team@fb.com,
	Dan Schatzberg <dschatzberg@fb.com>, Daniel Xu <dlxu@fb.com>
Subject: [PATCH block/for-next] blk-cgroup: cgroup_rstat_updated() shouldn't be called on cgroup1
Date: Thu, 14 Nov 2019 14:31:28 -0800	[thread overview]
Message-ID: <20191114223128.GM4163745@devbig004.ftw2.facebook.com> (raw)
In-Reply-To: <20191113163501.GI4163745@devbig004.ftw2.facebook.com>

Currently, cgroup rstat is supported only on cgroup2 hierarchy and
rstat functions shouldn't be called on cgroup1 cgroups.  While
converting blk-cgroup core statistics to rstat, f73316482977
("blk-cgroup: reimplement basic IO stats using cgroup rstat")
accidentally ended up calling cgroup_rstat_updated() on cgroup1
cgroups causing crashes.

Longer term, we probably should add cgroup1 support to rstat but for
now let's mask the call directly.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: f73316482977 ("blk-cgroup: reimplement basic IO stats using cgroup rstat")
---
 include/linux/blk-cgroup.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index 48a66738143d..19394c77ed99 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -626,7 +626,8 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
 		bis->cur.ios[rwd]++;
 
 		u64_stats_update_end(&bis->sync);
-		cgroup_rstat_updated(blkg->blkcg->css.cgroup, cpu);
+		if (cgroup_subsys_on_dfl(io_cgrp_subsys))
+			cgroup_rstat_updated(blkg->blkcg->css.cgroup, cpu);
 		put_cpu();
 	}
 

  parent reply	other threads:[~2019-11-14 22:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 19:17 [PATCHSET v2 block/for-next] blk-cgroup: use cgroup rstat for IO stats Tejun Heo
2019-11-07 19:17 ` [PATCH 1/6] bfq-iosched: relocate bfqg_*rwstat*() helpers Tejun Heo
2019-11-07 19:18 ` [PATCH 2/6] bfq-iosched: stop using blkg->stat_bytes and ->stat_ios Tejun Heo
2019-11-07 19:18 ` [PATCH 3/6] blk-throtl: " Tejun Heo
2019-11-07 19:18 ` [PATCH 4/6] blk-cgroup: remove now unused blkg_print_stat_{bytes|ios}_recursive() Tejun Heo
2019-11-07 19:18 ` [PATCH 5/6] blk-cgroup: reimplement basic IO stats using cgroup rstat Tejun Heo
2019-11-13 11:13   ` Faiz Abbas
2019-11-13 16:35     ` Tejun Heo
2019-11-14 12:17       ` Ionela Voinescu
2019-11-14 22:31       ` Tejun Heo [this message]
2019-11-18  8:39         ` [PATCH block/for-next] blk-cgroup: cgroup_rstat_updated() shouldn't be called on cgroup1 Faiz Abbas
2019-11-18 15:41         ` Jens Axboe
2019-11-07 19:18 ` [PATCH 6/6] blk-cgroup: separate out blkg_rwstat under CONFIG_BLK_CGROUP_RWSTAT Tejun Heo
2019-11-07 19:28 ` [PATCHSET v2 block/for-next] blk-cgroup: use cgroup rstat for IO stats 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:
  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=20191114223128.GM4163745@devbig004.ftw2.facebook.com \
    --to=tj@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=dlxu@fb.com \
    --cc=dschatzberg@fb.com \
    --cc=faiz_abbas@ti.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@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;
as well as URLs for NNTP newsgroup(s).