• Sean Christopherson's avatar
    KVM: x86/mmu: Walk host page tables to find THP mappings · db543216
    Sean Christopherson authored
    Explicitly walk the host page tables to identify THP mappings instead
    of relying solely on the metadata in struct page.  This sets the stage
    for using a common method of identifying huge mappings regardless of the
    underlying implementation (HugeTLB vs THB vs DAX), and hopefully avoids
    the pitfalls of relying on metadata to identify THP mappings, e.g. see
    commit 169226f7 ("mm: thp: handle page cache THP correctly in
    PageTransCompoundMap") and the need for KVM to explicitly check for a
    THP compound page.  KVM will also naturally work with 1gb THP pages, if
    they are ever supported.
    
    Walking the tables for THP mappings is likely marginally slower than
    querying metadata, but a future patch will reuse the walk to identify
    HugeTLB mappings, at which point eliminating the existing VMA lookup for
    HugeTLB will make this a net positive.
    
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Barret Rhoden <brho@google.com>
    Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    db543216
mmu.c 170 KB