linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 5/7] mm: Replace hpage_nr_pages with thp_nr_pages
Date: Mon, 29 Jun 2020 10:40:12 -0700	[thread overview]
Message-ID: <8bf5ae79-eace-5345-1a77-69d9e2e083b3@oracle.com> (raw)
In-Reply-To: <20200629151959.15779-6-willy@infradead.org>

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@infradead.org>
...
> 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


  reply	other threads:[~2020-06-29 17:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 15:19 [PATCH 0/7] THP prep patches Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 1/7] mm: Store compound_nr as well as compound_order Matthew Wilcox (Oracle)
2020-06-29 16:22   ` Ira Weiny
2020-06-29 16:24     ` Matthew Wilcox
2020-07-06 10:29   ` Kirill A. Shutemov
2020-08-11 22:53     ` Matthew Wilcox
2020-06-29 15:19 ` [PATCH 2/7] mm: Move page-flags include to top of file Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 3/7] mm: Add thp_order Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 4/7] mm: Add thp_size Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 5/7] mm: Replace hpage_nr_pages with thp_nr_pages Matthew Wilcox (Oracle)
2020-06-29 17:40   ` Mike Kravetz [this message]
2020-06-29 18:14     ` Matthew Wilcox
2020-06-29 18:32       ` Matthew Wilcox
2020-07-01  1:33         ` Andrew Morton
2020-06-29 15:19 ` [PATCH 6/7] mm: Add thp_head Matthew Wilcox (Oracle)
2020-06-29 15:19 ` [PATCH 7/7] mm: Introduce offset_in_thp Matthew Wilcox (Oracle)
2020-06-29 17:11 ` [PATCH 0/7] THP prep patches William Kucharski
2020-06-29 18:13 ` Zi Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8bf5ae79-eace-5345-1a77-69d9e2e083b3@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox