Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1060610rdb; Wed, 24 Jan 2024 03:51:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYcS5FuBKH3nws7BdD5bO1VcebisgdkslBZWACMUn2z3uz7QCVkz6xUZesp3cF72ecSRXS X-Received: by 2002:a17:906:fb98:b0:a2f:d095:f3c1 with SMTP id lr24-20020a170906fb9800b00a2fd095f3c1mr559163ejb.130.1706097068775; Wed, 24 Jan 2024 03:51:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706097068; cv=pass; d=google.com; s=arc-20160816; b=HzOYS9pNoAB9FAgSgyLzbOS1VCOjGsxw6U8rgW0c4w140rNBk4Pjrl4utCrdicFugP ffea++DdAgRrRrGW2//NWBsMX3jCRxUfPI4npLxQ+XB45G7aPhOXt4Z77cKv4G/vL6ir yDDn41YcPM4sNv1jvsvfVGTflSx846ZTBFbDfAhsRborz+69d6DwlBD6QjmiMXngt70d r1eNOW94QUpY4OaovEdARNie2DnQ2Y5xqxJLQP0WCnS+83hrWa6xAyVF6tdxlxzDzRfF f9oaqxytNhQ+UbdJ1+HBKuACoPCFLqqhoSiGSii92bmO+lAUoPyRhSh8wK6P4gHH8bO8 9kOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=c+ZfvrjquqzlfSZdWFV1/+Mtsm0Gets8I4mX6+MdRHE=; fh=TR7i+agldAOc2zjDTxMbx0Qykyilpioc1nSjxmd8mB4=; b=u6ue2ELxIEFo0pPAmXW5Yjl2nb++EcknPVoP+CXb6OXsjMd1FOTOwp703PFv2dpwrL gcT9+WTJvmjkSkPCQzOZWBgEDeDtOgmW35XK5m13v2JDblT2jMXGtbaRyi7FrNzFAy7Q kr0wOOCCuqvkho8HB7LlCsLAGBSFZUUD+gojYCq4qbdi3X1g3JPJbDM5UtAZA+b1kYU0 niRlnPDu8MVAoTKl19K3YZKtVpGyQBoFM805yyZZKNEAuKO1OWmkKqhL5b9QJmkgMLLh K+iEU8rdyVX57p/mCQjBvxq9mxJVpXMA7XcsprjhgKKovvlbhAE/lC5uTQaXjiR+IsWw GvwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=pWIw3d6+; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-36699-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36699-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t3-20020a170906268300b00a2dd32eb365si9604755ejc.66.2024.01.24.03.51.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:51:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36699-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=pWIw3d6+; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-36699-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36699-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 89A381F28DEC for ; Wed, 24 Jan 2024 09:21:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04CBD18E1A; Wed, 24 Jan 2024 09:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="pWIw3d6+" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FE6A182DD; Wed, 24 Jan 2024 09:20:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706088015; cv=none; b=ghn510BRO2xGSE2Nww3bybOB/BC7j+p84oXsESbsJ9XbOy8WxIxaYepB1P+/swaKV/xzbczfLvnNme7/N+Yh5wWTz6ZONQmztSAF1Xl5FTNVm+y/dOrC0xhFDd3QrWxomzm2P/9u879jgQrUL6Ni/PKzWF0Yv9Mz9v3kBvERH5s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706088015; c=relaxed/simple; bh=0RNVoVPorVZfd5XfeIrUrbw9uQITz+8rwALrIiiF5SI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Fk1bcq41CSORHkXm88eTSBV930pAQuoMkxaE69n+JnmUVZ6dY3GQbcSTNVnVqv6CkBVrKZK6ONbnZ03ErWQHlbxv22D2kewEsHAeizZV1oZ3zH2D4RexhJmbYfhkSuYwEZieazU0h+gtI/I9eqab5qwq7Zv162KbycsxwfTrCzo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=pWIw3d6+; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org 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=c+ZfvrjquqzlfSZdWFV1/+Mtsm0Gets8I4mX6+MdRHE=; b=pWIw3d6+jgURd/sfpZEVB1Aiml vM1O8VgYkw32OUUokRaha95eKs81ULZjWXHkhsUL3xnYi7r7PvBvftRJ8l4CSHNqUStqBEYptww4D 5KSU1WgXxBv2BaluAoqZEYsilp+LiZ0knK8rhJU64j2F2+50DSmcLEdVbXywP+/yzCxyOilVOC2wm y7Ccnq0mtlWXFXosjW8h+s6X6n93pkulx1j6D9nuxjBLhhu4+TqaE36D+HZyhXzvfetcHgG74Acqa xTyMXU0qUnkKRyArkhnttoLhuWK0guIAsi4jn+v3AktzS0GlKGmF6eyYdu04dmhsFi5YWj+aJgTfH x171c8qQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1rSZQX-002BYQ-1t; Wed, 24 Jan 2024 09:20:09 +0000 Date: Wed, 24 Jan 2024 01:20:09 -0800 From: Christoph Hellwig To: "zhaoyang.huang" Cc: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Zhaoyang Huang , steve.kang@unisoc.com Subject: Re: [PATCHv2 1/1] block: introduce content activity based ioprio Message-ID: References: <20240124085334.3060748-1-zhaoyang.huang@unisoc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240124085334.3060748-1-zhaoyang.huang@unisoc.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html On Wed, Jan 24, 2024 at 04:53:34PM +0800, zhaoyang.huang wrote: > void __bio_add_page(struct bio *bio, struct page *page, > unsigned int len, unsigned int off) > { > + int class, level, hint, activity; > + > + class = IOPRIO_PRIO_CLASS(bio->bi_ioprio); > + level = IOPRIO_PRIO_LEVEL(bio->bi_ioprio); > + hint = IOPRIO_PRIO_HINT(bio->bi_ioprio); > + activity = IOPRIO_PRIO_ACTIVITY(bio->bi_ioprio); > + > WARN_ON_ONCE(bio_flagged(bio, BIO_CLONED)); > WARN_ON_ONCE(bio_full(bio, len)); > > bvec_set_page(&bio->bi_io_vec[bio->bi_vcnt], page, len, off); > bio->bi_iter.bi_size += len; > bio->bi_vcnt++; > + activity += bio_page_if_active(bio, page, IOPRIO_NR_ACTIVITY); > + bio->bi_ioprio = IOPRIO_PRIO_VALUE_ACTIVITY(class, level, hint, activity); If you need to touch anything in the block layer I/O path you're doign this wrong. The file system that is submitting the I/O needs to be in control of the priorities. must not hack the assignment behind the