From patchwork Mon Jul 30 14:10:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10549131 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 4E30313BB for ; Mon, 30 Jul 2018 14:10:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34CB229F10 for ; Mon, 30 Jul 2018 14:10:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3205329F4D; Mon, 30 Jul 2018 14:10:05 +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 C94C129F10 for ; Mon, 30 Jul 2018 14:10:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726740AbeG3PpO (ORCPT ); Mon, 30 Jul 2018 11:45:14 -0400 Received: from mail-qk0-f176.google.com ([209.85.220.176]:42818 "EHLO mail-qk0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726765AbeG3PpO (ORCPT ); Mon, 30 Jul 2018 11:45:14 -0400 Received: by mail-qk0-f176.google.com with SMTP id 26-v6so7841324qks.9 for ; Mon, 30 Jul 2018 07:10:03 -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=A8dVB2EhW6lX4y99bOTw1qPreUR6PT4jZyXoVFgwqO8=; b=U1AYuUnG3UsijvU4xTdjuySdEzghCVlEOB9rtcP83bfKp8OVrRKrESe3qjHEwWuf09 hKDg5rMVYxApWbD31CINBWTPVqiBadK4CBeHMPSLUssd1PZ8lPnEyVeD+D0RgxaUzq7a +NXNc+DwPZdKEV/1oKgyEohXhOnGH6MHoCLL7xu3muqiHp+SOb/xa/k4vogRSX5VcDG8 ntbFSQR7q+dPfJokxlzZvhOy8vowAytUb7yTTTjHljN5L+UcRWjv+nj0ERbijsPUWlwz vrI9DpwInqXLpHItYynLvupFqC4KWDSxkPxn8EJEURYAUDo4DM+vDSg37FQOxA2ltD0B nPDw== 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=A8dVB2EhW6lX4y99bOTw1qPreUR6PT4jZyXoVFgwqO8=; b=Lbi/tBQyW95SLZrqmzIviEXkMHc353pTIrGB+Vqqt0zj9ZvbznyTS0JwZPg4HtrUWA RDQ4yndYvC69FFUyIf8PPeHC7Te80w34zB+e0CqIL8trNDZEQMmMxFZAlCN700mqraZl lPKQVLlUnk6wO7vteGoo6sX2BLBKYlvRsvLDCbJ2ALOcJ4+ye5Yyy+bznKWaSe8elXnz 0fN6T38dSUtGiLg1cuUbHXb76tXvzHyGx0N7KN39E+ODdBTBGdF5gHc/QA/P8FNTNPc2 rQFx+69cv2J+Lo78uZm+BeGeCxD5Q2v7SWbRIZlFDRFC7rTzE/zv/YTWD1eeZtUK7BoC SxLw== X-Gm-Message-State: AOUpUlEtq6lBLQve6M6DzdxVdq84RlOQO+NkHM3P/rjTS5qmk1JZhwcI OFrbN2ftAS1Qobj/6adlw3i83TjFDCo= X-Google-Smtp-Source: AAOMgpfz3WRX3HHtHOts+sxgDwm0EwmDQTYqUhNIPiWW9XfK4aFj1Mot+OQU3J417GlQmjW1e8SOYg== X-Received: by 2002:a37:4ed8:: with SMTP id c207-v6mr16418714qkb.164.1532959802930; Mon, 30 Jul 2018 07:10:02 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id b83-v6sm8130927qkc.20.2018.07.30.07.10.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jul 2018 07:10:02 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com Subject: [PATCH][v3] block: don't account for split bio's size in cgroup stats Date: Mon, 30 Jul 2018 10:10:01 -0400 Message-Id: <20180730141001.2617-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 --- 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); }