From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEA7AC433E9 for ; Thu, 21 Jan 2021 09:36:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7DDBA23975 for ; Thu, 21 Jan 2021 09:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728757AbhAUJgk (ORCPT ); Thu, 21 Jan 2021 04:36:40 -0500 Received: from mail109.syd.optusnet.com.au ([211.29.132.80]:51558 "EHLO mail109.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728438AbhAUJgh (ORCPT ); Thu, 21 Jan 2021 04:36:37 -0500 Received: from dread.disaster.area (pa49-180-243-77.pa.nsw.optusnet.com.au [49.180.243.77]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id B5D24114066A; Thu, 21 Jan 2021 20:35:49 +1100 (AEDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1l2WNZ-000pA8-1m; Thu, 21 Jan 2021 20:35:49 +1100 Date: Thu, 21 Jan 2021 20:35:49 +1100 From: Dave Chinner To: Christoph Hellwig Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, avi@scylladb.com, Dave Chinner Subject: Re: [PATCH 11/11] xfs: reduce exclusive locking on unaligned dio Message-ID: <20210121093549.GC4662@dread.disaster.area> References: <20210121085906.322712-1-hch@lst.de> <20210121085906.322712-12-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210121085906.322712-12-hch@lst.de> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=Ubgvt5aN c=1 sm=1 tr=0 cx=a_idp_d a=juxvdbeFDU67v5YkIhU0sw==:117 a=juxvdbeFDU67v5YkIhU0sw==:17 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=20KFwNOVAAAA:8 a=in2YdIHcAAAA:8 a=7-415B0cAAAA:8 a=OdnFOmsemsuJ_AWq354A:9 a=CjuIK1q_8ugA:10 a=jvJaD-jWAXz1fu1h5wd8:22 a=biEYGPWJfzWAr4FL6Ov7:22 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Thu, Jan 21, 2021 at 09:59:06AM +0100, Christoph Hellwig wrote: > From: Dave Chinner > > Attempt shared locking for unaligned DIO, but only if the the > underlying extent is already allocated and in written state. On > failure, retry with the existing exclusive locking. > > Test case is fio randrw of 512 byte IOs using AIO and an iodepth of > 32 IOs. > > Vanilla: > > READ: bw=4560KiB/s (4670kB/s), 4560KiB/s-4560KiB/s (4670kB/s-4670kB/s), io=134MiB (140MB), run=30001-30001msec > WRITE: bw=4567KiB/s (4676kB/s), 4567KiB/s-4567KiB/s (4676kB/s-4676kB/s), io=134MiB (140MB), run=30001-30001msec > > Patched: > READ: bw=37.6MiB/s (39.4MB/s), 37.6MiB/s-37.6MiB/s (39.4MB/s-39.4MB/s), io=1127MiB (1182MB), run=30002-30002msec > WRITE: bw=37.6MiB/s (39.4MB/s), 37.6MiB/s-37.6MiB/s (39.4MB/s-39.4MB/s), io=1128MiB (1183MB), run=30002-30002msec > > That's an improvement from ~18k IOPS to a ~150k IOPS, which is > about the IOPS limit of the VM block device setup I'm testing on. > > 4kB block IO comparison: > > READ: bw=296MiB/s (310MB/s), 296MiB/s-296MiB/s (310MB/s-310MB/s), io=8868MiB (9299MB), run=30002-30002msec > WRITE: bw=296MiB/s (310MB/s), 296MiB/s-296MiB/s (310MB/s-310MB/s), io=8878MiB (9309MB), run=30002-30002msec > > Which is ~150k IOPS, same as what the test gets for sub-block > AIO+DIO writes with this patch. > > Signed-off-by: Dave Chinner > [hch: rebased, split unaligned from nowait] > Signed-off-by: Christoph Hellwig Looks good, minor nit: > + /* > + * For overwrite only I/O, we cannot convert unwritten extents without > + * requiring sub-block zeroing. This can only be done under an > + * exclusive IOLOCK, hence return -EAGAIN if this is not a written > + * extent to tell the caller to try again. > + */ > + if (flags & IOMAP_OVERWRITE_ONLY) { > + error = -EAGAIN; > + if (imap.br_state != XFS_EXT_NORM && > + ((offset & mp->m_blockmask) || > + ((offset + length) & mp->m_blockmask))) > + goto out_unlock; Why not use the ((offset | length) & mp->blockmask) form of alignment checking here? Other than that, Reviewed-by: Dave Chinner -- Dave Chinner david@fromorbit.com