linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Muchun Song <muchun.song@linux.dev>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>,
	Mike Kravetz <mike.kravetz@oracle.com>,
	Matthew Wilcox <willy@infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Muchun Song <songmuchun@bytedance.com>, <tsahu@linux.ibm.com>,
	David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH mm-unstable] mm: clarify folio_set_compound_order() zero support
Date: Fri, 9 Dec 2022 13:20:41 -0800	[thread overview]
Message-ID: <23fa4ffa-965a-da80-e8b5-73ae92dc5767@nvidia.com> (raw)
In-Reply-To: <f4909342-eaca-8c55-ad95-359ab7a5e6db@nvidia.com>

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


  reply	other threads:[~2022-12-09 21:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 22:37 Sidhartha Kumar
2022-12-08  0:38 ` John Hubbard
2022-12-08  1:42   ` Sidhartha Kumar
2022-12-08  2:27     ` John Hubbard
2022-12-08  4:41       ` Muchun Song
2022-12-08 18:06       ` Sidhartha Kumar
2022-12-08 19:32         ` Mike Kravetz
2022-12-08 19:33         ` Matthew Wilcox
2022-12-08 19:56           ` John Hubbard
2022-12-08 20:01           ` Mike Kravetz
2022-12-08 21:58             ` Sidhartha Kumar
2022-12-08 22:01               ` John Hubbard
2022-12-08 22:12                 ` Sidhartha Kumar
2022-12-08 22:14                   ` John Hubbard
2022-12-08 22:33                     ` Sidhartha Kumar
2022-12-08 22:39                       ` John Hubbard
2022-12-09 14:27                         ` Muchun Song
2022-12-09 21:10                           ` John Hubbard
2022-12-09 21:20                             ` John Hubbard [this message]
2022-12-14  3:00                               ` Muchun Song
2022-12-08 22:04               ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23fa4ffa-965a-da80-e8b5-73ae92dc5767@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=muchun.song@linux.dev \
    --cc=sidhartha.kumar@oracle.com \
    --cc=songmuchun@bytedance.com \
    --cc=tsahu@linux.ibm.com \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox