KVM: Remove kvm_is_transparent_hugepage() and PageTransCompoundMap()
authorMarc Zyngier <maz@kernel.org>
Mon, 26 Jul 2021 15:35:50 +0000 (16:35 +0100)
committerMarc Zyngier <maz@kernel.org>
Mon, 2 Aug 2021 13:05:58 +0000 (14:05 +0100)
Now that arm64 has stopped using kvm_is_transparent_hugepage(),
we can remove it, as well as PageTransCompoundMap() which was
only used by the former.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210726153552.1535838-5-maz@kernel.org
include/linux/page-flags.h
virt/kvm/kvm_main.c

index 5922031ffab6e533e34ab81a72b1920a6849bee2..1ace27c4a8e0fbe66f95c5d922a5de0057827bb7 100644 (file)
@@ -632,43 +632,6 @@ static inline int PageTransCompound(struct page *page)
        return PageCompound(page);
 }
 
-/*
- * PageTransCompoundMap is the same as PageTransCompound, but it also
- * guarantees the primary MMU has the entire compound page mapped
- * through pmd_trans_huge, which in turn guarantees the secondary MMUs
- * can also map the entire compound page. This allows the secondary
- * MMUs to call get_user_pages() only once for each compound page and
- * to immediately map the entire compound page with a single secondary
- * MMU fault. If there will be a pmd split later, the secondary MMUs
- * will get an update through the MMU notifier invalidation through
- * split_huge_pmd().
- *
- * Unlike PageTransCompound, this is safe to be called only while
- * split_huge_pmd() cannot run from under us, like if protected by the
- * MMU notifier, otherwise it may result in page->_mapcount check false
- * positives.
- *
- * We have to treat page cache THP differently since every subpage of it
- * would get _mapcount inc'ed once it is PMD mapped.  But, it may be PTE
- * mapped in the current process so comparing subpage's _mapcount to
- * compound_mapcount to filter out PTE mapped case.
- */
-static inline int PageTransCompoundMap(struct page *page)
-{
-       struct page *head;
-
-       if (!PageTransCompound(page))
-               return 0;
-
-       if (PageAnon(page))
-               return atomic_read(&page->_mapcount) < 0;
-
-       head = compound_head(page);
-       /* File THP is PMD mapped and not PTE mapped */
-       return atomic_read(&page->_mapcount) ==
-              atomic_read(compound_mapcount_ptr(head));
-}
-
 /*
  * PageTransTail returns true for both transparent huge pages
  * and hugetlbfs pages, so it should only be called when it's known
index d20fba0fc290333865c5e65f700a466bf24b0439..7b72a2b35a7ef043563d28e362d10146b6e1f774 100644 (file)
@@ -189,16 +189,6 @@ bool kvm_is_reserved_pfn(kvm_pfn_t pfn)
        return true;
 }
 
-bool kvm_is_transparent_hugepage(kvm_pfn_t pfn)
-{
-       struct page *page = pfn_to_page(pfn);
-
-       if (!PageTransCompoundMap(page))
-               return false;
-
-       return is_transparent_hugepage(compound_head(page));
-}
-
 /*
  * Switches to specified vcpu, until a matching vcpu_put()
  */