From patchwork Mon Jul 30 13:58:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10549125 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83BDB13BB for ; Mon, 30 Jul 2018 13:58:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73C4428867 for ; Mon, 30 Jul 2018 13:58:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 67F7F29733; Mon, 30 Jul 2018 13:58:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04A4929669 for ; Mon, 30 Jul 2018 13:58:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726761AbeG3Pd4 (ORCPT ); Mon, 30 Jul 2018 11:33:56 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:34966 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbeG3Pd4 (ORCPT ); Mon, 30 Jul 2018 11:33:56 -0400 Received: by mail-qt0-f196.google.com with SMTP id a5-v6so12128198qtp.2 for ; Mon, 30 Jul 2018 06:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=EnMAHMLvKHZ0nWh4XoE1dW0cMjQV4vhg64riM+GID94=; b=MSF32fhDQ09bSLHmKxRXKLNVObwFLRXDHo3LCM2cQmhltNooZ7K+OEO1T/TtYSSPPn pSnGYNnXabJ1u2pGQG3LFkuSlLeYAujZ5wWkkXNG38YSW0EScuzjbDnNDMCEtvziyWOO 201Id4UekF/g8hvuAKNvTVq+MMuyZznZ9smVgsoyBAkdQfRkGqAY1To7PVbodYSyyI8S 07Yi/AXdDJfqLD0ufrGu176iIvxqPNTzYBOTGs14u96XODivJ+tdMN7ieuq4cA7EmNQL TQJeUYnUK4I7nFbbbGYCV06F/SJSAH6VIaCKjMtNMq+cEsLle01l1hqSHDxy+Guxpi4m 96Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=EnMAHMLvKHZ0nWh4XoE1dW0cMjQV4vhg64riM+GID94=; b=hiy9Umg/nqNxozGJ+hCEWwK21vUodjOpfSn3rLXFUQ+KBsX+WuLhrZDbFUYVfndvG7 i6pTeouJysk2RRKrkTkAQgWovX3mz5FaSni+3hCqXGKozefcgCDLRuUbOcm6rYNNByf7 K1dogNTEM9Fp1WtV1NZLHegRDhorjDoq3oHsdOA/Qq90qCAp/Kg4E4yr78TtWnenXztK nCVBF1dyxH6ZcjY6fxEQb5y32aUR9maGftvqo1hz5enoTyq9nL55EOvpvZlKHf0TjxNK YgJ3SMA4Lh2XrPY6y2BrTzqKppM0KX2sLw+Vj2kXZnkefiFDbnLloFcGS593VPMAoj4x Zq6w== X-Gm-Message-State: AOUpUlE7UHSYPnJPnjCa73bSteY+NTWDDdnDyS+KBRCv6seYEdLy79rA yaJ2HDlnuP+WvAbY6JtwWjXftIfyvoY= X-Google-Smtp-Source: AAOMgpeMAgdUJBrqlFFpg+z2RIppC0xyXDhjQ5iMo7Ws3FMvknK9T7JHVOcYZ4qFfSIBtUEdwHxB1A== X-Received: by 2002:a0c:afb8:: with SMTP id s53-v6mr15188032qvc.164.1532959128129; Mon, 30 Jul 2018 06:58:48 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id e1-v6sm7187334qkd.15.2018.07.30.06.58.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 06:58:47 -0700 (PDT) From: Josef Bacik To: linux-block@vger.kernel.org, axboe@kernel.dk, kernel-team@fb.com Subject: [PATCH][v2] block: don't account for split bio's size in cgroup stats Date: Mon, 30 Jul 2018 09:58:46 -0400 Message-Id: <20180730135846.18828-1-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Josef Bacik --- v1->v2: - added a comment per Jens's suggestion. - changed it so we only skip the size stat change, we are technically adding another request so keep that part of the stats. 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..45877776b183 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); }