lkml.org 
[lkml]   [2020]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC V2] mm/vmstat: Add events for HugeTLB migration
Date
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>
>

\
 
 \ /
  Last update: 2020-09-30 12:03    [W:0.093 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site