Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1615522rdb; Thu, 25 Jan 2024 00:27:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2Kzn0BQUxs8RpzYnfaokWaD94ppBGvRw+orQwAMDIx1pC1G3Dc6dJzHmfc+gZGfEmzV1d X-Received: by 2002:a05:6830:114b:b0:6dd:e00c:833a with SMTP id x11-20020a056830114b00b006dde00c833amr505989otq.20.1706171258768; Thu, 25 Jan 2024 00:27:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706171258; cv=pass; d=google.com; s=arc-20160816; b=gw+8bsERO9LZgie58ksG5PDlQF+rJlslgC4cQRASOnerxnP/A1cz4MaDepgRKOwJMO pWmvNd+yJmMxK9Gy/nmlSa/o4bNOLkdwpA/2gUDgTnVb/EH9Q1KuS5hVSoOPfWWbKkt3 1U+X5uzjHNOjzunsFfKC+PfEHZSnvM4KNOQVtVNBAv9a/f954j04BK5aVqqNM7xayFqq DdfTJIGeAf4dGMlpPDDUA++Mm9Ac+OGATPbP5Pfp6Q4UOpB1yVwFdlDLBkPgJDVWUDMu HqcLfXmHto4EO/frbGimOI5WZbOWZU7nPnzC7wDVwTm8JkZQ5+tKh8AWRg2MZf96dxKu LxpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=joIWsi4ODd93v27OGzztIA7XHVb5qa5sM66eSlssLGY=; fh=TPK5dH4cAsVK5KAaYniAIsbaoew/adpw6hACO0iub8U=; b=iEvHiAYoabjBtF4qVM9pA6+LzTFiioOlGd9Ip+WqJqfFhkpfggzTvl/j7qDOCRbYpA 2/lhXTEZnMICoBWmjWGYCP7uMlq4qGBoQ3/NfYswFu3ZMXm+49+bt77P6ljSfnkh8Ehi i54u+fZB8C0Hia9N/l28d7UiE3BynQhwDSdOOQMbqDEQGzfMjRJYUBIT+sL2xrS4krIp LxfH1la4lHm2uwDyx/INwGxB+zV3L0pQZO4nns5B5kCnS6LLlLKHVoKWn7fI5Whu7A0/ BdxhaCVehLU4ZCgdqhX3d9/bI9EvG4OhDlZedDaooQijhGi2dRKk9sULYjDyoiL2RAdB tA/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UO4C8Izy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-38171-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c22-20020a634e16000000b005d57c7f28f3si1736071pgb.592.2024.01.25.00.27.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 00:27:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38171-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UO4C8Izy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-38171-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 66B8828651C for ; Thu, 25 Jan 2024 08:26:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA8E71B28D; Thu, 25 Jan 2024 08:26:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UO4C8Izy" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D37491AAB9; Thu, 25 Jan 2024 08:26:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706171167; cv=none; b=un3Lparikwn5mLKt0x8HgfkuyEYfA5i9KE0NWwuJHgod6nCTpYzyoMLD8TJNIYmAGq5sMwbZuz8W0vuKwQRtkgQcQtOnUqtdo86urH69DjC+3k7j6cAY0y3ikXQorrRDUZ+R9DVUWIl5ihI0exqbogFAl56i2QFGRZ4DrlMjo2Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706171167; c=relaxed/simple; bh=S++Kr7Po8qJLVAtw1D+w2iPEltryaY+8VaTiQB/HUJM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Toue9iiQvN1MQxmI+NP3F7Cd9U7swVz/9RK+yUSZEsS9fgwBZnyJ0BcgBgQwOOzvH8MxS5xUDeQFOgzVp2lxHDDKNbHxaaBbxjWX1BhbR67Lqab7E6ni+5PA7FLQVT1215p7NQLDXF3UNZ14xvo7XUxw8a1Llai6R+rYzny5QXI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UO4C8Izy; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8533FC433F1; Thu, 25 Jan 2024 08:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706171167; bh=S++Kr7Po8qJLVAtw1D+w2iPEltryaY+8VaTiQB/HUJM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=UO4C8Izy9u84DfkwYm+3ZIgR7mzD9wS9sVPRG8Jt3s2rPceyeYM9K418n8iRZOtvH GAbspxbi725F7lEfBPrrLPegamFbHDL8TYlkufmMa+zhhBz/8bAIfcis1ET9aYPt4g h3XRUK/olxbyLsd7F9ujP4MQjdjfXFEWQPGjfHurqOPErXhVeX0Ow/MuQ8j08JMrSg nusCXHxlZyoFoA14ODqy5MjnyWoelY3ES9aWmx4AAKJ3QqGw4Ri+c9hMgIuvY7eqZB lr6amDjml/fJjFPFPU4eYl2icHfYVHa/ySMhTJPym0+xq6kSCB21cjFsjd8ucyuLYg TmzAt1XmhVT0w== Message-ID: <95082224-a61d-4f4b-bc96-1beea8aa93a9@kernel.org> Date: Thu, 25 Jan 2024 17:26:04 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCHv3 1/1] block: introduce content activity based ioprio Content-Language: en-US To: Zhaoyang Huang Cc: "zhaoyang.huang" , Andrew Morton , Jens Axboe , Yu Zhao , 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 References: <20240125071901.3223188-1-zhaoyang.huang@unisoc.com> <6b2d5694-f802-43a4-a0fd-1c8e34f8e69a@kernel.org> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 1/25/24 16:52, Zhaoyang Huang wrote: > On Thu, Jan 25, 2024 at 3:40 PM Damien Le Moal wrote: >> >> On 1/25/24 16:19, zhaoyang.huang wrote: >>> From: Zhaoyang Huang >>> >>> Currently, request's ioprio are set via task's schedule priority(when no >>> blkcg configured), which has high priority tasks possess the privilege on >>> both of CPU and IO scheduling. >>> This commit works as a hint of original policy by promoting the request ioprio >>> based on the page/folio's activity. The original idea comes from LRU_GEN >>> which provides more precised folio activity than before. This commit try >>> to adjust the request's ioprio when certain part of its folios are hot, >>> which indicate that this request carry important contents and need be >>> scheduled ealier. >>> >>> This commit is verified on a v6.6 6GB RAM android14 system via 4 test cases >>> by changing the bio_add_page/folio API in ext4 and f2fs. >> >> And as mentioned already by Chrisoph and Jens, why don't you just simply set >> bio->bi_ioprio to the value you want before calling submit_bio() in these file >> systems ? Why all the hacking of the priority code for that ? That is not >> justified at all. >> >> Furthermore, the activity things reduces the ioprio hint bits to the bare >> minimum 3 bits necessary for command duration limits. Not great. But if you >> simply set the prio class based on your activity algorithm, you do not need to >> change all that. > That is because bio->io_prio changes during bio grows with adding > different activity pages in. I have to wrap these into an API which > has both of fs and block be transparent to the process. Pages are not added to BIOs on the fly. The FS does bio_add_page() or similar (it can be a get user pages for direct IOs) and then calls bio_submit(). Between these 2, you can set your IO priority according to how many pages you have. You can even likely do all of this based on the iocb (and use iocb->ki_ioprio to set the prio), so before one starts allocating and setting up BIOs to process the user IO. -- Damien Le Moal Western Digital Research