Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1055842imm; Thu, 6 Sep 2018 14:41:01 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb2pwgYGpwHg3yGxbmNxH4CX5hRnwdyAhUl85OJdCT/5n9lZvTkNO+ZY8nGY0wWY0tUuYaG X-Received: by 2002:a63:91c2:: with SMTP id l185-v6mr5029872pge.321.1536270061244; Thu, 06 Sep 2018 14:41:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536270061; cv=none; d=google.com; s=arc-20160816; b=pW8LKp9t5QA+g7/Kovg2SpjRFFK3MpEUB+eDPi7Mg8ygKD/WDiYkgXlV1Lfi/VIPRf FG+GtKE/xB9pYwpzqu+arzSBs4HjdRipT9Ur336OTGDGsRlUJod3/lthjOIzvaaZJN7X JrlBwrQ58Y8asfPPUZ+nKygYq27luStoNHuALEyHgNJWTzWevFT2xd7mindx5VMB0sR8 r/R2xlijol/pBT0gx7/1PEFzK+cD5U53/x95E744OjZTK3S8Ekz2WgjxpNQdTjgqrIUq A9QuGhVT9PArXDP6Xs0i2JbWB+Xe0uBWov+v8Eh0SkbTSLd6pdF0m5sYyeTKU0bb71Ml FxQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=A7oknpfBCZ28ZYcXI/hUlO4PlTV81jtdGOJ56zQQbeI=; b=id3ENIlZet1Y1RxF6L7cb0mWKShV4Dt5ZKNPUEDmdWNMAQy+dwlyDE+wYErd2jIaS8 ByLBVPvJ6DiniMEhQ1KEk6EHJVc22Wf4492XRrjZGINxXDov4Js+PFAwR6O2q0MZAZkQ fYHFVAO3p9L4eydVOxxKY/9/dgHl3N9Bs37rAmZPi1IpRgIIriTAt0c0/CaMGUPtTKjv aKeZje/eCj0BTghyAWaucEH4MiXSW+WGEMg3g4ru5mQ+K6k7AEgnnViivUBr0/8NDyHB f7YFzyzbk0LXN/ZfTylgRxNF4E0ZV5IY0cnXrx+NrFjEzI037Tf/Y0iN13V/09O3P6fo 2HeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lvd4+FQj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f91-v6si5976080plf.376.2018.09.06.14.40.44; Thu, 06 Sep 2018 14:41:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lvd4+FQj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728521AbeIGBsW (ORCPT + 99 others); Thu, 6 Sep 2018 21:48:22 -0400 Received: from mail-yb1-f196.google.com ([209.85.219.196]:40091 "EHLO mail-yb1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728114AbeIGBsV (ORCPT ); Thu, 6 Sep 2018 21:48:21 -0400 Received: by mail-yb1-f196.google.com with SMTP id t71-v6so4690976ybi.7; Thu, 06 Sep 2018 14:11:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A7oknpfBCZ28ZYcXI/hUlO4PlTV81jtdGOJ56zQQbeI=; b=lvd4+FQjMCmbE7A5/M7KBBrTkwC+8uf25hiBfpmG52KlvVc7vfdNjZiv0ORNVzgJTx O1y8nGlb2qTnIqODoFFTBWnFowhiKmJobZIdHLm1hO8tJTNX/0UzA/fVi3K+njyANc0W 3pnWMCO44Rqn0XDkYv0rcg3VmfSMVYiV0O+U2xE8texSTwoKg2l2vlxeb2K2VfpFlR50 0arrhbosssQMXfyxzQcw8459IqitgNb3qg+oHOtLI1OVD54/Mk2CslgWidaZMLPpEF8p GBf00srxk8jBTty0o48Mh3J6NGbzdrqXOdTJm+0F9EZJY6JyeLwn+/OAcAuy9PkfSe7C qyeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A7oknpfBCZ28ZYcXI/hUlO4PlTV81jtdGOJ56zQQbeI=; b=NhkjLrhpyvGTq8H+ZofANyyXLm1ADq4fwIBv1tNyINz2qavGE4fqKjTtNliw8cmim3 +9vuGjzovkwbT9gbcr60gfaCq9ZgSwZXQfh/56RSMUK1HZ9OusgFM3hzfeiyOVhb6zqM S3UPf/Ga4UUj38tSz8G9qXor22iiNFCBajcBNRelV+izgyBGeUwL7zWEbYqB9yqY6uO6 iS2ghUG5WSt5JJfJ1YcUu/lGylDnXbv7d7ZlSZWMU50PSSwKB7FSXPRj/3tt0albdWvp 4UevEyLJM8t7X2Se9MLlM7mEo2q1zT6MCD+hFS1tVEBT7eiXEyfcPQN+wbecyYylMUQl EOxw== X-Gm-Message-State: APzg51DSdcuN+cTI0XAxzxcyY3AiA/5zM1KAlXQV9i4fx7Z0R+TL8DTI M73yGqQehk8fplpMW3cLl7M= X-Received: by 2002:a25:8403:: with SMTP id u3-v6mr2554107ybk.296.1536268263041; Thu, 06 Sep 2018 14:11:03 -0700 (PDT) Received: from dennisz-mbp.thefacebook.com ([199.201.65.129]) by smtp.gmail.com with ESMTPSA id u67-v6sm2032802ywa.56.2018.09.06.14.11.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Sep 2018 14:11:02 -0700 (PDT) From: Dennis Zhou To: Jens Axboe , Tejun Heo , Johannes Weiner , Josef Bacik Cc: kernel-team@fb.com, linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, "Dennis Zhou (Facebook)" Subject: [PATCH 05/12] blkcg: consolidate bio_issue_init to be a part of core Date: Thu, 6 Sep 2018 17:10:38 -0400 Message-Id: <20180906211045.29055-6-dennisszhou@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180906211045.29055-1-dennisszhou@gmail.com> References: <20180906211045.29055-1-dennisszhou@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Dennis Zhou (Facebook)" bio_issue_init among other things initializes the timestamp for an IO. Rather than have this logic handled by policies, this consolidates it to be on the init paths (normal, clone, bounce clone). Signed-off-by: Dennis Zhou Acked-by: Tejun Heo --- v2: Association path consolidation was moved to the prior patch. block/bio.c | 2 ++ block/blk-iolatency.c | 2 -- block/blk-throttle.c | 8 -------- block/bounce.c | 2 ++ include/linux/blk-cgroup.h | 9 +++++++++ 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/block/bio.c b/block/bio.c index b2b3fddfcd6f..a05997bdb967 100644 --- a/block/bio.c +++ b/block/bio.c @@ -610,6 +610,8 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src) bio->bi_io_vec = bio_src->bi_io_vec; bio_clone_blkcg_association(bio, bio_src); + + blkcg_bio_issue_init(bio); } EXPORT_SYMBOL(__bio_clone_fast); diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index 79a7549e2062..9d7052bad6f7 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -401,8 +401,6 @@ static void blkcg_iolatency_throttle(struct rq_qos *rqos, struct bio *bio, if (!blk_iolatency_enabled(blkiolat)) return; - bio_issue_init(&bio->bi_issue, bio_sectors(bio)); - while (blkg && blkg->parent) { struct iolatency_grp *iolat = blkg_to_lat(blkg); if (!iolat) { diff --git a/block/blk-throttle.c b/block/blk-throttle.c index b7b5cc4defc2..f2b355338894 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -2126,13 +2126,6 @@ static inline void throtl_update_latency_buckets(struct throtl_data *td) } #endif -static void blk_throtl_assoc_bio(struct throtl_grp *tg, struct bio *bio) -{ -#ifdef CONFIG_BLK_DEV_THROTTLING_LOW - bio_issue_init(&bio->bi_issue, bio_sectors(bio)); -#endif -} - bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, struct bio *bio) { @@ -2156,7 +2149,6 @@ bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg, if (unlikely(blk_queue_bypass(q))) goto out_unlock; - blk_throtl_assoc_bio(tg, bio); blk_throtl_update_idletime(tg); sq = &tg->service_queue; diff --git a/block/bounce.c b/block/bounce.c index bc63b3a2d18c..7a08703b1204 100644 --- a/block/bounce.c +++ b/block/bounce.c @@ -259,6 +259,8 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask, bio_clone_blkcg_association(bio, bio_src); + blkcg_bio_issue_init(bio); + return bio; } diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index 6e33ad1d92b4..a6b6e741a75e 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -897,6 +897,12 @@ static inline bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg struct bio *bio) { return false; } #endif + +static inline void blkcg_bio_issue_init(struct bio *bio) +{ + bio_issue_init(&bio->bi_issue, bio_sectors(bio)); +} + static inline bool blkcg_bio_issue_check(struct request_queue *q, struct bio *bio) { @@ -922,6 +928,8 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q, blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1); } + blkcg_bio_issue_init(bio); + rcu_read_unlock(); return !throtl; } @@ -1034,6 +1042,7 @@ static inline void blk_put_rl(struct request_list *rl) { } static inline void blk_rq_set_rl(struct request *rq, struct request_list *rl) { } static inline struct request_list *blk_rq_rl(struct request *rq) { return &rq->q->root_rl; } +static inline void blkcg_bio_issue_init(struct bio *bio) { } static inline bool blkcg_bio_issue_check(struct request_queue *q, struct bio *bio) { return true; } -- 2.17.1