Re: Expense of read_iter

2021-01-21 Thread Matthew Wilcox
On Wed, Jan 20, 2021 at 10:12:01AM -0500, Mikulas Patocka wrote: > Do you have some idea how to optimize the generic code that calls > ->read_iter? Yes. > It might be better to maintain an f_iocb_flags in the > struct file and just copy that unconditionally. We'd need to remember > to update

Re: Expense of read_iter

2021-01-21 Thread Zhongwei Cai
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

Re: Expense of read_iter

2021-01-21 Thread Mikulas Patocka
On Thu, 21 Jan 2021, Matthew Wilcox wrote: > On Wed, Jan 20, 2021 at 10:12:01AM -0500, Mikulas Patocka wrote: > > Do you have some idea how to optimize the generic code that calls > > ->read_iter? > > Yes. > > > It might be better to maintain an f_iocb_flags in the > > struct file and just

RE: Expense of read_iter

2021-01-20 Thread David Laight
From: Mikulas Patocka > Sent: 20 January 2021 15:12 > > On Wed, 20 Jan 2021, Jan Kara wrote: > > > 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

Re: Expense of read_iter

2021-01-20 Thread Mikulas Patocka
On Wed, 20 Jan 2021, Jan Kara wrote: > 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

Re: Expense of read_iter

2021-01-20 Thread Jan Kara
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

Re: Expense of read_iter

2021-01-19 Thread Dave Chinner
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

Re: Expense of read_iter

2021-01-15 Thread Zhongwei Cai
On Thu, 14 Jan 2021, Mikulas wrote: >> I'm working with Mingkai on optimizations for Ext4-dax. > > What specific patch are you working on? Please, post it somewhere. Here is the work-in-progress patch: https://ipads.se.sjtu.edu.cn:1312/opensource/linux/-/tree/ext4-read It only contains the

Re: Expense of read_iter

2021-01-13 Thread Mikulas Patocka
On Tue, 12 Jan 2021, Zhongwei Cai wrote: > > I'm working with Mingkai on optimizations for Ext4-dax. What specific patch are you working on? Please, post it somewhere. > We think that optmizing the read-iter method cannot achieve the > same performance as the read method for Ext4-dax. > We

RE: Expense of read_iter

2021-01-12 Thread David Laight
From: Zhongwei Cai > Sent: 12 January 2021 13:45 .. > The overhead mainly consists of two parts. The first is constructing > struct iov_iter and iterating it (i.e., new_sync, _copy_mc_to_iter and > iov_iter_init). The second is the dax io mechanism provided by VFS (i.e., > dax_iomap_rw,

Re: Expense of read_iter

2021-01-12 Thread Zhongwei Cai
I'm working with Mingkai on optimizations for Ext4-dax. We think that optmizing the read-iter method cannot achieve the same performance as the read method for Ext4-dax. We tried Mikulas's benchmark on Ext4-dax. The overall time and perf results are listed below: Overall time of 2^26 4KB read.

Re: Expense of read_iter

2021-01-11 Thread Mikulas Patocka
On Mon, 11 Jan 2021, Matthew Wilcox wrote: > On Sun, Jan 10, 2021 at 04:19:15PM -0500, Mikulas Patocka wrote: > > I put counters into vfs_read and vfs_readv. > > > > After a fresh boot of the virtual machine, the counters show "13385 4". > > After a kernel compilation they show "4475220 8".

RE: Expense of read_iter

2021-01-11 Thread David Laight
From: Matthew Wilcox > Sent: 10 January 2021 06:13 ... > nvfs_rw_iter_locked() looks very complicated. I suspect it can > be simplified. Of course new_sync_read() needs to be improved too, > as do the other functions here, but fully a third of the difference > between read() and read_iter() is

Re: Expense of read_iter

2021-01-10 Thread Matthew Wilcox
On Sun, Jan 10, 2021 at 04:19:15PM -0500, Mikulas Patocka wrote: > I put counters into vfs_read and vfs_readv. > > After a fresh boot of the virtual machine, the counters show "13385 4". > After a kernel compilation they show "4475220 8". > > So, the readv path is almost unused. > > My

Re: Expense of read_iter

2021-01-10 Thread Mikulas Patocka
On Sun, 10 Jan 2021, Matthew Wilcox wrote: > > That is the reason for that 10% degradation with read_iter. > > You seem to be focusing on your argument for "let's just permit > filesystems to implement both ->read and ->read_iter". My suggestion > is that we need to optimise the ->read_iter

Re: Expense of read_iter

2021-01-09 Thread Matthew Wilcox
On Thu, Jan 07, 2021 at 01:59:01PM -0500, Mikulas Patocka wrote: > On Thu, 7 Jan 2021, Matthew Wilcox wrote: > > On Thu, Jan 07, 2021 at 08:15:41AM -0500, Mikulas Patocka wrote: > > > I'd like to ask about this piece of code in __kernel_read: > > > if (unlikely(!file->f_op->read_iter ||

Expense of read_iter

2021-01-08 Thread Matthew Wilcox
On Thu, Jan 07, 2021 at 08:15:41AM -0500, Mikulas Patocka wrote: > I'd like to ask about this piece of code in __kernel_read: > if (unlikely(!file->f_op->read_iter || file->f_op->read)) > return warn_unsupported... > and __kernel_write: > if

Re: Expense of read_iter

2021-01-07 Thread Mikulas Patocka
On Thu, 7 Jan 2021, Matthew Wilcox wrote: > On Thu, Jan 07, 2021 at 08:15:41AM -0500, Mikulas Patocka wrote: > > I'd like to ask about this piece of code in __kernel_read: > > if (unlikely(!file->f_op->read_iter || file->f_op->read)) > > return warn_unsupported... > > and

Re: Expense of read_iter

2021-01-07 Thread Mingkai Dong
Hi Matthew, We have also discovered the expense of `->read_iter` in our study on Ext4-DAX. In single-thread 4K-reads, the `->read` version could outperform `->read_iter` by 41.6% in terms of throughput. According to our observation and evaluation, at least for Ext4-DAX, the cost also c