Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp51931lqo; Wed, 15 May 2024 21:04:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWZ+WGOBYZJxKRezAS+LUCkfcbI1Z767c29oIlMpGRqfIkjStkJCqIrcc+LwePEcnbIVxL4QJ/stQ94ME4XU21M7lUdckApjxryGA5XxA== X-Google-Smtp-Source: AGHT+IFi0ZJnCgHNQ48S4tulZAmZ0DpmGy7HElwrtqyfPxPxOTtLSbccwl+9DT/sOUdYOqSFGtfx X-Received: by 2002:a05:6214:4b0b:b0:69b:2446:2f14 with SMTP id 6a1803df08f44-6a16815e486mr212062076d6.26.1715832282342; Wed, 15 May 2024 21:04:42 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6a15f2f0abdsi156436116d6.511.2024.05.15.21.04.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 21:04:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180614-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; dkim=pass header.i=@vivo.com header.s=selector2 header.b=Xj6oaKs9; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-180614-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180614-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 0B50F1C22848 for ; Thu, 16 May 2024 04:04:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE1CE44C9D; Thu, 16 May 2024 04:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="Xj6oaKs9" Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2068.outbound.protection.outlook.com [40.107.255.68]) (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 32C523F9D4 for ; Thu, 16 May 2024 04:03:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.68 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715832195; cv=fail; b=qm/WvC0YpLl3hz7EZEqWZ12HiHr2+IidIJZvmVpSB0pWO7e99Crq7WLVe5tMAShAhwVMuJf2DMxVpX8MwEg8wNvF4SRwv1TwzCwFFtvaF4vTef/bprefzDZGY2FhBW/HXun1tubApenLBWwWR4R9bE0Zs3lNu33qdg9yy/G1eh8= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715832195; c=relaxed/simple; bh=pPWvRKMPkRY+EnBmIi6erbgSwiPgbkjhyxIFZjHSVZs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=E2rvwXMEmXTLppsdBcPRgzuc6YuUKdAO1nMlB2pB+WpXgjziIDqds4CKa6/+FKnU4o3nbfdIypRlDPScHZTYNOtLYoUk1d4mYxrNXjAf1Bf+P2tTMkjI+QGPg3aFIXURD6QS3owrnRTL+X3PFd0/xClZyQFjSWx5FUIWMSceUdU= 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=Xj6oaKs9; arc=fail smtp.client-ip=40.107.255.68 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=diMSQDWAvcO3PQTmqbDHgtStmSNel63evlDswiQGXj5ym/I1ft65nSL4FubWBP/VEKBsf2JcPofskjqUaqOKUnwnRUnfx3jr+lX8sZDqDmSvnxW4OKwZYLn5mwJHfp/CI4ff7EKA/CC2b6Fa8ZxqP63U1c7LVrnTOPcfv+BjF6+ZkAeUyZhgDn/aWVuw6W11csS/xA31DJ+oCilIUaQwePbQpvgRrFYPenNP1vCZ5f3tG7rG+mvifarzMjx9uVftoqOdV/W3uSvxGS79Bk5bMZpacgBls4UunRHTNAJXhleO2TxPEuJ0u9B6yujihCn7a2qTDQ7WGSgwh2f4a+kqTA== 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=UIeJsBPtDPMga2eTW8Q2WtGzmViD9lAT7ycs+SL87ihUJpjSJuFjLq81/soiZ67dbwgzUYyNMK+f4M3FVVU30LWWvWO3McNgJAfP+dIaRZG2CdZlrqVasTwovnFzHCNk+ldMhZUKRBFAmwmLVyJ91QLE9FrF1b1ZzlP7+ONPqLNfFTSJGVm0YxcHwx4s9+lbX3fq1hgbMJBt0QA4yZCNp9v+q3qmOu0qK5H/CNdznRfqWG4u689UBCCaNMi4kFJ5BjuOfiQJTwuwWHhiIb/64WTHDdd9u4N6wxElqOV2w7vMy368oUEqRPFLe93xC2sDLy01AJNXDFF5+meL86YHrA== 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=Xj6oaKs9QcTKYF/jK/GDJPi2+NbeWL0MfImlPncEWk8n+ndjSIUNehev0VGQSvCx365xeOAzH/qESFfOAz1ORwxdY0pRj+XFn3a9m1TlvQKGToYNWnS0lHtJPDKjjcBwbGYjC9HuyF5eSWYWC4147Nus6GGE4j3UUI2fvQtF4DhR34T6agToTY95eGGPBCg5uTA7GIBDRhvMr5Eep+j8HPRZE5Mmn05qrd0D+6oG5jkKtZf0JapwV+u/aCEp20bAL7cshmri+gzmLPRZYykOJfr7YOdMb8jcxRoNCTi+dClxYm383Wvwm+t/8fmIITwACGCBMwfHQT3WNPi/xZ+BXg== 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 TYZPR06MB6807.apcprd06.prod.outlook.com (2603:1096:405:1c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Thu, 16 May 2024 04:03:10 +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 04:03:10 +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 v3 5/5] dm linear: enable flush optimization function Date: Thu, 16 May 2024 12:02:34 +0800 Message-Id: <20240516040235.115651-6-yang.yang@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240516040235.115651-1-yang.yang@vivo.com> References: <20240516040235.115651-1-yang.yang@vivo.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: TYWPR01CA0017.jpnprd01.prod.outlook.com (2603:1096:400:a9::22) 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_|TYZPR06MB6807:EE_ X-MS-Office365-Filtering-Correlation-Id: b55282d8-3641-4abe-d945-08dc755d19de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|52116005|366007|376005|38350700005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Ro2YuFHn1bkJC9Xmajkui/McbYeJ7gqshFqOC1ccRZqzy23xlpLr4pF/I9VL?= =?us-ascii?Q?tAffn0gTBYgGkxEmZ6w5wd45MMDwUiM/V7dI0gn2cPTPB0qWW3rDDBcspIDA?= =?us-ascii?Q?MviWqXh7PLHWYTIHQb2Y2ptwHYJcg/8QoGKmvt7sWmUJVDBrRPSv/f29cD9V?= =?us-ascii?Q?ObH2pygHDEwSe6IF1v3U4HTN+7S3hS+fRdu0W3hiX53lT2s0lUZLGSOazqO0?= =?us-ascii?Q?JBirwoGnb6jvfBI+/zFfHAskWwuxVHM49kk6LCm+xtO29O0IdzMNt4v8Z/i6?= =?us-ascii?Q?fY1vRe4S6DnpvIfMXG+M+V88MZj0a3eyeoHkPu3OjNf/8EXz9OmwEi8m0jbt?= =?us-ascii?Q?1rnZ9BHfI0bAQp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BNhFgJloWYEQ?= =?us-ascii?Q?uOJRA4tmyAA+6l+Mabw36goZRP6ug0ZZFuoHzByazM+aWeTJa62+IDyZ6ddf?= =?us-ascii?Q?tWFdhOlXlhNvACys24VX7LcalwegRxGJKeocCq2rEyfbhw=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)(1800799015)(52116005)(366007)(376005)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?FEISBvIKuXMhCI4kcbj6uN9QzQRVKwofGsVYzIfA7LWcA1UI9MtZOxVqvL+Z?= =?us-ascii?Q?tZLkL7Q4V6f9KMmcKz5Pwx67Tl0hM10PZ6qM8ATAQQ43SppvVxZkBk6Zvp4P?= =?us-ascii?Q?fBGFKyvL2U7kRQPitHgACIRQXmPNAhTeseo+n3LPoi8nnv2rAQnWyf0+ruRB?= =?us-ascii?Q?wTsqW0siKA0lxjPoOlaKpNsAuXWiBGotajD/22up6KB9bEl4hql16MaZpYSS?= =?us-ascii?Q?eSfAtyYuQDWbA76LHJC6La8s+qPIH88QFqATg859xusqohT2wLqxaBgHhK9i?= =?us-ascii?Q?mBUf+FluuTDiO4bVp2CKgiN1Zr92Mbxeu5dnAnRPHEcpYzfhxSJr9FLWxUe/?= =?us-ascii?Q?3b2jzaUHglw3PHkqDY1Z+vDUbuYJGtZOaFqKWVHsMC22lHiEgSLjc1fe5Wkj?= =?us-ascii?Q?krj+kyBrQtjrRSOmxKYqJkpJNgMXFn/R9YFQ5N3SpWUPhvYYVxYsVh9OUa9a?= =?us-ascii?Q?gEEXd3ZACfn/+HIqoklncKqti3D2SCJ4124LjLiOaDi/AHWsl8gESD0Wgz0x?= =?us-ascii?Q?8R1qtJKXdxC1Rn/PBFfa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ascii?Q?Y4jfNeaTrXfzieh1uDc2mNObYERMi7QX1PVAK/rdhQQxn693h+TA11J/JQF3?= =?us-ascii?Q?Ks3BgHZJnuRZq3rfkdJSuL5HAqOHLA2L8gV1xJIPFEjOBFFOgmqBcXrDwLLD?= =?us-ascii?Q?0V9Z9w4ev2R80pTDlqnCSNO4owPJh33kfcPyhfww?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b55282d8-3641-4abe-d945-08dc755d19de X-MS-Exchange-CrossTenant-AuthSource: TYSPR06MB6411.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2024 04:03:10.7652 (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: 8T2KekCUOq9JoTndhiNvgS57k9UpLFQPcxZw6qvZrvkP07lh+OlnNVKk5G4eXilhNCDfBb4jEXNFq/WeQdP5bw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYZPR06MB6807 __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