Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp147776rdb; Thu, 8 Feb 2024 01:32:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUfTvNGmEeqC9GM/fE+jOs9YqiFv281TdqICnK9SBfYePse6fsk1ZFKeuuQFAoWuggel0cyGpVQqft3gONf9O43wmvV1nSsAbyTsOx6iA== X-Google-Smtp-Source: AGHT+IFJe20NpA2dmSf7BKj4Do094PnLjhoOPF97FBSN0gilAZEjPyav5kapz0gY7JIBaRIt1GDT X-Received: by 2002:a05:620a:40c9:b0:783:e9ba:7d43 with SMTP id g9-20020a05620a40c900b00783e9ba7d43mr9862594qko.59.1707384771317; Thu, 08 Feb 2024 01:32:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707384771; cv=pass; d=google.com; s=arc-20160816; b=lr0WNz89SPYcrymH1K2fhwtq0sUWXvwYgchlXnT2AohxsenL33vSP8/BVOalcNiFgy SC5tyWb/7wolGCJjn/D5OGcgmZfy1WIrE7GtAjwa/EP5JluAN34MCr2pwcbiDIkxc8oF pPpa+TN5fmbkyG8677I2DxQ9IvQJm4yx2WSH+TQXrb4JgPx75+idpLELYhdGMh2Ovd/z WBLKeeApipyC7BrBRSDuNI39dnM+j6e8ypwyMsc8gwDAgWfY4yoJwb2HHbfo1sJCDRbS Wp87Jva/r/r7MCk8d6IUAcMcLDFCRmAC12PaJzHge9wVWc+7SbJMQuPQYeNAMsFYjqKf LJhg== 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=ao3Lt+V2TQTTRvfLH9cEI/xWBQ0/rPYSBJogJZBCNqU=; fh=YFz7RD/wE14JAPU78TTGxi+5Usn+HbTasFPl/VkV+YY=; b=fyGh1A2OFjDwpUHEPulCJIpKrX+AHxaf4QS3uiM3ylCHPRt4odmHHlQO3Cw/FgVuMW zOuucTZW67T5RIl1Fj74ABc/c2xbdd2UWrJHYnfkMZtdK/VJCZG9UH46LbvDITy+8Kp6 EfSS+jqTxF07k9QcirTBSigXFeHcY+V5XQVReAGroQFEES87kwNWCHZ3K1MtBbPoFMHp 0w07XndLtYdEdvtr//qhOa4BrvMeU/myhjchbZe/LribUrpsTb1xhXvDVl2ZoYG1OO1A fWS6++kFsClP0LrrMd4NdrxI05foYc1zuVSUFjdR9OCQ0u3aB78HxkIpydCbql+B68d1 l7Bg==; 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-57751-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57751-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVvnkUpszBANd0VbtJ34u13wMtBxnPUQj4u826DS8S/0pabGxbY27nbkEbjDSoYRrSsio9JxRSAnbgIJXdo9THWvM9s5tTel1sfy/f6DA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a10-20020ac85b8a000000b0042c10bcb12dsi2939046qta.356.2024.02.08.01.32.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 01:32:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57751-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=unisoc.com); spf=pass (google.com: domain of linux-kernel+bounces-57751-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57751-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 175741C22D36 for ; Thu, 8 Feb 2024 09:32:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F05746BFAA; Thu, 8 Feb 2024 09:32:44 +0000 (UTC) Received: from SHSQR01.spreadtrum.com (mx1.unisoc.com [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 57AF6171B4 for ; Thu, 8 Feb 2024 09:32:40 +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=1707384764; cv=none; b=o3woQGTWXZCxsHo22Zw7JiYnfaHmbMDeQB/Gf7BvoV7WdwvwMrwHQ7H4p3Qr60DyHr1h87KgHc+Fqqcv/a/hTHaSX9A27CDmAfWHexH080Vk/KBX+01YXQSzX6ZNAH7GngJCYPXQoA/8AtYofQFhPnBGpblf6xbreqvs2LooRyI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707384764; c=relaxed/simple; bh=Z43mwuX48ZWWYGQscTT9lPoGr9fJEhXO9dvSyk7+URw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gT5csCWPTuIFRNTl0eYNFLIo4dJqjYaa6YtWBvddDjaQEuo52waSgNDQk2iX7wc//fAlK5/UdkxIRWVEippGSRljCEg8d7LUIphdWda3n+3ISH4PUHNDWWs1dY99ePtz/AaxU4lHeX3hqSz5zaEsaS++pw4Erppm+FCRxU6B/6A= 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 4189VqAL048943; Thu, 8 Feb 2024 17:31:52 +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 4TVsFB4n1fz2K4gjP; Thu, 8 Feb 2024 17:31:42 +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; Thu, 8 Feb 2024 17:31:49 +0800 From: "zhaoyang.huang" To: Jens Axboe , Peter Zijlstra , Ingo Molnar , Juri Lelli , Vincent Guittot , Yu Zhao , , , Zhaoyang Huang , Subject: [PATCH 3/3] block: introducing a bias over deadline's fifo_time Date: Thu, 8 Feb 2024 17:31:36 +0800 Message-ID: <20240208093136.178797-3-zhaoyang.huang@unisoc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240208093136.178797-1-zhaoyang.huang@unisoc.com> References: <20240208093136.178797-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-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SHCAS03.spreadtrum.com (10.0.1.207) To BJMBX01.spreadtrum.com (10.0.64.7) X-MAIL:SHSQR01.spreadtrum.com 4189VqAL048943 From: Zhaoyang Huang According to current policy, RT tasks possess the privilege for both of CPU and IO scheduler which could have the preempted CFS tasks suffer big IO-latency unfairly. This commit introduce an approximate method to deduct the preempt affection. TaskA sched in | | | submit_bio | | | fifo_time = jiffies + expire (insert_request) TaskB sched in | | preempted by RT task |\ | This period time is unfair to TaskB's IO request, should be adjust |/ submit_bio | | | fifo_time = jiffies + expire * CFS_PROPORTION(rq) (insert_request) Signed-off-by: Zhaoyang Huang --- block/mq-deadline.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/mq-deadline.c b/block/mq-deadline.c index f958e79277b8..43c08c3d6f18 100644 --- a/block/mq-deadline.c +++ b/block/mq-deadline.c @@ -15,6 +15,7 @@ #include #include #include +#include "../kernel/sched/sched.h" #include @@ -802,6 +803,7 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, u8 ioprio_class = IOPRIO_PRIO_CLASS(ioprio); struct dd_per_prio *per_prio; enum dd_prio prio; + int fifo_expire; lockdep_assert_held(&dd->lock); @@ -840,7 +842,9 @@ static void dd_insert_request(struct blk_mq_hw_ctx *hctx, struct request *rq, /* * set expire time and add to fifo list */ - rq->fifo_time = jiffies + dd->fifo_expire[data_dir]; + fifo_expire = task_is_realtime(current) ? dd->fifo_expire[data_dir] : + CFS_PROPORTION(current, dd->fifo_expire[data_dir]); + rq->fifo_time = jiffies + fifo_expire; insert_before = &per_prio->fifo_list[data_dir]; #ifdef CONFIG_BLK_DEV_ZONED /* -- 2.25.1