Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2285239iof; Wed, 8 Jun 2022 01:25:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymr4y2OisAfBCY2veMOAwRKQBPfHoREkGN6mCUZKA0DTwZ76WwJ65ycW3St0JXSdin6Yja X-Received: by 2002:a17:902:f605:b0:14d:9e11:c864 with SMTP id n5-20020a170902f60500b0014d9e11c864mr33198308plg.54.1654676752969; Wed, 08 Jun 2022 01:25:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654676752; cv=none; d=google.com; s=arc-20160816; b=PKNBzOxBvJSBpmEQ9PKtlXRQ6Ul5elPG+XQn9YoLM1Zghe6a5xEhwX23avoY0KTB2i RgjEfMzMefGj/otxEc5HKXt8tGPJBZjdrNdGPydSOjgSYfk15YBUurehr5iU+Uhp21WC 6IbFAJ+QHYi0ki1Pb/anLUHDIvwwu0MsS74OpmJ5HkueGOe5+g6CLdFgmqTIam0q4Pcx RNnxg/kesPAq/Mht2YjHEjO2XyeOY20pbbmF3IT4KzumerL7Ve6yDNTwMLi5nTjtqaiB VcmM+aQgrpRjQT/SQA1l5f4Mg3dkYSKaD3/MlqQAwlldE/zxIpFL7K938QYSCGIGrU7r 9Skw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OEeZaKcNVzAmueMabUfyXDQOOvgoZyLfcF+TPewLZYQ=; b=KkO2PXd49pela7zT9UZwD61cIlTLE0cteJGftOwOJ7BUMDdXodNlWhRocPvCvRmXUG UGHISElUEgSfDKA8dFgUT/mV+l1P3IJMvU9/SKD+YWNmXdfJqvRChiTHMJgTrdHPsbZ7 CHUIrYJT5a2TBFRZOohiSrfWH69Eb9uPqL50N2alBNxb4NJzT2op2AhlQkLawKlD9d5U WZhWZsKmeXBcb3F4FLMRXMVRyjg815Hq4ij2B0oARi289aBbObkk31k5VHb2cl3Lile5 UMAGW74gYq1YdsxyxjdcM/dh3jIQRF9m+KbsEswO3bvpDMdgzI4hWi3w96OnLQeDTCa0 wh1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MNbH2kZY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id a10-20020a17090a480a00b001e0a4370e78si30070161pjh.110.2022.06.08.01.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:25:52 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MNbH2kZY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 124231DAE77; Wed, 8 Jun 2022 00:56:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392492AbiFHAwh (ORCPT + 99 others); Tue, 7 Jun 2022 20:52:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384167AbiFGWKY (ORCPT ); Tue, 7 Jun 2022 18:10:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C71CA39B81; Tue, 7 Jun 2022 12:19:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 92843B823D5; Tue, 7 Jun 2022 19:19:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07AE9C385A2; Tue, 7 Jun 2022 19:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629549; bh=8n65b4W0D13H1VusYskSw10GI6Nc3hno/LvUC8WQrGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MNbH2kZYxfL8qzeltEXvYW9KHLEvjR84KQnMKd0s5gEjyHgnez7oiqlgNhiQ/sKMa Ex1KPdibndV8wcBJX7Jr7g2SI9fX6oTY+feX+cEK/97kyWNGT3CFo+WQ7k+mK0+cKG Li9NLELfZ6bHMiP0q4EYpHZCQw8KZeOZ5LgdgPQA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "yukuai (C)" , Jan Kara , Christoph Hellwig , Jens Axboe Subject: [PATCH 5.18 732/879] bfq: Remove pointless bfq_init_rq() calls Date: Tue, 7 Jun 2022 19:04:10 +0200 Message-Id: <20220607165024.103327267@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Kara commit 5f550ede5edf846ecc0067be1ba80514e6fe7f8e upstream. We call bfq_init_rq() from request merging functions where requests we get should have already gone through bfq_init_rq() during insert and anyway we want to do anything only if the request is already tracked by BFQ. So replace calls to bfq_init_rq() with RQ_BFQQ() instead to simply skip requests untracked by BFQ. We move bfq_init_rq() call in bfq_insert_request() a bit earlier to cover request merging and thus can transfer FIFO position in case of a merge. CC: stable@vger.kernel.org Tested-by: "yukuai (C)" Signed-off-by: Jan Kara Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220401102752.8599-6-jack@suse.cz Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/bfq-iosched.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -2501,8 +2501,6 @@ static int bfq_request_merge(struct requ return ELEVATOR_NO_MERGE; } -static struct bfq_queue *bfq_init_rq(struct request *rq); - static void bfq_request_merged(struct request_queue *q, struct request *req, enum elv_merge type) { @@ -2511,7 +2509,7 @@ static void bfq_request_merged(struct re blk_rq_pos(req) < blk_rq_pos(container_of(rb_prev(&req->rb_node), struct request, rb_node))) { - struct bfq_queue *bfqq = bfq_init_rq(req); + struct bfq_queue *bfqq = RQ_BFQQ(req); struct bfq_data *bfqd; struct request *prev, *next_rq; @@ -2563,8 +2561,8 @@ static void bfq_request_merged(struct re static void bfq_requests_merged(struct request_queue *q, struct request *rq, struct request *next) { - struct bfq_queue *bfqq = bfq_init_rq(rq), - *next_bfqq = bfq_init_rq(next); + struct bfq_queue *bfqq = RQ_BFQQ(rq), + *next_bfqq = RQ_BFQQ(next); if (!bfqq) goto remove; @@ -6133,6 +6131,8 @@ static inline void bfq_update_insert_sta unsigned int cmd_flags) {} #endif /* CONFIG_BFQ_CGROUP_DEBUG */ +static struct bfq_queue *bfq_init_rq(struct request *rq); + static void bfq_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, bool at_head) { @@ -6148,6 +6148,7 @@ static void bfq_insert_request(struct bl bfqg_stats_update_legacy_io(q, rq); #endif spin_lock_irq(&bfqd->lock); + bfqq = bfq_init_rq(rq); if (blk_mq_sched_try_insert_merge(q, rq, &free)) { spin_unlock_irq(&bfqd->lock); blk_mq_free_requests(&free); @@ -6156,7 +6157,6 @@ static void bfq_insert_request(struct bl trace_block_rq_insert(rq); - bfqq = bfq_init_rq(rq); if (!bfqq || at_head) { if (at_head) list_add(&rq->queuelist, &bfqd->dispatch);