Re: [PATCH 11/15] mm: Remove hpage_nr_pages

Matthew Wilcox
2019-10-04T19:36:32Z

On Thu, Oct 03, 2019 at 01:08:59PM +0800, Hillf Danton wrote:
>
> On Tue, 24 Sep 2019 17:52:02 -0700 From: Matthew Wilcox (Oracle)
> >
> > @@ -354,7 +354,7 @@ vma_address(struct page *page, struct vm_area_struct *vma)
> > unsigned long start, end;
> >
> > start = __vma_address(page, vma);
> > - end = start + PAGE_SIZE * (hpage_nr_pages(page) - 1);
> > + end = start + page_size(page) - 1;
> >
> > @@ -57,7 +57,7 @@ static inline bool pfn_in_hpage(struct page *hpage, unsigned long pfn)
> > unsigned long hpage_pfn = page_to_pfn(hpage);
> >
> > /* THP can be referenced by any subpage */
> > - return pfn >= hpage_pfn && pfn - hpage_pfn < hpage_nr_pages(hpage);
> > + return (pfn - hpage_pfn) < compound_nr(hpage);
> > }
> >
> > @@ -264,7 +264,7 @@ int page_mapped_in_vma(struct page *page, struct vm_area_struct *vma)
> > unsigned long start, end;
> >
> > start = __vma_address(page, vma);
> > - end = start + PAGE_SIZE * (hpage_nr_pages(page) - 1);
> > + end = start + page_size(page) - 1;
> >
> > if (unlikely(end < vma->vm_start || start >= vma->vm_end))
>
> Be certain that nothing is added other than mechanical replacings in
> the above hunks.

Are you saying I've made a mistake? If so, please be clear.