Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757657AbcLOOIb (ORCPT ); Thu, 15 Dec 2016 09:08:31 -0500 Received: from mail-by2nam03on0129.outbound.protection.outlook.com ([104.47.42.129]:45034 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755576AbcLOOIC (ORCPT ); Thu, 15 Dec 2016 09:08:02 -0500 From: Dexuan Cui To: Ming Lei CC: Jens Axboe , "Theodore Ts'o" , "Andreas Dilger" , "linux-block@vger.kernel.org" , "linux-ext4@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Abel Hu , Thomas Shao , Matthew Wilcox , Long Li , KY Srinivasan Subject: RE: Big I/O requests are split into small ones due to unaligned ext4 partition boundary? Thread-Topic: Big I/O requests are split into small ones due to unaligned ext4 partition boundary? Thread-Index: AdJWrOFbDLU/PpLnQsCA15gterVoiwAI+d+AAAJY1eA= Date: Thu, 15 Dec 2016 13:53:52 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [2404:f801:9000:19::259] x-ms-office365-filtering-correlation-id: 2618daf1-8ea7-4d5c-ef4d-08d424f1cdef x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:MWHPR03MB2494; x-microsoft-exchange-diagnostics: 1;MWHPR03MB2494;7:cUZHdYrWdy6O2SVYU/02ihCgxzJMeRGQQ2++VPIuTgxcLUJz8Kz57C+fFRXuWpwDU2vm8cGKh49KPBI0gZ8sCvnMQOZBVzFq673zJneWywir/qhXTbm7k0JpIk6eViUpEdWuqOla5l1S9rQHFm9tONXZVNTBk9/tL2FWOSMYHbnbPwqZ/sbHfxNkN2AVKrOhdalwPtc1hiyLkSHxCk3L7aPBg6TkNS5VdprZTvnSFJcmDUDzCxmQVOGHaVZ3lHj0L5Btx2oRo4jvSU7RV/2i1rTG6NA3BEKV3sThc7Vv+n6xMPHTtYXsvAmU94P0YhfLk+BXbUgIUyjnk0mb9MGwSzqU0oLL9soJ61AiDtNJM6FJVYQCUr/7KZOv2OCcuzi5lhLGJ1dXCY4PpDoCYEhLqX87xE4L9nx5lcCsTZyl8gJS3I21pPoOEDdRkG0ypD6E/N7gh7ba25uv2s5OM2zxgSGzguoKpv8JvbqGJVR5sEg= x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040375)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(61426038)(61427038)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(6042181)(6072148)(6047074);SRVR:MWHPR03MB2494;BCL:0;PCL:0;RULEID:;SRVR:MWHPR03MB2494; x-forefront-prvs: 0157DEB61B x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(209900001)(199003)(189002)(377454003)(24454002)(45984002)(10090500001)(106356001)(86362001)(5005710100001)(99286002)(10290500002)(33656002)(3280700002)(15395725005)(8990500004)(5660300001)(3660700001)(110136003)(2950100002)(97736004)(101416001)(105586002)(6916009)(189998001)(86612001)(7696004)(107886002)(2900100001)(76576001)(2906002)(6506006)(8936002)(74316002)(4001430100002)(6436002)(54356999)(4326007)(50986999)(122556002)(9686002)(39060400001)(76176999)(92566002)(38730400001)(77096006)(81156014)(7736002)(6116002)(102836003)(81166006)(8676002)(305945005)(229853002)(25786008)(68736007)(6606295002);DIR:OUT;SFP:1102;SCL:1;SRVR:MWHPR03MB2494;H:MWHPR03MB2669.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2016 13:53:52.3451 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2494 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id uBFE8gUZ026039 Content-Length: 2042 Lines: 48 > From: Ming Lei [mailto:tom.leiming@gmail.com] > Sent: Thursday, December 15, 2016 20:43 > > On Thu, Dec 15, 2016 at 7:47 PM, Dexuan Cui wrote: > > Hi, when I run "mkfs.ext4 /dev/sdc2" in a Linux virtual machine on Hyper-V, > > where a disk IOPS=500 limit is applied by me [0], the command takes much > > more time, if the ext4 partition boundary is not properly aligned: > > > > Example 1 [1]: it takes ~7 minutes with average wMB/s = 0.3 (slow) > > Example 2 [2]: it takes ~3.5 minutes with average wMB/s = 0.6 (slow) > > Example 3 [3]: it takes ~0.5 minute with average wMB/s = 4 (expected) > > > > strace shows the mkfs.ext3 program calls seek()/write() a lot and most of > > the writes use 32KB buffers (this should be big enough), and the program > > only invokes fsync() once, after it issues all the writes -- the fsync() takes > >>99% of the time. > > > > By logging SCSI commands, the SCSI Write(10) command is used here for the > > userspace 32KB write: > > in example 1, *each* command writes 1 or 2 sectors only (1 sector = 512 > bytes); > > in example 2, *each* command writes 2 or 4 sectors only; > > in example 3, each command writes 1024 sectors. > > > > It looks the kernel block I/O layer can somehow split big user-space buffers > > into really small write requests (1, 2, and 4 sectors)? > > This looks really strange to me. > > > > Note: in my test, this strange issue happens to 4.4 and the mainline 4.9 kernels, > > but the stable 3.18.45 kernel doesn't have the issue, i.e. all the 3 above test > > examples can finish in ~0.5 minute. > > > > Any comment? > > I remember that we discussed this kind of issue, please see the discussion[1] > and check if the patch[2] can fix your issue. > > [1] http://marc.info/?t=145805525500002&r=1&w=2 > [2] http://marc.info/?l=linux-kernel&m=145934325429152&w=2 > > Ming Thank you very much, Ming! The patch can fix my issue! It looks your patch was not merged into the upstream somehow. Would you please submit the patch again? Thanks, -- Dexuan