Re: [PATCH mm-unstable] mm: clarify folio_set_compound_order() zero support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux