Re: [PATCH v4] mm/page_vma_mapped.c: Explicitly compare pfn for normal, hugetlbfs and THP page

Andrew Morton
2020-01-13T22:38:23Z

On Sat, 11 Jan 2020 10:18:05 +0000 Li Xinhai <lixinhai.lxh@gmail.com> wrote:

> When check_pte, pfn of normal, hugetlbfs and THP page need be compared.
> The current implementation apply comparison as
> - normal 4K page: page_pfn <= pfn < page_pfn + 1
> - hugetlbfs page: page_pfn <= pfn < page_pfn + HPAGE_PMD_NR
> - THP page: page_pfn <= pfn < page_pfn + HPAGE_PMD_NR
> in pfn_in_hpage. For hugetlbfs page, it should be
> page_pfn == pfn

Does this have any runtime effects?

> Now, change pfn_in_hpage to pfn_is_match to highlight that comparison
> is not only for THP and explicitly compare for these cases.