Re: [PATCH v3 11/18] fuse: implement FUSE_INIT map_alignment field

From: Vivek Goyal
Date: Wed Aug 26 2020 - 15:53:26 EST


On Wed, Aug 26, 2020 at 09:26:29PM +0200, Miklos Szeredi wrote:
> On Wed, Aug 26, 2020 at 9:17 PM Dr. David Alan Gilbert
> <dgilbert@xxxxxxxxxx> wrote:
>
> > Agreed, because there's not much that the server can do about it if the
> > client would like a smaller granularity - the servers granularity might
> > be dictated by it's mmap/pagesize/filesystem. If the client wants a
> > larger granularity that's it's choice when it sends the setupmapping
> > calls.
>
> What bothers me is that the server now comes with the built in 2MiB
> granularity (obviously much larger than actually needed).
>
> What if at some point we'd want to reduce that somewhat in the client?
> Yeah, we can't. Maybe this is not a kernel problem after all, the
> proper thing would be to fix the server to actually send something
> meaningful.

Hi Miklos,

Current implementation of virtiofsd reports this map alignment as
PAGE_SIZE.

/* This constraint comes from mmap(2) and munmap(2) */
outarg.map_alignment = ffsl(sysconf(_SC_PAGE_SIZE)) - 1;

Which should be 4K on x86.

And that means if client wants it can drop to dax mapping size as
small as 4K and still meeting alignment constratints. Just that by
default we have chosen 2MB as of now fearing there might be too
many small mmap() calls on host and we will hit various limits.

Thanks
Vivek