Re: [PATCH] mm: introduce __linear_page_index()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 05-02-13 13:27:41, Andrew Morton wrote:
[...]
> > +static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
> > +					unsigned long address)
> > +{
> >  	if (unlikely(is_vm_hugetlb_page(vma)))
> >  		return linear_hugepage_index(vma, address);
> > -	pgoff = (address - vma->vm_start) >> PAGE_SHIFT;
> > -	pgoff += vma->vm_pgoff;
> > -	return pgoff >> (PAGE_CACHE_SHIFT - PAGE_SHIFT);
> > +	return __linear_page_index(vma, address) >>
> > +				(PAGE_CACHE_SHIFT - PAGE_SHIFT);
> >  }
> 
> I don't think we need bother creating both linear_page_index() and
> __linear_page_index().  Realistically, we won't be supporting
> PAGE_SHIFT!=PAGE_CACHE_SHIFT.  And most (or all?) of the sites which
> you changed should have been using PAGE_CACHE_SHIFT anyway!

Except for hugetlb (huge_pmd_share, unmap_ref_private) which uses
PAGE_SHIFT to get an index into mapping. History proves there was
some confusion about those in the past (36e4f20a fixing 0c176d52). So
__linear_page_index makes some sense here.

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]