From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5246C47258 for ; Thu, 25 Jan 2024 08:26:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10915280005; Thu, 25 Jan 2024 03:26:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0948E8D000C; Thu, 25 Jan 2024 03:26:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E4CF6280005; Thu, 25 Jan 2024 03:26:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CF34D8D000C for ; Thu, 25 Jan 2024 03:26:11 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 77B85C0376 for ; Thu, 25 Jan 2024 08:26:11 +0000 (UTC) X-FDA: 81717150942.18.F29EFBB Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf05.hostedemail.com (Postfix) with ESMTP id 974EB100002 for ; Thu, 25 Jan 2024 08:26:08 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UO4C8Izy; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of dlemoal@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dlemoal@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706171168; a=rsa-sha256; cv=none; b=XE7zBEKW1xq+QiHx/u4trwOca8qCLpxuCUF6zMphJ4JfWgvFaiGeudIcWucjoa4iG1sIc5 rDt5l4HHwwacdJy52EcVOQiuQCCU6iNi5SHCcxY42haPpbyzmvguVwXV+sl9OsmaM2EKFH c6LaUbaqwrFatF4xLUHC1tegLeKWEOA= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=UO4C8Izy; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf05.hostedemail.com: domain of dlemoal@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dlemoal@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706171168; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=joIWsi4ODd93v27OGzztIA7XHVb5qa5sM66eSlssLGY=; b=hkEk1QzHEvQi5T+K0MScuv/I4Jx/pX4aZWPx+x9EpfEOhiWZA+g6VnjlIEQ+jYNNn7cn2d PKcZvDR9simDcNSp3DMUw/oOb7qzJKMrm9k+ItpTZ0HggZzWw9gaZZtk4PqDDherDtwm+y 6n0VTVOyeo9JYNExFWnvL+GTd3aHAWI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B3C686210F; Thu, 25 Jan 2024 08:26:07 +0000 (UTC) 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 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 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 974EB100002 X-Stat-Signature: wc5yr6r88qu5j4k67uomu3ox5ccchui3 X-HE-Tag: 1706171168-910175 X-HE-Meta: U2FsdGVkX18H+/6pGs8tSKGOjRUPniotxq5VaAdxgIyPkrgxaa1msytUiqFl8vph6JMyB4IKTjpHN15LMmY6GsQWMKCYblBSfF3wdenJLSwijWxmabB2Oa/nz3AhF09A4yGe67exENRRlCS98IaivNeosFOTSHHk7H1P4h1aHOgcE39ltxhIzEd1YVRYvb6vsocoKfCS1x/aPwKeG6Te9zM4CUf+q20ONYIJLkSvgoyPKkEaBJBHeq4Y4nM2newCpT6KUMqAmMruwitcrCIVyATxZxIwVhJWDVKA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N X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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