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  linux-cve-announce  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:   Wed, 7 Dec 2022 17:42:23 -0800
From:   Sidhartha Kumar <sidhartha.kumar@...cle.com>
To:     John Hubbard <jhubbard@...dia.com>, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org
Cc:     akpm@...ux-foundation.org, songmuchun@...edance.com,
        mike.kravetz@...cle.com, willy@...radead.org, tsahu@...ux.ibm.com,
        david@...hat.com
Subject: Re: [PATCH mm-unstable] mm: clarify folio_set_compound_order() zero
 support

On 12/7/22 4:38 PM, John Hubbard wrote:
> On 12/7/22 14:37, Sidhartha Kumar wrote:
>> Document hugetlb's use of a zero compound order so support for zero
>> orders is not removed from folio_set_compound_order().
>>
>> Signed-off-by: Sidhartha Kumar <sidhartha.kumar@...cle.com>
>> Suggested-by: Mike Kravetz <mike.kravetz@...cle.com>
>> Suggested-by: Muchun Song <songmuchun@...edance.com>
>> ---
>> This can be folded into f2b67a51d0ef6871d4fb0c3e8199f278112bd108
>> mm: add folio dtor and order setter functions
>>
>>   include/linux/mm.h | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/include/linux/mm.h b/include/linux/mm.h
>> index 443d496949a8..cd8508d728f1 100644
>> --- a/include/linux/mm.h
>> +++ b/include/linux/mm.h
>> @@ -999,9 +999,16 @@ static inline void set_compound_order(struct page 
>> *page, unsigned int order)
>>   #endif
>>   }
>> +/*
>> + * folio_set_compound_order is generally passed a non-zero order to
>> + * initialize a large folio.  However, hugetlb code abuses this by
>> + * passing in zero when 'dissolving' a large folio.
>> + */
> 
> Wouldn't it be better to instead just create a new function for that
> case, such as:
> 
>      dissolve_large_folio()
> 

Prior to the folio conversion, the helper function 
__destroy_compound_gigantic_page() did:

	set_compound_order(page, 0);
#ifdef CONFIG_64BIT
	page[1].compound_nr = 0;
#endif

as part of dissolving the page. My goal for this patch was to create a 
function that would encapsulate that segment of code with a single call 
of folio_set_compound_order(folio, 0). set_compound_order() does not set 
compound_nr to 0 when 0 is passed in to the order argument so explicitly 
setting it is required. I don't think a separate dissolve_large_folio() 
function for the hugetlb case is needed as 
__destroy_compound_gigantic_folio() is pretty concise as it is.

> ?
> 
>>   static inline void folio_set_compound_order(struct folio *folio,
>>           unsigned int order)
>>   {
>> +    VM_BUG_ON_FOLIO(!folio_test_large(folio), folio);
>> +
>>       folio->_folio_order = order;
>>   #ifdef CONFIG_64BIT
>>       folio->_folio_nr_pages = order ? 1U << order : 0;
> 
> thanks,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ