From patchwork Wed Feb 21 07:53:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "zhaoyang.huang" X-Patchwork-Id: 203993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp892061dyc; Tue, 20 Feb 2024 23:56:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV5OwF8OZYs58Q2H88Nc2WFEV1S698ERcu8ZX2ZACmkqoR8SDI6eo9dwgQ3k9XF8lXqgyychqwvy90iD7zjSTK6H6uH1w== X-Google-Smtp-Source: AGHT+IHlkCy39+aUXKishb2QPS5PBGC4uOOXMEn2hM+rtbM/UxtKtzz/W6fA4CLY+NVGZz9HXk2a X-Received: by 2002:aa7:d5cb:0:b0:565:f51:3b26 with SMTP id d11-20020aa7d5cb000000b005650f513b26mr56403eds.30.1708502183624; Tue, 20 Feb 2024 23:56:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708502183; cv=pass; d=google.com; s=arc-20160816; b=uRt5OHNEuEua4N8pcawnEDAoZb3tmzQ+KZGQhihjkfeGk31bEZ9xd78wR0+x7q6TZr hf5gQ2X8vIzOYPQ9SwgHHxMJ6L5WYTLQfEIGfdAdUMqY3C8rJmDIBxh3qFcIWPW4D2NL 4Q5Eg29GEp4Ub8FAPgQ28baQwZJd8azVeoClqjuxbExzjhEWHSsRPal6aer3+VvxhInP ++bhHZXQcozWr61+nxXkJgYfga5ViBJfBy+UYtvqSfFI4lJN9H00d/mbvIi8vCMwjPpz u4OUmE+1gCa8uNw4TL4/pp9qqDprXYd3Kf/HYM+wuFoyFnwwvUUWHLQD7vBhRbTeUQG0 VwKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from; bh=ARPYyaZ5P/Iy/r+n2plKtGTES/dlqlOsIovv7aUkmPQ=; fh=QboBnjVs+4/WgjlPjMqwgk5tJvKd7L37xZeFzLcDUhk=; b=Mbc2EPAnKstXjfQQwqIigvYURR10lBzdFO/4xdUg9Sui39orRDT3UV9I1YbCLRVXyq mAwQrnAJ58+nrGIoEzsxOw66OsFDIyCjR19DFj/FTFZGSOyLvkAokfFRQDMwLjFQUk13 2yKJEL3uQCPNslUymVhWioQoUl6GIHiOIfBYorOZ+PDXvqofPAMrofFZip2b0Np3e07j 8G0ZnVq/el8Ok9zeAdl0My5vCSJkEdIcv1tSdDZir7h95x16mYRKkyVpQd1s9/9dOB12 G86cP4u1CWKL1zWMPtSQn+OD99jgz005v7gr1OPaeL8wrcAXyqELbOhSAx4LpXw68b2N jZJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-74269-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74269-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j18-20020a05640211d200b005643fb48a5dsi3642545edw.3.2024.02.20.23.56.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 23:56:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-74269-ouuuleilei=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; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-74269-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-74269-ouuuleilei=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 41FA41F23688 for ; Wed, 21 Feb 2024 07:56:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9406C3CF40; Wed, 21 Feb 2024 07:55:42 +0000 (UTC) Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) (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 BA5F83B199; Wed, 21 Feb 2024 07:55:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708502140; cv=none; b=u2WwjizXxLPvu6aVh2D1s/jhcuQxTMMVmA8rn6vwrEwAtjpe916M2tukQ3iiG2cKhmD4l/0JJM9XsGWnjeALNPNZsCNjP+yeGeQKjv+KvbHNTWno9y/xU/LKBAFk6PukGMIIA0nJnsnf11l2/tMLiL5HAFTf+snRDsxa8lTuYG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708502140; c=relaxed/simple; bh=5qPfkNy1DFd4622RFuqwJ5cJKu0Oocx4ULCnkiyPhvU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Hh1mLJrEp/yczwpyXM5nE3E4+EOoNObmHhw2hNhXAkCuL/pwN/rCBvucETDB7/KPMO4GPCwLjqge9rbCXsV4s2gx9a2s7P23Z2j+1gv/EPMj8CIxthMospHUSWJY+RHWXbPpGc6+ekDycghHF946Q62VMo+oyGjxFBxJ+KJK/W0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 41L7rmhs061563; Wed, 21 Feb 2024 15:53:48 +0800 (+08) (envelope-from zhaoyang.huang@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4TfpRY1pdWz2KGjJg; Wed, 21 Feb 2024 15:53:13 +0800 (CST) Received: from bj03382pcu01.spreadtrum.com (10.0.73.40) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 21 Feb 2024 15:53:46 +0800 From: "zhaoyang.huang" To: Jens Axboe , "Darrick J . Wong" , Alexander Viro , Christian Brauner , , , , Zhaoyang Huang , Subject: [PATCH 2/2] fs: introduce content activity based ioprio Date: Wed, 21 Feb 2024 15:53:38 +0800 Message-ID: <20240221075338.598280-3-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240221075338.598280-1-zhaoyang.huang@unisoc.com> References: <20240221075338.598280-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 X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL: SHSQR01.spreadtrum.com 41L7rmhs061563 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791494385729336135 X-GMAIL-MSGID: 1791494385729336135 From: Zhaoyang Huang This commit would like to introduce content activity based ioprio into general aops and def_blk_aops read/write API, which account the content's(folio) activity and set the ioprio_class accordingly. This change do NOT violate previous ioprio policy but only promote the value if the activities raise to certain proportion, that can be deemed as both of the IO launcher and the content's are important for raising the priority. Signed-off-by: Zhaoyang Huang --- fs/iomap/buffered-io.c | 3 +++ fs/mpage.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 5db54ca29a35..5079395d6823 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -390,6 +390,7 @@ static loff_t iomap_readpage_iter(const struct iomap_iter *iter, ctx->bio->bi_iter.bi_sector = sector; ctx->bio->bi_end_io = iomap_read_end_io; bio_add_folio_nofail(ctx->bio, folio, plen, poff); + bio_set_active_ioprio_folio(ctx->bio, folio); } done: @@ -624,6 +625,7 @@ static int iomap_read_folio_sync(loff_t block_start, struct folio *folio, bio_init(&bio, iomap->bdev, &bvec, 1, REQ_OP_READ); bio.bi_iter.bi_sector = iomap_sector(iomap, block_start); bio_add_folio_nofail(&bio, folio, plen, poff); + bio_set_active_ioprio_folio(&bio, folio); return submit_bio_wait(&bio); } @@ -1742,6 +1744,7 @@ iomap_add_to_ioend(struct inode *inode, loff_t pos, struct folio *folio, if (!bio_add_folio(wpc->ioend->io_bio, folio, len, poff)) { wpc->ioend->io_bio = iomap_chain_bio(wpc->ioend->io_bio); bio_add_folio_nofail(wpc->ioend->io_bio, folio, len, poff); + bio_set_active_ioprio_folio(wpc->ioend->io_bio, folio); } if (ifs) diff --git a/fs/mpage.c b/fs/mpage.c index 242e213ee064..f209e5860423 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -308,6 +308,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) goto alloc_new; } + bio_set_active_ioprio_folio(args->bio, folio); relative_block = block_in_file - args->first_logical_block; nblocks = map_bh->b_size >> blkbits; if ((buffer_boundary(map_bh) && relative_block == nblocks) || @@ -626,6 +627,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, goto alloc_new; } + bio_set_active_ioprio_folio(bio, folio); clean_buffers(&folio->page, first_unmapped); BUG_ON(folio_test_writeback(folio));