Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp129450lqo; Thu, 16 May 2024 01:05:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWhPiehL1IlR0lazDvlJY6M1Di7oD+R9uvjwZQ42uCIRrnYMCfbk6WhRY3/WHpFLd+YUp6lTVpXvxMJt32HrSPCA10Cb1lnLyJszosrmA== X-Google-Smtp-Source: AGHT+IHbzXPmvuJFpZspDL68dG6NkSLMhD/ABi1rx8Gj+8Ag81cdNTVz25venEwHiGVFOpvJo443 X-Received: by 2002:a05:6102:3a06:b0:47c:24d2:6cf with SMTP id ada2fe7eead31-48077e9b018mr16911486137.30.1715846741563; Thu, 16 May 2024 01:05:41 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f30070csi140963396d6.540.2024.05.16.01.05.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 01:05:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=absooTII; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-180734-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180734-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com 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 3A6771C21B55 for ; Thu, 16 May 2024 08:05:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AAB57137921; Thu, 16 May 2024 08:04:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="absooTII" Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2079.outbound.protection.outlook.com [40.107.117.79]) (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 0F4701369A7 for ; Thu, 16 May 2024 08:04:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.117.79 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715846660; cv=fail; b=Ho54w1CuEpAJUhvR9lDRFPyA56NVo4AzqaxZxqCfiNy3xyfQZToZuLhf74O6vwQFVBbOyQbFP03IRCEqqDfJVLEijiDSkE3YX52a0xI6YyNKU2DnvYrRyBfyy0Bx59VTkEnM6X1LZaxjrH/NL3Nc/6LvioMuTfjQkHkSfgX8d18= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715846660; c=relaxed/simple; bh=pPWvRKMPkRY+EnBmIi6erbgSwiPgbkjhyxIFZjHSVZs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=LN9mgD3MZd6ZEHQ8eKcREtNyZ8EFVQgIwDCd/kwYMCFtJV6vspi83uyMDaAcAF0AsIzOe11fXqF5NXYJTm4fVD+oyoZ7DA9AwS1UktmatfG5IrgEeXy3GBEdua8ww68dOHV1bOn8WAHnHRhcjtVolqnH8oz1XFh+9eBQko9MSow= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=absooTII; arc=fail smtp.client-ip=40.107.117.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fB/EIIjjfzZO4ty8LKsbhdnRSdPIVk3rGOFs/rLW1FduF3bYNY3t2jbf/meyo8BpDRC6EqY3CZOr94jZvbbwOrEZzNcNiYA+u99XtR51FwO18soZZe8nhq+vrBODi2o0yzSlJ+MS+AoObt+EjsYI/QeTOWk6Gcy6Bihb8k2rpaFNRcclEyFtaizUmLdCHzpntXP443+OI3DJNaMtTj6UAzxx1Jyn8wfQyrfT/0Db8iOJocr4T7QlwpFnbcgsuwOFqt75T9r2ItLhfhEjwrVoS1tluap96rcMtjzyhFTDGU5rf6rP99yis3SvS08Z1buAnW6UaQyx8e99Rqf+WqZhxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BRt2mpHtqBUQEwpYTcZxeN7e22kn1HBl7EsDYJP5O38=; b=Z9edaEbcmojDorLpEGwqQL0tWUQzUOLXvVy9/b97LyOWBF1KhRyJIdFtggu+/FrQ/aBfPUodSZZaYx1QgpUvkINbmD6KenP90iZxi3GPGdB8WBzjPvLhvBS2mtXm3XVR6jRzQTgHN0Ydqnh6SH6hvNrVuUhOP5/ynnXEOKKzyzl5bqlQDrtCt8oxEtxMMXtlUexz3WHWMAxriWoh5XLY9VsCo+TtPgr7o31IAAIJTCK2tTuizDiPLyN0Ef43IEI+l0O/3VKnzYV5r7pVEK+idgdw9oYTZjpXZJ1Ctl893DzrF6sfCwkmlsyjweplTRsq24Fn1BbA3szRTscrxHUiVQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BRt2mpHtqBUQEwpYTcZxeN7e22kn1HBl7EsDYJP5O38=; b=absooTIIXCxYJ0fMnPKFY9JhxZJVFGdELYOOE+3jxZZ5Ws/n14gLqWk3RpX0G+hOQj/E8tWNsxt69MFrypyRHPlVDoPh/PKIRRrdxZa9qJIZGMXrtvchdYg2KbVmGPKNc4GXftaooPSMyO+AguKUxbt1eEYBX+1lsBQIHwUnc6rI55dgDdj6gqQp9veJCIxUCjGAAkbbN2/xClmwuSmdwxOs62nl9bYNXy5yiAgw66mFhvCFeGyywlfVTmYGBwY7ri0ZJ7AAP2wclkzW/PmOmgX2iDhOS8YSvWcR2UzXSbHh3xcZsep5jZvGE/PB1tCDOsrLlvf+f6l9CQkpBIcj9w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYSPR06MB6411.apcprd06.prod.outlook.com (2603:1096:400:42a::11) by SEYPR06MB6830.apcprd06.prod.outlook.com (2603:1096:101:1b3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.28; Thu, 16 May 2024 08:04:16 +0000 Received: from TYSPR06MB6411.apcprd06.prod.outlook.com ([fe80::8e76:5af3:e027:ccee]) by TYSPR06MB6411.apcprd06.prod.outlook.com ([fe80::8e76:5af3:e027:ccee%3]) with mapi id 15.20.7587.025; Thu, 16 May 2024 08:04:16 +0000 From: Yang Yang To: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org Cc: Yang Yang Subject: [PATCH v4 5/5] dm linear: enable flush optimization function Date: Thu, 16 May 2024 16:03:18 +0800 Message-Id: <20240516080318.120231-6-yang.yang@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240516080318.120231-1-yang.yang@vivo.com> References: <20240516080318.120231-1-yang.yang@vivo.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TYCPR01CA0201.jpnprd01.prod.outlook.com (2603:1096:405:7a::18) To TYSPR06MB6411.apcprd06.prod.outlook.com (2603:1096:400:42a::11) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYSPR06MB6411:EE_|SEYPR06MB6830:EE_ X-MS-Office365-Filtering-Correlation-Id: 0195cbde-feed-43a7-6de7-08dc757ec856 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|52116005|1800799015|366007|38350700005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?cqxVHo0QwXfE7osLUCtTdtxDHSc0FxQWrpc50lTCvysa4FMF0jOuJ9CWZ0pj?= =?us-ascii?Q?Yp94sLaowN0nUu4EWGgRm3Gunj2WS5eELA6XqlCbMJgl9twfC6+e64m61+zl?= =?us-ascii?Q?zAf+pun73SeCu/Zg7FB7/T83+07KxstuhepeD9w0tQIPL1zfdaHJSBmhWfSG?= =?us-ascii?Q?EoNu+CmZJB86fNPVSNZnfjB/3NDzox4hZiAMkwndvPf6dmn/zlPjV4GM3Occ?= =?us-ascii?Q?mWtWrFyxKoiObYkSJHRbCn8PqZ4o4tLmgWhcoYQ7EBFx38rB2bvX/kclTVQw?= =?us-ascii?Q?eaSU4w6of9XCplimeUjA9Ga9n9j7FLwAGMy5x2qD5f7VRgQnucVK8hj/u/5g?= =?us-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8jaAbo9dLQF8ck4/eb1gKhZL?= =?us-ascii?Q?BsJegSc1VJrnKiCtMFlqAD5ZR9APG8DTWpKXCtPYQve9/O4zE02Diz5tCSLe?= =?us-ascii?Q?OaNECtwLI1eU3MgpdU3aSwmdQqLn6PtTtkj/l3YSfFeKQA=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYSPR06MB6411.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(52116005)(1800799015)(366007)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ff1Ok/aSWDmc/oKgX6Z3mRiweLDSvA6plgEAAb29iB5iom9oNQjUR1BK7cx5?= =?us-ascii?Q?iFL67oKIEq8/6Xp4UJuWTVPRbHu+OPzS1cB7uWPh+pya4n6jdikqEadYZ3oW?= =?us-ascii?Q?9EZo6eCGOG7zjeLwW/qZKQpUcVrtkbV84Dc5YnYyok0sEVcM1nmvDBFLpB3E?= =?us-ascii?Q?1tbP2bGVMHeJwFgnHqXZUGQrnZtyHHJ1gqxgKo/JEPjN0ecCtW4LrQgOBNXD?= =?us-ascii?Q?JtCmVX8x6oqwCxcwZMYu9pGfybeFuKf0cmG7Fp+y/J7S0FP50lePsRKHbuQe?= =?us-ascii?Q?qzW1G2N64HFHESDUXR/LucZQBIKZEZSqq7lADYc8oerEg82c0YccY4WRihwP?= =?us-ascii?Q?2D3iSCU+10UjlATGNPh8foOIRe7zk1UqxInhJJSlQ6Rp/8muOMyufWrke/Ei?= =?us-ascii?Q?utaHfw4rhlYqsAwYCSqQr10PrGvYhHFrH8Tn67c/CyrkZNC36qBXwr1Byoa8?= =?us-ascii?Q?6IcZcxZUJJuO3pItd7YYbMHwZHMiWvS5Kvz9kZg8ifCzUzFwPLD2GqSjn9z+?= =?us-ascii?Q?dGW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ZEQQzq+sv+2iUq0zgxusFPItTR?= =?us-ascii?Q?rMcXWoF+eognL7VryO3X27YbUQOB6+rkWEwC8qbov+m6d0UG0Kd0k1gYZsSn?= =?us-ascii?Q?0wf6nShC8FjFPnbRyHYAhk8FoH0vd6l1oKmHhRrojbrK+TSSgK9mo11+TKU3?= =?us-ascii?Q?YS65vjpppQz+vmORWQwRcl6DAZDMJh/NzCbfLoPd?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0195cbde-feed-43a7-6de7-08dc757ec856 X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6411.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 08:04:16.8848 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 17Flpdv/WdRoZqeKbMIT1x4mzmd7/yA7QNnJXSezCuNfpimZO6BBt9Q20Qt9u/OMqqMDdYroyb4dcS4X2MuzJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB6830 __send_empty_flush() sends empty flush bios to every target in the dm_table. However, if the num_targets exceeds the number of block devices in the dm_table's device list, it could lead to multiple invocations of __send_duplicate_bios() for the same block device. Typically, a single thread sending numerous empty flush bios to one block device is redundant, as these bios are likely to be merged by the flush state machine. In scenarios where num_targets significantly outweighs the number of block devices, such behavior may result in a noteworthy decrease in performance. This issue can be reproduced using this command line: for i in {0..1023}; do echo $((8000*$i)) 8000 linear /dev/sda2 $((16384*$i)) done | dmsetup create example With this fix, a random write with fsync workload executed with the following fio command: fio --group_reporting --name=benchmark --filename=/dev/mapper/example \ --ioengine=sync --invalidate=1 --numjobs=16 --rw=randwrite \ --blocksize=4k --size=2G --time_based --runtime=30 --fdatasync=1 results in an increase from 857 KB/s to 30.8 MB/s of the write throughput (3580% increase). Signed-off-by: Yang Yang --- drivers/md/dm-linear.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c index 2d3e186ca87e..3e1a33b4d289 100644 --- a/drivers/md/dm-linear.c +++ b/drivers/md/dm-linear.c @@ -62,6 +62,7 @@ static int linear_ctr(struct dm_target *ti, unsigned int argc, char **argv) ti->num_discard_bios = 1; ti->num_secure_erase_bios = 1; ti->num_write_zeroes_bios = 1; + ti->flush_pass_around = 1; ti->private = lc; return 0; -- 2.34.1