lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 4 Oct 2021 11:27:36 -0700
From:   Mike Kravetz <mike.kravetz@...cle.com>
To:     Oscar Salvador <osalvador@...e.de>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        David Hildenbrand <david@...hat.com>,
        Michal Hocko <mhocko@...e.com>, Zi Yan <ziy@...dia.com>,
        Muchun Song <songmuchun@...edance.com>,
        Naoya Horiguchi <naoya.horiguchi@...ux.dev>,
        David Rientjes <rientjes@...gle.com>,
        "Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v3 1/5] hugetlb: add demote hugetlb page sysfs interfaces

On 10/4/21 6:00 AM, Oscar Salvador wrote:
> On Fri, Oct 01, 2021 at 10:52:06AM -0700, Mike Kravetz wrote:
>> -which function as described above for the default huge page-sized case.
>> +The demote interfaces provide the ability to split a huge page into
>> +smaller huge pages.  For example, the x86 architecture supports both
>> +1GB and 2MB huge pages sizes.  A 1GB huge page can be split into 512
>> +2MB huge pages.  Demote interfaces are not available for the smallest
>> +huge page size.  The demote interfaces are:
>> +
>> +demote_size
>> +        is the size of demoted pages.  When a page is demoted a corresponding
>> +        number of huge pages of demote_size will be created.  By default,
>> +        demote_size is set to the next smaller huge page size.  If there are
>> +        multiple smaller huge page sizes, demote_size can be set to any of
>> +        these smaller sizes.  Only huge page sizes less then the current huge
> 
> s/then/than ?
> 

Thanks

>>  static void __init hugetlb_init_hstates(void)
>>  {
>> -	struct hstate *h;
>> +	struct hstate *h, *h2;
>>  
>>  	for_each_hstate(h) {
>>  		if (minimum_order > huge_page_order(h))
>> @@ -2995,6 +2995,23 @@ static void __init hugetlb_init_hstates(void)
>>  		/* oversize hugepages were init'ed in early boot */
>>  		if (!hstate_is_gigantic(h))
>>  			hugetlb_hstate_alloc_pages(h);
>> +
>> +		/*
>> +		 * Set demote order for each hstate.  Note that
>> +		 * h->demote_order is initially 0.
>> +		 * - We can not demote gigantic pages if runtime freeing
>> +		 *   is not supported.
>> +		 */
>> +		if (!hstate_is_gigantic(h) ||
>> +		    gigantic_page_runtime_supported()) {
> 
> Based on the comment, I think that making the condition explicit looks
> better from my point of view.
> 
> if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported())
>     continue;
> 

Agreed.  In addition, this code will look better when more conditions
are added in subsequent patches.

-- 
Mike Kravetz

>> +			for_each_hstate(h2) {
>> +				if (h2 == h)
>> +					continue;
>> +				if (h2->order < h->order &&
>> +				    h2->order > h->demote_order)
>> +					h->demote_order = h2->order;
>> +			}
>> +		}
>>  	}
>>  	VM_BUG_ON(minimum_order == UINT_MAX);
>>  }
>> @@ -3235,9 +3252,29 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid,
>>  	return 0;
>>  }
>>  

Powered by blists - more mailing lists