Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp879512rdb; Fri, 26 Jan 2024 13:51:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IHOFj5ZxcbKiFSEn8r94HkSOjEagLzKoJlXzOW+2a/NSC0AVbt5Gu6ezpsK+Q/4i9/tf6G0 X-Received: by 2002:a17:906:d92:b0:a30:d35f:d3a5 with SMTP id m18-20020a1709060d9200b00a30d35fd3a5mr844871eji.21.1706305887486; Fri, 26 Jan 2024 13:51:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706305887; cv=pass; d=google.com; s=arc-20160816; b=uuAMTri/X3/inwI8gdio+/XhPpjX8M5AReWfwaMU4SLXxEME99KJgjHBdx/MSZZwpH K112jInFPlkz0uwIEnzqQfawWh83LI9brwtk+aJiKrYjw6xywpEym3va7nihYW0a/zr3 dZ8awfnk8FVrRb5DFG3ZUHcqUpr0PCTgDqeBaFERZJwMygULDP5W0OmwTgbdhnYESpNp pE9f+e1d8HzhlmPXR1J5vq1etHhY/06BVCVlMxkXiyqiFqdDpDgy1dupi+0jmE7LCFeD lvBjGKziVeSMT6E0+CNLY/aGhj0rIS1LzqGW+CJJupX1DpGbrba4JeDzcAHI7lHNBdEW iEuA== 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=f1w4U8mqf5nN23ca0l43hojotOzXL6u5NlkdrKkG3gw=; fh=HuSXJoCCm5x4/Ys1VRmd4eqzDrcQ40Y0FH/gF/tn1ME=; b=gYmTaldyJsLLWWT2nIqSzwlM6MCBh1kTIvs3WUX9XV+8wlQSV1RxcGxdsXGzLAHkyO QJPWDXP8xex5Udt3iYMxX7JLNBl7S2j6dJuF3fPxCc9ptBE1cO50kogDHeTmxou8Evc+ EYhPSl21aqllYMmucdrV6EyzX8PXr7WVnss3Gj75qzcXQxYexVTcDNcEVP0uAOu7m+Ou Uwft0NLy2nGmIIilhJo3PTamFnFsTMAA1ZRqNbtPSjtj7HQ6Zz9wBaBLguL0ZKn+mfgH Gcz1gep6CMA4tHrqx4Qh6Ou/zENEFF3ebc7VV6cq4s+gfyahSZri6ePbnJAUNTPS4JRY olbQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="VVOh/LiY"; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-40175-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40175-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 lv4-20020a170906bc8400b00a31fff951b8si1008272ejb.2.2024.01.26.13.51.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 13:51:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40175-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=casper.20170209 header.b="VVOh/LiY"; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-40175-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40175-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 17A7A1F25603 for ; Fri, 26 Jan 2024 14:26:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFB771EB41; Fri, 26 Jan 2024 14:24:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="VVOh/LiY" 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 E88CF1DFFC; Fri, 26 Jan 2024 14:24:25 +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=1706279067; cv=none; b=ULAdNHMr9rR0uOuU/y1xUasHlN7zD4bVg6mw9Fyw8CxL5FjPyG53X1AdSy6klGk08T1hS+A9+B4Upi+ewRSXZw63Eh0MVL+tjNHRV84sBRX7X04YZFUKWz0LSqy92vJfWKPjmy9umwMvRkrONblAp5y/T6LIyjgcmQkiFgRS5Y4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279067; c=relaxed/simple; bh=C96FQrvkUshtgqC+qMcz5zCfSC9yhxnOKbwu0ZZpwb0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YFC1/hqdD3am/swb3iZ4WwYpUu9hBS+qyZySqYi8o1hM5942Bm5F/xNPr4xZgmZUUfi7ufGV8eYzZC4tq+dciQQL0MVxHVcIvKnV8FDqpG0Mrt8SYeeOHBmMjmPMTlT0j95S9cKRnu2BzGUwujFoqun0fM4II6KmAyxkzkQg3ZY= 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=VVOh/LiY; 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=f1w4U8mqf5nN23ca0l43hojotOzXL6u5NlkdrKkG3gw=; b=VVOh/LiYV98n4HUSTPi8VsF4qQ y0vRCN8/8/69YP57BXK6QxuDC2d+zcK5H1cFIUikmoTP/GT5pyZ4Tl3KaJKSMSKUG4naRe58ndi1d VFdb5Er50Vv254B7SACCIaOKkxYVVqz9XqFO0ORQsACCl7xfa5SbMmt9MD44ew6XxxqRcKGHdqUBG 3swmjLp8DM+ut0Wbvo0CdiSdGxxY8RNKN6acQutLcpDFW8xQDtr0NkIJ/AZm4o6uycyangmnZu7Dw tWvk3uqEBnxm2wWCTN6hWUcWczTHGItHBXJKZFv6Hbsc2gEBnGnzMiMrfz2a4lhXUz3+z3P74efrC igRgdXMQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rTN7s-0000000DqpP-3S99; Fri, 26 Jan 2024 14:24:12 +0000 Date: Fri, 26 Jan 2024 14:24:12 +0000 From: Matthew Wilcox To: "zhaoyang.huang" Cc: 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-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Zhaoyang Huang , steve.kang@unisoc.com Subject: Re: [PATCHv4 1/1] block: introduce content activity based ioprio Message-ID: References: <20240126120800.3410349-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: <20240126120800.3410349-1-zhaoyang.huang@unisoc.com> On Fri, Jan 26, 2024 at 08:08:00PM +0800, zhaoyang.huang wrote: > +#ifdef CONFIG_CONTENT_ACT_BASED_IOPRIO > +#define bio_add_page(bio, page, len, offset) \ > + ({ \ > + int class, level, hint, activity; \ > + int ret = 0; \ > + ret = bio_add_page(bio, page, len, offset); \ > + if (ret > 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 + 1 <= IOPRIO_NR_ACTIVITY && \ > + PageWorkingset(&folio->page)) ? 1 : 0; \ I know you didn't even compile this version. More importantly, conceptually it doesn't work. All kinds of pages get added to bios, and not all of them are file/anon pages. That PageWorkingset bit might well be reused for other purposes. Only the caller knows if this is file/anon memory. You can't do this here.