Re: [PATCH] x86 get_unmapped_area: Add PMD alignment for DAX PMD mmap
From: Toshi Kani
Date: Thu Apr 07 2016 - 17:29:05 EST
On Thu, 2016-04-07 at 13:41 -0400, Matthew Wilcox wrote:
> On Wed, Apr 06, 2016 at 11:44:32AM -0600, Toshi Kani wrote:
> > >
> > > The NVML chooses appropriate addresses and gets a properly aligned
> > > address without any kernel code.
> >
> > An application like NVML can continue to specify a specific address to
> > mmap(). ÂMost existing applications, however, do not specify an address
> > to mmap(). ÂWith this patch, specifying an address will remain
> > optional.
>
> The point is that this *can* be done in userspace.ÂÂYou need to sell us
> on the advantages of doing it in the kernel.
Sure. ÂAs I said, the point is that we do not need to modify existing
applications for using DAX PMD mappings.
For instance, fio with "ioengine=mmap" performs I/Os with mmap().
https://github.com/caius/fio/blob/master/engines/mmap.c
With this change, unmodified fio can be used for testing with DAX PMD
mappings. ÂThere are many examples like this, and I do not think we want to
modify all applications that we want to evaluate/test with.
> > > I think this is the wrong place for it, if we decide that this is the
> > > right thing to do.ÂÂThe filesystem has a get_unmapped_area() which
> > > should be used instead.
> >
> > Yes, I considered adding a filesystem entry point, but decided going
> > this way because:
> > Â-Âarch_get_unmapped_area() andÂarch_get_unmapped_area_topdown() are
> > arch-specific code. ÂTherefore, this filesystem entry point will need
> > arch-specific implementation.Â
> > Â- There is nothing filesystem specific about requesting PMD alignment.
>
> See http://article.gmane.org/gmane.linux.kernel.mm/149227 for Hugh's
> approach for shmem.ÂÂI strongly believe that if we're going to do this
> i the kernel, we should build on this approach, and not hack something
> into each architecture's generic get_unmapped_area.
Thanks for the pointer. ÂYes, we can call current->mm->get_unmapped_area()
with size + PMD_SIZE, and adjust with the alignment in a filesystem entry
point. ÂI will update the patch with this approach.
-Toshi