linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>,
	John Hubbard <jhubbard@nvidia.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, songmuchun@bytedance.com,
	tsahu@linux.ibm.com, david@redhat.com
Subject: Re: [PATCH mm-unstable] mm: clarify folio_set_compound_order() zero support
Date: Thu, 8 Dec 2022 22:04:40 +0000	[thread overview]
Message-ID: <Y5JfeL48K3OWfNOu@casper.infradead.org> (raw)
In-Reply-To: <2723541a-79aa-c6b5-d82c-53db76b78145@oracle.com>

On Thu, Dec 08, 2022 at 01:58:20PM -0800, Sidhartha Kumar wrote:
> 5) improve the style of folio_set_order() by removing ifdefs from inside the
> function to doing
> 
> #ifdef CONFIG_64BIT
>  static inline void folio_set_order(struct folio *folio,
>                  unsigned int order)
>  {
> 	 VM_BUG_ON_FOLIO(!folio_test_large(folio), folio);
> 
> 	 folio->_folio_order = order;
>          folio->_folio_nr_pages = order ? 1U << order : 0;
> }
> #else
> static inline void folio_set_order(struct folio *folio,
>                  unsigned int order)
>  {
> 	 VM_BUG_ON_FOLIO(!folio_test_large(folio), folio);
> 
> 	 folio->_folio_order = order;
> }
> #endif

While we usually prefer to put ifdefs outside the function, I don't
think that's justified in this case.  I'd rather see a comment inside
the function like:

static inline void folio_set_order(struct folio *folio,
                unsigned int order)
{
	VM_BUG_ON_FOLIO(!folio_test_large(folio), folio);

	folio->_folio_order = order;
#ifdef CONFIG_64BIT
	/*
	 * When hugetlb dissolves a folio, we need to clear the tail
	 * page, rather than setting nr_pages to 1.
	 */
	folio->_folio_nr_pages = order ? 1U << order : 0;
#endif
}


      parent reply	other threads:[~2022-12-08 22:04 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
2022-12-14  3:00                               ` Muchun Song
2022-12-08 22:04               ` Matthew Wilcox [this message]

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=Y5JfeL48K3OWfNOu@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=sidhartha.kumar@oracle.com \
    --cc=songmuchun@bytedance.com \
    --cc=tsahu@linux.ibm.com \
    /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