From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48081C433F5 for ; Thu, 31 Mar 2022 02:58:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C45548D0001; Wed, 30 Mar 2022 22:58:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BCAF86B0073; Wed, 30 Mar 2022 22:58:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A6BEF8D0001; Wed, 30 Mar 2022 22:58:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0211.hostedemail.com [216.40.44.211]) by kanga.kvack.org (Postfix) with ESMTP id 901E16B0072 for ; Wed, 30 Mar 2022 22:58:04 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 500528249980 for ; Thu, 31 Mar 2022 02:58:04 +0000 (UTC) X-FDA: 79303172088.18.0396C9B Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf18.hostedemail.com (Postfix) with ESMTP id AD7021C0019 for ; Thu, 31 Mar 2022 02:58:03 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D7C3EB81E9A; Thu, 31 Mar 2022 02:58:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DB7AC340F0; Thu, 31 Mar 2022 02:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1648695480; bh=1bvfiThee0tfMwL06GiQ3KTUBZtkZQn6o1lFExVrqDo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=h6Bf7sLuGVVxS0o9LcX8augarAdxfWvVTaPw+3LTeFkr+c6mOBOY8KKJEAP6N6pt8 SyIJCpdHm7EqsTFoGkhIZcVtvy7ILpeaSP/0dQMq8MaJ/uZ2SwgKDpoABzAdCfrfTK f6/NiQeO3XBjoBUgKMJyB03PFjNQLTMrREM+88tQ= Date: Wed, 30 Mar 2022 19:57:59 -0700 From: Andrew Morton To: Muchun Song Cc: Jonathan Corbet , Mike Kravetz , Luis Chamberlain , Kees Cook , Iurii Zaikin , Oscar Salvador , David Hildenbrand , Masahiro Yamada , Linux Doc Mailing List , LKML , Linux Memory Management List , Xiongchun duan , Muchun Song Subject: Re: [PATCH v6 1/4] mm: hugetlb_vmemmap: introduce STRUCT_PAGE_SIZE_IS_POWER_OF_2 Message-Id: <20220330195759.6da783a678229008ac2a6851@linux-foundation.org> In-Reply-To: References: <20220330153745.20465-1-songmuchun@bytedance.com> <20220330153745.20465-2-songmuchun@bytedance.com> <20220330192827.4b95e3d7fb149ef9cc687ccb@linux-foundation.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=h6Bf7sLu; spf=pass (imf18.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: b6987hgtukw6nqa3taddb7mwq78xi91q X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: AD7021C0019 X-HE-Tag: 1648695483-784620 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, 31 Mar 2022 10:52:58 +0800 Muchun Song 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 ;)