Re: [PATCH 5/7] mm: Replace hpage_nr_pages with thp_nr_pages

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

 



On 6/29/20 8:19 AM, Matthew Wilcox (Oracle) wrote:
> The thp prefix is more frequently used than hpage and we should
> be consistent between the various functions.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
...
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 57ece74e3aae..6bb07bc655f7 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1593,7 +1593,7 @@ static struct address_space *_get_hugetlb_page_mapping(struct page *hpage)
>  
>  	/* Use first found vma */
>  	pgoff_start = page_to_pgoff(hpage);
> -	pgoff_end = pgoff_start + hpage_nr_pages(hpage) - 1;
> +	pgoff_end = pgoff_start + thp_nr_pages(hpage) - 1;
>  	anon_vma_interval_tree_foreach(avc, &anon_vma->rb_root,
>  					pgoff_start, pgoff_end) {
>  		struct vm_area_struct *vma = avc->vma;

Naming consistency is a good idea!

I was wondering why hugetlb code would be calling a 'thp related' routine.
The reason is that hpage_nr_pages was incorrectly added (by me) to get the
number of pages in a hugetlb page.  If the name of the routine was thp_nr_pages
as proposed, I would not have made this mistake.

I will provide a patch to change the above hpage_nr_pages call to
pages_per_huge_page(page_hstate()).
-- 
Mike Kravetz



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux