On Tue, Jul 11, 2017 at 9:44 AM, Dan Williams <dan.j.williams(a)intel.com> wrote:
On Tue, Jun 27, 2017 at 2:56 AM, Oliver O'Halloran
> Currently libnvdimm uses HPAGE_SIZE as the default alignment for DAX and
> PFN devices. HPAGE_SIZE is the default hugetlbfs page size and when
> hugetlbfs is disabled it defaults to PAGE_SIZE. Given DAX has more
> in common with THP than hugetlbfs we should proably be using
> HPAGE_PMD_SIZE, but this is undefined when THP is disabled so lets just
> give it a new name.
> The other usage of HPAGE_SIZE in libnvdimm is when determining how large
> the altmap should be. For the reasons mentioned above it doesn't really
> make sense to use HPAGE_SIZE here either. PMD_SIZE seems to be safe to
> use in generic code and it happens to match the vmemmap allocation block
> on x86 and Power. It's still a hack, but it's a slightly nicer hack.
Looks ok, but I seem to remember some 0day kbuild robot reports the
last time I tried to use PMD_SIZE. I'll give this a spin in my tree
and see if that's the still the case or I'm mis-remembering.
If PMD_SIZE is causing issues we should probably look at fixing the
arch that provides it rather than trying to work around it. The kernel
expects a three level page table structure to be provided by the arch
even if the HW doesn't provide one so it *should* be well defined
That said, pfn_devs.c is only built when ZONE_DEVICE is enabled. So in
practice we only really need to make sure it works on x86 and power.
If another arch wants to support it then the onus is on them to make
sure PMD_SIZE exists.