All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][v3] block: don't account for split bio's size in cgroup stats
@ 2018-07-30 14:10 Josef Bacik
  2018-07-30 14:26 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2018-07-30 14:10 UTC (permalink / raw)
  To: axboe, linux-block, kernel-team

We need to check in blkcg_bio_issue_check if the bio is flagged as
QUEUE_ENTERED, because if it is then we've already accounted for the
size of the IO in the cgroup stats.  We can still however account for
the extra IO since it'll be another request.

Reported-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
v2->v3:
- this one actually compiles

 include/linux/blk-cgroup.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h
index 3bed5e02a873..f7b910768306 100644
--- a/include/linux/blk-cgroup.h
+++ b/include/linux/blk-cgroup.h
@@ -769,8 +769,14 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
 
 	if (!throtl) {
 		blkg = blkg ?: q->root_blkg;
-		blkg_rwstat_add(&blkg->stat_bytes, bio->bi_opf,
-				bio->bi_iter.bi_size);
+		/*
+		 * If the bio is flagged with BIO_QUEUE_ENTERED it means this
+		 * is a split bio and we would have already accounted for the
+		 * size of the bio.
+		 */
+		if (!bio_flagged(bio, BIO_QUEUE_ENTERED))
+			blkg_rwstat_add(&blkg->stat_bytes, bio->bi_opf,
+					bio->bi_iter.bi_size);
 		blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1);
 	}
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][v3] block: don't account for split bio's size in cgroup stats
  2018-07-30 14:10 [PATCH][v3] block: don't account for split bio's size in cgroup stats Josef Bacik
@ 2018-07-30 14:26 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2018-07-30 14:26 UTC (permalink / raw)
  To: Josef Bacik, linux-block, kernel-team

On 7/30/18 8:10 AM, Josef Bacik wrote:
> We need to check in blkcg_bio_issue_check if the bio is flagged as
> QUEUE_ENTERED, because if it is then we've already accounted for the
> size of the IO in the cgroup stats.  We can still however account for
> the extra IO since it'll be another request.

Applied, thanks.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-30 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-30 14:10 [PATCH][v3] block: don't account for split bio's size in cgroup stats Josef Bacik
2018-07-30 14:26 ` Jens Axboe

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.