Re: [PATCH v6 1/4] mm: hugetlb_vmemmap: introduce STRUCT_PAGE_SIZE_IS_POWER_OF_2
From: Andrew Morton
Date: Thu Mar 31 2022 - 00:17:48 EST
On Thu, 31 Mar 2022 10:52:58 +0800 Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote:
> > > +int main(void)
> > > +{
> > > + if (is_power_of_2(sizeof(struct page)))
> > > + DEFINE(STRUCT_PAGE_SIZE_IS_POWER_OF_2, is_power_of_2(sizeof(struct page)));
> >
> > Why not
> >
> > DEFINE(STRUCT_PAGE_SIZE_IS_POWER_OF_2, 1);
> >
>
> Yep, this is more simple. But the 2nd parameter of DEFINE() will
> go into the comments. I want to make it more clear when someone
> reads the code of this macro. The two different sentences will
> generate the following two different comments. Which one do
> you think is better?
>
> #define STRUCT_PAGE_SIZE_IS_POWER_OF_2 1 /*
> is_power_of_2(sizeof(struct page)) */
> #define STRUCT_PAGE_SIZE_IS_POWER_OF_2 1 /* 1 */
The former ;)