Re: [RFC PATCH] kvm: Use huge pages for DAX-backed files

From: Paolo Bonzini
Date: Tue Nov 06 2018 - 05:22:30 EST


On 31/10/2018 22:16, Dan Williams wrote:
>> No, please don't. The kvm_is_reserved_pfn() check is for correctness,
>> the page-size check is for optimization. In theory you could have a
>> ZONE_DEVICE area that is smaller than 2MB and thus does not use huge pages.
> To be clear, I was not suggesting that a ZONE_DEVICE check would be
> sufficient to determine a 2MB page. I was suggesting that given there
> is a debate about removing the "reserved" designation for dax pages
> that debate is moot if kvm is going to add interrogation code to
> figure out the size of dax mappings.

Oh indeed. And in general it's okay for me to add more ZONE_DEVICE
checks to complement the existing PageReserved checks, if DAX pages are
not going to be reserved anymore.

In some cases, such as the "if (!PageReserved(page)) SetPageDirty(page)"
that Barret noted, it may even be more correct for KVM if DAX pages stop
being reserved. All this given my very limited knowledge of MM though...

Paolo