linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: Oscar Salvador <osalvador@suse.de>
Cc: linux-mm@kvack.org, Daniel Jordan <daniel.m.jordan@oracle.com>,
	Zi Yan <ziy@nvidia.com>, John Hubbard <jhubbard@nvidia.com>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC V2] mm/vmstat: Add events for HugeTLB migration
Date: Wed, 30 Sep 2020 15:32:10 +0530	[thread overview]
Message-ID: <5f8a390c-8280-9b04-bf4a-3454d5984bf1@arm.com> (raw)
In-Reply-To: <20200930074639.GA26786@linux>

On 09/30/2020 01:16 PM, Oscar Salvador wrote:
> On Wed, Sep 30, 2020 at 11:30:49AM +0530, Anshuman Khandual wrote:
>> -			is_thp = PageTransHuge(page) && !PageHuge(page);
>> -			nr_subpages = thp_nr_pages(page);
>> +			is_thp = false;
>> +			is_hugetlb = false;
>> +			if (PageTransHuge(page)) {
>> +				if (PageHuge(page))
>> +					is_hugetlb = true;
>> +				else
>> +					is_thp = true;
>> +			}
> 
> Since PageHuge only returns true for hugetlb pages, I think the following is
> more simple?
> 
> 	if (PageHuge(page))
> 		is_hugetlb = true;
> 	else if (PageTransHuge(page))
> 		is_thp = true

Right, it would be simple. But as Mike had mentioned before PageHuge()
check is more expensive than PageTransHuge(). This proposal just tries
not to call PageHuge() unless the page first clears PageTransHuge(),
saving some potential CPU cycles on normal pages.

> 
> 
> Besides that, it looks good to me:
> 
> Reviewed-by: Oscar Salvador <osalvador@suse.de>
> 


  reply	other threads:[~2020-09-30 10:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30  6:00 [RFC V2] mm/vmstat: Add events for HugeTLB migration Anshuman Khandual
2020-09-30  7:46 ` Oscar Salvador
2020-09-30 10:02   ` Anshuman Khandual [this message]
2020-09-30 10:33     ` Oscar Salvador
2020-10-01 22:16 ` Mike Kravetz
2020-10-02 12:04 ` Michal Hocko
2020-10-05  2:29   ` Anshuman Khandual
2020-10-05  6:05     ` Michal Hocko
2020-10-06  2:56       ` Anshuman Khandual
2020-10-06  7:54         ` Michal Hocko

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=5f8a390c-8280-9b04-bf4a-3454d5984bf1@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.m.jordan@oracle.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=osalvador@suse.de \
    --cc=ziy@nvidia.com \
    /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;
as well as URLs for NNTP newsgroup(s).