Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4627684rdb; Tue, 12 Dec 2023 05:13:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IGwJkD8pNqhsLOZ54t+7JaVIeKXXFhYWc9pPI0byeR7lrmTU/FjW3+ZlJjh9GBtOUb/fRLo X-Received: by 2002:a05:6a00:4993:b0:6ce:327b:75b9 with SMTP id dn19-20020a056a00499300b006ce327b75b9mr2877522pfb.55.1702386821990; Tue, 12 Dec 2023 05:13:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702386821; cv=none; d=google.com; s=arc-20160816; b=oCn6rhEgsMPRkwgzrelBgzvlUPeimTMDJFBvwKOKSi7RlroMuJ58ltvXtsNAi/JMjA 7Lwlg6J9ZxbWESuHIck8VaqEvJUoyPl8sjxYJSaLV/WbPTo9qZkDY30uhSiQTJXJSAq8 7Puy6M0PSbPBNI0oWlbInz7w0i0szU9LgGm6DU0qLKTIgeWeZTbM8yAPXwcZLkXgRUnz vtBhRBiZUNK0Pkr/zKdujh/3GUdzi0iNG3od1EL7i0Xb9FRQb3+nsAamJ9kOZFR2uJHe j4SM1iUmQq2HRBtbPCR77XS3zJCXwO4ktwts3qBPTb+TR6I8znBIdZTTXddu/h/n3FW4 Rrxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0Dfuz2M62ropeVCnMi+DeMixqMy40tI6fG5R+q0UR1c=; fh=HpxU/NEGjdXnVKYYQcKQ49+f+bl/7gEaE7pm9dlb/hA=; b=B46Y/Ruvc5ChXpCDl7zj9ScAJ8JAB1L9LYrmCBL7WNf61dNBWUqQOUwC8tMX1/uyaC E6YWSLMlfC2RyFr9DoDwmqtguzdS0HVibDYiKtnUisV5vqemJHTGeakQKhdktq+BytcX jf7bWHvRS5Y6wVVftbqpcoZq4hwaFoKBDEN2RdEk54lojn9Z7HOxhsQxkQmvNgI0QyKY EFlIZRDqzb+Mhp0p+1SVC65lHwOBpUILhUQ3TeRq5keVRA/EiG83stJWnjkclrpnNc+g mp7gYc7pGX7jUEqb3JUWsBe4rWx8Z2h8CUzpUATfPsn0fi/nZiQNJ5BQlmWDrbO8aZWO T7YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=uD68zqhA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id z8-20020aa78888000000b006ceb278c885si7906742pfe.265.2023.12.12.05.13.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 05:13:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=uD68zqhA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id AB706809A742; Tue, 12 Dec 2023 05:13:39 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376524AbjLLNNY (ORCPT + 99 others); Tue, 12 Dec 2023 08:13:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235221AbjLLNNU (ORCPT ); Tue, 12 Dec 2023 08:13:20 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1061DCA; Tue, 12 Dec 2023 05:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=0Dfuz2M62ropeVCnMi+DeMixqMy40tI6fG5R+q0UR1c=; b=uD68zqhAUEPOL3jg0OQPdz1c+n Q+zPotfLguZ/NzMpo87/5NFm/wD5z4gHcd+3w3XF7WjFldowFP6/vwwYEwysRc+1hrV7iI8E2kUPz bHBgU36QPKuLWG+GbHkUERm1OmYXtOYu6/FkJVLY455exS6mJXiFjhrh8NsKuXRBFB1LFqjKhlOLe OTC05wvqgbEEN30DGz7T1QodEcJ24RHKmqkFsiRtjfyrgU00EMb5yVYOJADNihSuxNUKbSLUfJ6QB kSuG2/6RpslfdLtXD76LW4vImZgkrmftXI4LfMiXjQqUiAWc2DUkA2nhlEYcxxZ4Ujz0fq5aBBOXP 0rK++uig==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1rD2ZV-00BlUt-0Y; Tue, 12 Dec 2023 13:13:13 +0000 Date: Tue, 12 Dec 2023 05:13:13 -0800 From: Christoph Hellwig To: Hongyu Jin Cc: agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, axboe@kernel.dk, ebiggers@kernel.org, zhiguo.niu@unisoc.com, ke.wang@unisoc.com, yibin.ding@unisoc.com, hongyu.jin@unisoc.com, linux-kernel@vger.kernel.org, dm-devel@lists.linux.dev, linux-block@vger.kernel.org Subject: Re: [PATCH v4 1/5] block: Fix bio IO priority setting Message-ID: References: <20231212111150.18155-1-hongyu.jin.cn@gmail.com> <20231212111150.18155-2-hongyu.jin.cn@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231212111150.18155-2-hongyu.jin.cn@gmail.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 05:13:39 -0800 (PST) On Tue, Dec 12, 2023 at 07:11:46PM +0800, Hongyu Jin wrote: > From: Hongyu Jin > > Move bio_set_ioprio() into submit_bio(): > 1. Only call bio_set_ioprio() once to set the priority of original bio, > the bio that cloned and splited from original bio will auto inherit > the priority of original bio in clone process. > > 2. The IO priority can be passed to module that implement > struct gendisk::fops::submit_bio, help resolve some > of the IO priority loss issues. Can we reword this a bit. AFAICS what this primarily does it to ensure the priority is set before dispatching to submit_bio based drivers or blk-mq instead of just blk-mq, and the rest follows from that. > +static void bio_set_ioprio(struct bio *bio) > +{ > + /* Nobody set ioprio so far? Initialize it based on task's nice value */ > + if (IOPRIO_PRIO_CLASS(bio->bi_ioprio) == IOPRIO_CLASS_NONE) > + bio->bi_ioprio = get_current_ioprio(); > + blkcg_set_ioprio(bio); > +} I don't think we need the check here as anyone resubmitting a bio should be using submit_bio_noact.