[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <23fa4ffa-965a-da80-e8b5-73ae92dc5767@nvidia.com>
Date: Fri, 9 Dec 2022 13:20:41 -0800
From: John Hubbard <jhubbard@...dia.com>
To: Muchun Song <muchun.song@...ux.dev>
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 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?
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