Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2552565lqo; Tue, 14 May 2024 02:07:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV8MvgOGItjZxjOA80b3v4bmlgscmxEOtZ2mdvDU/C4mj18Z5pYV8JWoCl3VW/93HnCXP84Ij9rNVwQ/iMuEVe50WgxkvxnsJsh4OUWYw== X-Google-Smtp-Source: AGHT+IGC/PzJmCkF4+LTg9c5moUKAkBoyBbCCK5CKL0GM2TY/pGFaLjUIzUbUme4zZuqB7T8mXyE X-Received: by 2002:a17:902:9001:b0:1ee:a09e:c7b0 with SMTP id d9443c01a7336-1ef43e2a080mr102947825ad.37.1715677631123; Tue, 14 May 2024 02:07:11 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0b9cf36fsi112454885ad.106.2024.05.14.02.07.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 02:07:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-178485-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=AXvAd4ZG; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-178485-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-178485-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B935B2836AA for ; Tue, 14 May 2024 09:07:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 520243B290; Tue, 14 May 2024 09:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="AXvAd4ZG" Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2073.outbound.protection.outlook.com [40.107.215.73]) (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 A205B39AFD for ; Tue, 14 May 2024 09:06:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.73 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715677566; cv=fail; b=e5FbRl0E35A1gm2+cdJPjTsi2y8dDehgoE8q3cfCvV+1ri81Qw+tXpLfpxdKTffLM8wT3PD4GFr/DiKaTnHwiCiw2rWuyJtGk7Hu7VhvlpwU4b525MAwC/F0Q1u+fmkOD2o1DHqL5PmkFTDvF76GLrWjldAGntfKjgPyGsuwSWc= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715677566; c=relaxed/simple; bh=pPWvRKMPkRY+EnBmIi6erbgSwiPgbkjhyxIFZjHSVZs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=eq9bYidrwlAZgerX1ooRkdokL4zv5LNmnv9ukPy6hKuCAPZ0M8qf8hdmRwVKAjzDu/3FTqCpocpdQe0LpQw2hGo1CXyoRRRFrRJO/1Wr+BkSYTvvldDqgQyNBzcN2/jFR6vOzch8rPKtBkKT2OIewpPEuo3STCbUoU6dAtblkow= 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=AXvAd4ZG; arc=fail smtp.client-ip=40.107.215.73 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=CW2x4MxQMIs+PDg68vEwqw8Bg1fF0EnMyNsmCVPIlOEwKSywmcpFsFSl7KF+XxUOVfyu8LhaQolDCA+8xcGIeXVdq6ENqhSfCTil+nIIJBTMTsZf6ugxMmsYJGX1tcxcreGoyvZgkdVgkZPSIG8LOPlGHtQjgfIWf8/IYjlnNOfOakliahKvMOSfIJQvQ+BMHEtq2BgYN1ZJhdRNJ/mSFWDTY/+bjw7nBEh+vLNW87q3eAbqf+Fu2BqPikcyL8GMg5GSHLaMaIR/TX9bZQE+zkFTalpEK6DqN193p7Q1dWl8XbtJpIwRU5t4fLkO50RxIsekE6aaHH+WMBgn54KIvA== 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=jvoAH+A8FMpA4W0P6A9TjL3sNrp5e4qDcMyEyQS8NFBSJwIDHItRpPr0TzuoOSOJk4z4kqfP1Han46RsIZ+m1dj4xFj/L27rNS+zOzZtqS65RNjoav+4dWZAK5QOCtTyfbpxk5DXGe6E84/pAu9vQmkmXjHXLhhf3rFvJCN/84+iwWko+rBzyiACjgkgEh0zLO+dKdl1y4LAbXYNeDJCkrKKwOtEfdJ3iaOUodKJSHOFphB1FAHn0lv+fXpYFLvQfRvGY96HILgky+zVKFC+1BmNOMO9sv/KUjmn10bjATvnMtJnt7qQ2x2du9UvWzgt3l8fzwzuijav2IYCy/yjDw== 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=AXvAd4ZGpOtxUO+2MCyFDJLy+xn41teGis1Qq0j3PpAJcNOzojAqUIimcvJAd3JOwrC+WGszlun8BZGjiuO5X2DccuefpAgINT0ZFxFUx40Q3tPi4y5eolGtH/4QfonqoCZLf3v33lFDUI799KSahDtgmH2flU27PZIVEh8JVxwsRtoOinoaM/wh97OdvxL7aLN5JskQtOiyU6IwzjN2bkDCJY3u8f4r0rljnV03wjP0UbmA0SFDdFYcTYoAw4jzqollSp1P5W7pNL1hYUeshmsMglA1r0KWUNZaUYEzrswf7tm5C8sN/8O7KfC6V+trow8A6+8LNKR/uoQWUrnyUQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEYPR06MB6398.apcprd06.prod.outlook.com (2603:1096:101:145::9) by PUZPR06MB6102.apcprd06.prod.outlook.com (2603:1096:301:112::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Tue, 14 May 2024 09:06:01 +0000 Received: from SEYPR06MB6398.apcprd06.prod.outlook.com ([fe80::9784:d8bc:5eb5:b60e]) by SEYPR06MB6398.apcprd06.prod.outlook.com ([fe80::9784:d8bc:5eb5:b60e%6]) with mapi id 15.20.7544.052; Tue, 14 May 2024 09:06:01 +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 5/5] dm linear: enable flush optimization function Date: Tue, 14 May 2024 17:04:44 +0800 Message-Id: <20240514090445.2847-6-yang.yang@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240514090445.2847-1-yang.yang@vivo.com> References: <20240514090445.2847-1-yang.yang@vivo.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI1PR02CA0046.apcprd02.prod.outlook.com (2603:1096:4:1f5::14) To SEYPR06MB6398.apcprd06.prod.outlook.com (2603:1096:101:145::9) 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: SEYPR06MB6398:EE_|PUZPR06MB6102:EE_ X-MS-Office365-Filtering-Correlation-Id: 1761c51f-8dcc-4918-ec50-08dc73f513cc 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?s5sUsPhALM/Pkp7ol0V/Q3ICt5QQBGJZBY7iON0WNEl7c4S73/XQNjohiOMd?= =?us-ascii?Q?9mI44PKH2z61GjlxU8M44nAa+5mk/594gw5/wqkGihuXctfQ6Mzcaul8Pk6x?= =?us-ascii?Q?AKRxj/ESjEwJWCKdsHDEw1znnqbx1ccVro2kMJX17Jq8+MBh7LVk83CXerpy?= =?us-ascii?Q?zWrKiOVxscrIeykkMOp1KmXrMqreFaJkoIwh40KBfMCDTakDzDic4LhrhZek?= =?us-ascii?Q?fyDrqGsGzr/i4VPXsDs/E69aY7qan/jzEDjiFDol9BYVY90zPmNVPS3DseZi?= =?us-ascii?Q?a9eP9ev5JMwyMxj9rP4Wv2siMbVU1TUSe1d4G5Tmk+/5sVhl0rDJdgMITvwb?= =?us-ascii?Q?XCN2CHZvJcXUYt4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aHnT7+Bc2W8rjF?= =?us-ascii?Q?1gpwDpM7fiUXDgmhT8yyoIC5s0Gpj+9z+nHuzijOdDbfcZXK/RiLNBbchMEN?= =?us-ascii?Q?DTsXBmvzc9PIxs3aafnKkwnMpmd7uZEzvUZlTC42t9vvjg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEYPR06MB6398.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?Dn/AN0mKnR+6oun4WZDZUyNnTKuaPzMeqWM6FOMwWY1IBV/p9Dy1WGRLnkK4?= =?us-ascii?Q?gfmG35buEk6G14ZUFqyA42JYrIf+6E9BGJlJKjFiur/XWhckGc2TdQPCEOak?= =?us-ascii?Q?CgzIRd39drDYFOtG/htM+enn2tDYCZrJC1OASQ1zBPcaCBiBkLzN/0g1JUs5?= =?us-ascii?Q?9XbRuNXbGnw0cse5U4lDshZj1coSQHaC5ytZEJ3E2AJ70qFs+9uUTuHm/fp+?= =?us-ascii?Q?sgS2XItzEcH3CqPeqGDDmcVlQJEQfjWMjX+6HC/pLdJjasQzlFEi3GmejoQO?= =?us-ascii?Q?q5/gZLIYe9u/BsgmuYylN1jA9938SPGxL3WQUcxNJq5pvO5sjpd3yM8+l1nG?= =?us-ascii?Q?0J9WL1mNI+xJQrVLCWG9j+cJes4cnsLljB9GUYZ9yZJOfTKHmGOtUzPULEiF?= =?us-ascii?Q?ILvxuI7Z6DKVrVAgCI3HkHqhJSYw2UVnkPQQrG34KuUemyTSRAbDCKdJM5r0?= =?us-ascii?Q?yJhDgfUBNQtTrPHKKgKWEkV9MZGNZpv927nxgEEZCxZUkRT3drCopdpI32Gb?= =?us-ascii?Q?vXCQ+aFVLX89Mest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n/jJ6jeMfcfWzGiKjW2M9zHY8/S5X4oLOsQUcaNCjuDgTGHPKtOgaYZkBW?= =?us-ascii?Q?DYtL4KbSpmyJbt8C06kkyf+Vs2LrOj1YVzTb5e/sqy7/ieRJbuE+CwyJ1qLQ?= =?us-ascii?Q?Ss6TjjzEaurZ1aFTxX/RiO+wPYR8ker6ajfqA+7I?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1761c51f-8dcc-4918-ec50-08dc73f513cc X-MS-Exchange-CrossTenant-AuthSource: SEYPR06MB6398.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 May 2024 09:06:01.7972 (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: w94iYCHefNR2n59gjE7vrXXZNA1JuKTJAAul1A71gTW3pATB2OtPz2zjQEMYNmGLj1P01DNfXytuwOXNjonROg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PUZPR06MB6102 __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