[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LRH.2.02.2101110641490.4356@file01.intranet.prod.int.rdu2.redhat.com>
Date: Mon, 11 Jan 2021 06:44:09 -0500 (EST)
From: Mikulas Patocka <mpatocka@...hat.com>
To: David Laight <David.Laight@...LAB.COM>
cc: "'Al Viro'" <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Dan Williams <dan.j.williams@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Dave Jiang <dave.jiang@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Matthew Wilcox <willy@...radead.org>, Jan Kara <jack@...e.cz>,
Steven Whitehouse <swhiteho@...hat.com>,
Eric Sandeen <esandeen@...hat.com>,
Dave Chinner <dchinner@...hat.com>,
"Theodore Ts'o" <tytso@....edu>,
Wang Jianchao <jianchao.wan9@...il.com>,
"Kani, Toshi" <toshi.kani@....com>,
"Norton, Scott J" <scott.norton@....com>,
"Tadakamadla, Rajesh" <rajesh.tadakamadla@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>
Subject: RE: [RFC v2] nvfs: a filesystem for persistent memory
On Mon, 11 Jan 2021, David Laight wrote:
> From: Al Viro <viro@....linux.org.uk> On Behalf Of Al Viro
> > Sent: 10 January 2021 16:20
> >
> > On Thu, Jan 07, 2021 at 08:15:41AM -0500, Mikulas Patocka wrote:
> > > Hi
> > >
> > > I announce a new version of NVFS - a filesystem for persistent memory.
> > > http://people.redhat.com/~mpatocka/nvfs/
> > Utilities, AFAICS
> >
> > > git://leontynka.twibright.com/nvfs.git
> > Seems to hang on git pull at the moment... Do you have it anywhere else?
> >
> > > I found out that on NVFS, reading a file with the read method has 10%
> > > better performance than the read_iter method. The benchmark just reads the
> > > same 4k page over and over again - and the cost of creating and parsing
> > > the kiocb and iov_iter structures is just that high.
> >
> > Apples and oranges... What happens if you take
> >
> > ssize_t read_iter_locked(struct file *file, struct iov_iter *to, loff_t *ppos)
> > {
> > struct inode *inode = file_inode(file);
> > struct nvfs_memory_inode *nmi = i_to_nmi(inode);
> > struct nvfs_superblock *nvs = inode->i_sb->s_fs_info;
> > ssize_t total = 0;
> > loff_t pos = *ppos;
> > int r;
> > int shift = nvs->log2_page_size;
> > size_t i_size;
> >
> > i_size = inode->i_size;
> > if (pos >= i_size)
> > return 0;
> > iov_iter_truncate(to, i_size - pos);
> >
> > while (iov_iter_count(to)) {
> > void *blk, *ptr;
> > size_t page_mask = (1UL << shift) - 1;
> > unsigned page_offset = pos & page_mask;
> > unsigned prealloc = (iov_iter_count(to) + page_mask) >> shift;
> > unsigned size;
> >
> > blk = nvfs_bmap(nmi, pos >> shift, &prealloc, NULL, NULL, NULL);
> > if (unlikely(IS_ERR(blk))) {
> > r = PTR_ERR(blk);
> > goto ret_r;
> > }
> > size = ((size_t)prealloc << shift) - page_offset;
> > ptr = blk + page_offset;
> > if (unlikely(!blk)) {
> > size = min(size, (unsigned)PAGE_SIZE);
> > ptr = empty_zero_page;
> > }
> > size = copy_to_iter(to, ptr, size);
> > if (unlikely(!size)) {
> > r = -EFAULT;
> > goto ret_r;
> > }
> >
> > pos += size;
> > total += size;
> > } while (iov_iter_count(to));
>
> That isn't the best formed loop!
>
> David
I removed the second "while" statement and fixed the arguments to
copy_to_iter - other than that, Al's function works.
Mikuklas
Powered by blists - more mailing lists