Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp521867rdb; Fri, 26 Jan 2024 02:57:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFq2cE7fY6S1bc9Gql8h/7ysNPs7AFNthE3dCUTQ64mpjNjypYSOwXGcFLE3xqI8/xlm9+N X-Received: by 2002:a17:906:5293:b0:a23:36f7:4918 with SMTP id c19-20020a170906529300b00a2336f74918mr1338868ejm.72.1706266623242; Fri, 26 Jan 2024 02:57:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706266623; cv=pass; d=google.com; s=arc-20160816; b=zJlxtN42++FFWWvEmATd8qt3+8kClzDl931DEaCpKakjpWL1IwhkV6SiXhDSU/v/V+ F6vUgFpKobSTfhRbEbZmdIdHMN3R4dox78Gf+w+agAfy7G6s2ePtPLjlkEGUhuqg0GB9 +cCyWaWk+iImm+OIz2glhcj8fmyWHdTDhD8K8mjp7dPnzkkXU/sHF8p8sQJqtykIP8TH sQIdVz+dv6sKAL4qT5/UCeKPeXBBiDgCS7f/3nKWtno09O4AcJFWRAl0YPXUe2XoAsdY 3KwrRbogEDAB9Z75pZkxQzSvUXd8MlkV5pH1fc9bGLuickW5OaT7cfKkv5X8yecgCnGm rOlg== 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=w+WMrLX5s3l3LT1bHKgCUnIIP0Rpbnm0jHmPYs4Fo3Q=; fh=Yt9QoqB64w2+tVNpcs8JPtFlRqKGttK98iZ0hV13oMo=; b=E7BRKrkzYD9RMg2TUkqlVaRTt8ZUgBrjvt/QDKYdXNVNws5cX0j33pZ9K16u8QBtmO ckSOgq0xALazAsQBAznfE6+hgmvyhm6IE1am04ApUkdIZeVliC7AHWCF3tIPTJ47TL7f pIsseV1/0/kxK1DVMUr+vXpGnVMnZAXUzi6Ra3mDi3W7Q4gQqqla03fHX0dpNACJuEVb RoBRVBbnnNQTje92Fbwk0KIhcXd8nx671lcAdL1WlDqIhAsamm269aiJopQymxFcysmW c0xOTJM7OtcWztYOct2OYV4i5CbBd5iWxZ6paS2NhGXCSpkx9ZbKlSbG25WP32mUaV/G IUKQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=I50x5DUB; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-39810-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39810-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id z22-20020a1709063ad600b00a3126d24a23si457677ejd.554.2024.01.26.02.57.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 02:57:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39810-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=I50x5DUB; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-39810-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39810-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 26A111F29442 for ; Fri, 26 Jan 2024 09:30:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3585312F584; Fri, 26 Jan 2024 08:55:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="I50x5DUB" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 DD9C7249F8; Fri, 26 Jan 2024 08:55:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706259351; cv=none; b=aCXOpSNhJJrzV48o/TtUKvUZsp+WSR7VW5bEnE1SkPSYmyJNI68cqCeJOvrJky2dP8JVGSJO3vF/crWeA2RUyQI7PFlz8yhoINIiqSiq4U0g+Jr0xLUAXV4VOCxxuActCdtLB0H1xqWf5KKhNjfIgtAVinrLltuGzRQYoyRkxl4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706259351; c=relaxed/simple; bh=VZxsGAjSNiP+osBUIVz0o4fYISM24dYHuupYK5rxxXA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WaOEFWz2HPBCTxrCsC5GPEPxwOrFc4TiJHJfe0WONMO/81tfc/Zs+2EVcOWup+vPEvoS1fBakQwsCmldmUE6loO7+/dBuU3rXRJZrPglNqgc3wrYxoJ1mhvrcSGqQf+/lPwxj4ITPnBCC+Gle0zV7WzP7MNIurNVITZe3qjfDmA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=I50x5DUB; arc=none smtp.client-ip=90.155.50.34 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=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=w+WMrLX5s3l3LT1bHKgCUnIIP0Rpbnm0jHmPYs4Fo3Q=; b=I50x5DUB0iXrrBxqdgS8P0PHwi s74eVAhOimTyTvGGWDNpVo2N9YkJBqwBDCz5RIAWU9pPr2hAs6DJHwQqu4jnTOIpYcyeen5qbI4WJ jbKOmxbKoaLGS4iXcdf1Y3/asNY3wfc3FLgOk8YBxQsdabvJMKo+6qnBG3NaM/yN2nE8wHKPD7FNR nuiOzGP0mYvr/Jn+Czdn7WyS9RqzX2IPY2B5ONEhHAT/vFBf6mdfqF96R1j+erGYbaWcUioDyA4eA v/RKELBLqemXTmbhLPK5Zt4Zgrhr56p2X5WWmtjv9iBH7z2aLk/ZPX4mm8mFXvpvk509gr5K4tXdN 9kfhfLTA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTHzs-0000000D5AA-0t0T; Fri, 26 Jan 2024 08:55:36 +0000 Date: Fri, 26 Jan 2024 08:55:36 +0000 From: Matthew Wilcox To: Zhaoyang Huang Cc: "zhaoyang.huang" , Alexander Viro , Christian Brauner , linux-fsdevel@vger.kernel.org, Andrew Morton , Jens Axboe , Yu Zhao , Damien Le Moal , Niklas Cassel , "Martin K . Petersen" , Hannes Reinecke , Linus Walleij , linux-mm@kvack.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, steve.kang@unisoc.com Subject: Re: [PATCHv3 1/1] block: introduce content activity based ioprio Message-ID: References: <20240125071901.3223188-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: On Fri, Jan 26, 2024 at 03:59:48PM +0800, Zhaoyang Huang wrote: > loop more mm and fs guys for more comments I agree with everything Damien said. But also ... > > +bool BIO_ADD_FOLIO(struct bio *bio, struct folio *folio, size_t len, > > + size_t off) You don't add any users of these functions. It's hard to assess whether this is the right API when there are no example users. > > + activity += (bio->bi_vcnt + 1 <= IOPRIO_NR_ACTIVITY && > > + PageWorkingset(&folio->page)) ? 1 : 0; folio_test_workingset(). > > + return bio_add_page(bio, &folio->page, len, off) > 0; bio_add_folio(). > > +int BIO_ADD_PAGE(struct bio *bio, struct page *page, > > + unsigned int len, unsigned int offset) > > +{ > > + int class, level, hint, activity; > > + > > + if (bio_add_page(bio, page, len, offset) > 0) { > > + 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); > > + activity += (bio->bi_vcnt <= IOPRIO_NR_ACTIVITY && PageWorkingset(page)) ? 1 : 0; > > + bio->bi_ioprio = IOPRIO_PRIO_VALUE_ACTIVITY(class, level, hint, activity); > > + } why are BIO_ADD_PAGE and BIO_ADD_FOLIO so very different from each other? > > static __always_inline __u16 ioprio_value(int prioclass, int priolevel, > > - int priohint) > > + int priohint) why did you change this whitespace? > > { > > if (IOPRIO_BAD_VALUE(prioclass, IOPRIO_NR_CLASSES) || > > - IOPRIO_BAD_VALUE(priolevel, IOPRIO_NR_LEVELS) || > > - IOPRIO_BAD_VALUE(priohint, IOPRIO_NR_HINTS)) > > + IOPRIO_BAD_VALUE(priolevel, IOPRIO_NR_LEVELS) || > > + IOPRIO_BAD_VALUE(priohint, IOPRIO_NR_HINTS)) ditto > > return IOPRIO_CLASS_INVALID << IOPRIO_CLASS_SHIFT; > > > > return (prioclass << IOPRIO_CLASS_SHIFT) | > > (priohint << IOPRIO_HINT_SHIFT) | priolevel; > > } > > - more gratuitous whitespace change