Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp349792pxb; Thu, 21 Jan 2021 08:32:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJyV56OGW86F+VwdifW9d2X4dWOnGLb2sP76zesKFfkCyxQrrKJ2SWQNr2VbDwDu4rIreK3p X-Received: by 2002:a05:6402:1f4:: with SMTP id i20mr11505625edy.180.1611246774583; Thu, 21 Jan 2021 08:32:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611246774; cv=none; d=google.com; s=arc-20160816; b=TFg7QXBR0nGFQLytuY5+BiHViq+I453UD8m14xMj+P0P3ZdaG3xAE3l/BitpbWj4Fc vgZIdACPmOkYHP167Sm95D2uPkcs6bO3vxafwlJvLDRJR19nYhQB13CGG/3mqWJZEPc/ v2ztGzjef1Q8oCHWO7DGFP9oSWubyNKpsz1hnV2cwx5Yzs7hSYD0SKSpvvIgoBkRSFd5 6E40YeGhZtVxwUNu/rfeGDlBGkhAKdwHf4wd5kFGv0rn5dmR5TnytTNGUVBddm/Byom7 NzBQfdG0IQcP49Wox8A+wWH3MrcONehCbNnr4LhqyIzkxqx3yOycGPU0G1khVxa1vYyc cU3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=Lh5Y2xyjiW6edNXPF9JJxt3g3YTWv5xTMnXAJZgi+fE=; b=C/8YPpBL6aoOk3ADtzMat1DSEG88Id8Db5yYIDQcFRrrEOy0NoGDJYoIq1jvk+JjPM mFilTrYaqX650F+9grKWndbNtZQXiiHIOz+2GLEfYs+LildDQqDo5+6KNS7L3ypf56TY D/zBQzjBYDhvZkngvv84Stw60v3OaewwO0oNpAAfom4noCnIoYbf00hfCfy28X+tHonZ +G3V9EG3CEQ9PccYIMehJvnrcZmeUccIaOCcat4/g3FTP9RSVVHi6i6a9OWDzYZltmsu 4tLvVVB8j5rBROtfvI1S3SHkX+8YrWBhu/B91bmKe3Fdx8WSOtQjjki5gNwQej0g4AJH GAPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si584704edu.106.2021.01.21.08.32.30; Thu, 21 Jan 2021 08:32:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387623AbhAUQbG (ORCPT + 99 others); Thu, 21 Jan 2021 11:31:06 -0500 Received: from smtp180.sjtu.edu.cn ([202.120.2.180]:53972 "EHLO smtp180.sjtu.edu.cn" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730948AbhAUQau (ORCPT ); Thu, 21 Jan 2021 11:30:50 -0500 Received: from mta04.sjtu.edu.cn (mta04.sjtu.edu.cn [202.121.179.8]) by smtp180.sjtu.edu.cn (Postfix) with ESMTPS id 8BE881008CBFA; Fri, 22 Jan 2021 00:30:04 +0800 (CST) Received: from localhost (localhost [127.0.0.1]) by mta04.sjtu.edu.cn (Postfix) with ESMTP id 69AC9180695CD; Fri, 22 Jan 2021 00:30:04 +0800 (CST) X-Virus-Scanned: amavisd-new at mta04.sjtu.edu.cn Received: from mta04.sjtu.edu.cn ([127.0.0.1]) by localhost (mta04.sjtu.edu.cn [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id qhxFy0bwXTQo; Fri, 22 Jan 2021 00:30:04 +0800 (CST) Received: from mstore107.sjtu.edu.cn (unknown [10.118.0.107]) by mta04.sjtu.edu.cn (Postfix) with ESMTP id 21E19180695CC; Fri, 22 Jan 2021 00:30:04 +0800 (CST) Date: Fri, 22 Jan 2021 00:30:00 +0800 (CST) From: Zhongwei Cai To: Jan Kara , Dave Chinner Cc: Mikulas Patocka , Theodore Ts'o , Matthew Wilcox , David Laight , Mingkai Dong , Andrew Morton , Steven Whitehouse , Eric Sandeen , Dave Chinner , Wang Jianchao , Rajesh Tadakamadla , linux-kernel , linux-fsdevel , linux-nvdimm Message-ID: <323586311.2762348.1611246600848.JavaMail.zimbra@sjtu.edu.cn> In-Reply-To: <20210120141834.GA24063@quack2.suse.cz> References: <20210107151125.GB5270@casper.infradead.org> <17045315-CC1F-4165-B8E3-BA55DD16D46B@gmail.com> <2041983017.5681521.1610459100858.JavaMail.zimbra@sjtu.edu.cn> <1224425872.715547.1610703643424.JavaMail.zimbra@sjtu.edu.cn> <20210120044700.GA4626@dread.disaster.area> <20210120141834.GA24063@quack2.suse.cz> Subject: Re: Expense of read_iter MIME-Version: 1.0 Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit X-Originating-IP: [58.196.139.16] X-Mailer: Zimbra 8.8.15_GA_3980 (ZimbraWebClient - FF84 (Win)/8.8.15_GA_3928) Thread-Topic: Expense of read_iter Thread-Index: iDlr565GHhmBWjkzqz9bX3XXoj59EA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 Jan 2021, Jan Kara wrote: > On Wed 20-01-21 15:47:00, Dave Chinner wrote: > > On Fri, Jan 15, 2021 at 05:40:43PM +0800, Zhongwei Cai wrote: > > > On Thu, 14 Jan 2021, Mikulas wrote: > > > For Ext4-dax, the overhead of dax_iomap_rw is significant > > > compared to the overhead of struct iov_iter. Although methods > > > proposed by Mikulas can eliminate the overhead of iov_iter > > > well, they can not be applied in Ext4-dax unless we implement an > > > internal "read" method in Ext4-dax. > > > >> > For Ext4-dax, there could be two approaches to optimizing: > > > 1) implementing the internal "read" method without the complexity > > > of iterators and dax_iomap_rw; > > > > Please do not go an re-invent the wheel just for ext4. If there's a > > problem in a shared path - ext2, FUSE and XFS all use dax_iomap_rw() > > as well, so any improvements to that path benefit all DAX users, not > > just ext4. > > > > > 2) optimizing how dax_iomap_rw works. > > > Since dax_iomap_rw requires ext4_iomap_begin, which further involves > > > the iomap structure and others (e.g., journaling status locks in Ext4), > > > we think implementing the internal "read" method would be easier. > > > > Maybe it is, but it's also very selfish. The DAX iomap path was > > written to be correct for all users, not inecessarily provide > > optimal performance. There will be lots of things that could be done > > to optimise it, so rather than creating a special snowflake in ext4 > > that makes DAX in ext4 much harder to maintain for non-ext4 DAX > > developers, please work to improve the common DAX IO path and so > > provide the same benefit to all the filesystems that use it. > > Yeah, I agree. I'm against ext4 private solution for this read problem. And > I'm also against duplicating ->read_iter functionatily in ->read handler. > The maintenance burden of this code duplication is IMHO just too big. We > rather need to improve the generic code so that the fast path is faster. > And every filesystem will benefit because this is not ext4 specific > problem. > > Honza We agree that maintenance burden could be a problem here. So we will take your suggestions and try to optimize on the generic path. But as Mikulas said ( https://lkml.org/lkml/2021/1/20/618 ), it seems that some parts of the overhead are hard to avoid, such as new_sync_read, and we are concerned that optimizing on the generic path will have limited effect. Nevertheless, we will try to optimize the generic path and see how much we can improve. Zhongwei