Re: NVFS XFS metadata (was: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache)

From: Mikulas Patocka
Date: Wed Sep 23 2020 - 09:11:56 EST




On Wed, 23 Sep 2020, Jan Kara wrote:

> On Tue 22-09-20 12:46:05, Mikulas Patocka wrote:
> > > mapping 2^21 blocks requires a 5 level indirect tree. Which one if going
> > > to be faster to truncate away - a single record or 2 million individual
> > > blocks?
> > >
> > > IOWs, we can take afford to take an extra cacheline miss or two on a
> > > tree block search, because we're accessing and managing orders of
> > > magnitude fewer records in the mapping tree than an indirect block
> > > tree.
> > >
> > > PMEM doesn't change this: extents are more time and space efficient
> > > at scale for mapping trees than indirect block trees regardless
> > > of the storage medium in use.
> >
> > PMEM doesn't have to be read linearly, so the attempts to allocate large
> > linear space are not needed. They won't harm but they won't help either.
> >
> > That's why NVFS has very simple block allocation alrogithm - it uses a
> > per-cpu pointer and tries to allocate by a bit scan from this pointer. If
> > the group is full, it tries a random group with above-average number of
> > free blocks.
>
> I agree with Dave here. People are interested in 2MB or 1GB contiguous
> allocations for DAX so that files can be mapped at PMD or event PUD levels
> thus saving a lot of CPU time on page faults and TLB.

NVFS has upper limit on block size 1MB. So, should raise it to 2MB? Will
2MB blocks be useful to someone?

Is there some API how userspace can ask the kernel for aligned allocation?
fallocate() doesn't seem to offer an option for alignment.

> > EXT4 uses bit scan for allocations and people haven't complained that it's
> > inefficient, so it is probably OK.
>
> Yes, it is more or less OK but once you get to 1TB filesystem size and
> larger, the number of block groups grows enough that it isn't that great
> anymore. We are actually considering new allocation schemes for ext4 for
> this large filesystems...

NVFS can run with block size larger than page size, so you can reduce the
number of block groups by increasing block size.

(ext4 also has bigalloc feature that will do it)

> > If you think that the lack of journaling is show-stopper, I can implement
> > it. But then, I'll have something that has complexity of EXT4 and
> > performance of EXT4. So that there will no longer be any reason why to use
> > NVFS over EXT4. Without journaling, it will be faster than EXT4 and it may
> > attract some users who want good performance and who don't care about GID
> > and UID being updated atomically, etc.
>
> I'd hope that your filesystem offers more performance benefits than just
> what you can get from a lack of journalling :). ext4 can be configured to

I also don't know how to implement journling on persistent memory :) On
EXT4 or XFS you can pin dirty buffers in memory until the journal is
flushed. This is obviously impossible on persistent memory. So, I'm
considering implementing only some lightweight journaling that will
guarantee atomicity between just a few writes.

> run without a journal as well - mkfs.ext4 -O ^has_journal. And yes, it does
> significantly improve performance for some workloads but you have to have
> some way to recover from crashes so it's mostly used for scratch
> filesystems (e.g. in build systems, Google uses this feature a lot for some
> of their infrastructure as well).
>
> Honza
> --
> Jan Kara <jack@xxxxxxxx>
> SUSE Labs, CR

I've run "dir-test /mnt/test/ 8000000 8000000" and the result is:
EXT4 with journal - 5m54,019s
EXT4 without journal - 4m4,444s
NVFS - 2m9,482s

Mikulas