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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <00CBD2D1-EEDD-4171-94F4-8DCC0446F26E@linux.dev>
Date:   Wed, 14 Dec 2022 11:00:02 +0800
From:   Muchun Song <muchun.song@...ux.dev>
To:     John Hubbard <jhubbard@...dia.com>
Cc:     Sidhartha Kumar <sidhartha.kumar@...cle.com>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Matthew Wilcox <willy@...radead.org>,
        linux-kernel@...r.kernel.org,
        Linux Memory Management List <linux-mm@...ck.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Muchun Song <songmuchun@...edance.com>, tsahu@...ux.ibm.com,
        David Hildenbrand <david@...hat.com>
Subject: Re: [PATCH mm-unstable] mm: clarify folio_set_compound_order() zero
 support



> On Dec 10, 2022, at 05:20, John Hubbard <jhubbard@...dia.com> wrote:
> 
> On 12/9/22 13:10, John Hubbard wrote:
>> On 12/9/22 06:27, Muchun Song wrote:
>>>  From you advise, I think we can remove VM_BUG_ON and handle non-zero
>>> order page, something like:
>> Yes, and thanks for summarizing all the individual feedback into a
>> proposed solution.
>> If we go this route, then I'd suggest a little note above the function,
>> such as:
>> /*
>>  * For non-large folios, this will have no effect, other than possibly
>>  * generating a warning, if the caller attempts to set a non-zero folio order
>>  * for a non-large folio.
>>  */
>>> static inline void folio_set_order(struct folio *folio,
>>>                            unsigned int order)
>>> {
>>>     if (!folio_test_large(folio)) {
>>>         WARN_ON(order);
> 
> Although, on second thought...I'm still a little confused about why
> keeping the same name is so important?

Just my personal preference. I like its simplicity. I'm not against
large_folio_set_order, but suggest folio_set_order.

Thanks.

> 
> A very direct approach that has more accurate naming (and therefore no
> need for a strange comment explaining the behavior) would be:
> 
> 
> static inline void large_folio_set_order(struct folio *folio,
> unsigned int order)
> {
> 	if (WARN_ON_ONCE(!folio_test_large(folio)))
> 		return;
> 
> 	folio->_folio_order = order;
> #ifdef CONFIG_64BIT
> 	folio->_folio_nr_pages = order ? 1U << order : 0;
> #endif
> }
> 
> 
> thanks,
> -- 
> John Hubbard
> NVIDIA

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ