Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp36001pxb; Wed, 30 Mar 2022 22:14:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxzQbZhSldbrMA+SHRudsgebqzvcfy7yIoWdfTK0i/xETXCk3h8QrKI1KSwnJWK2EEYVr3 X-Received: by 2002:a17:902:9345:b0:153:4d7a:53d9 with SMTP id g5-20020a170902934500b001534d7a53d9mr40360720plp.116.1648703660327; Wed, 30 Mar 2022 22:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648703660; cv=none; d=google.com; s=arc-20160816; b=n+o/QZxGQwQYJimqciKkz6BH1jjGXkO9lMCeKFyHtQz8Kr8DA2TLZMolWnbylKPP8M 3YhoSo2Dt6imKC8y/364x22RzM94wibwBXihcL9mRjIgYklHcOMo/OWf8x359RqAdnvn 3rf+kfFnhnyQsytEYsPHqd3kpNopuA4pKLkiJTBzhUWJk6CrMx5rI5n0Wf+3OAjxESy2 VaAdH0rynMtmJJlWNJvp9yDM5ks5nY4xkdBtv+TJHLw5uvR2eFkbZEvc2x7BxwKlhDZy DNzUl16xfZOXTfOl3Z4sOgH8SsHnOKUY7vlJ0+4B3xkCm7rOWK0dBWCfBXfgGNVdn4GF IUWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=y9IPg1S9l9tTsGLpGpbU3+NYgvdNe3nU68WNCiJkgFU=; b=GJf7EoUYWnNtKcbVO53yUt8oM0JBQcePgdAcd/kw2BLofjEO90t5JXoPDMybcTcq/9 Uk+cv/JGesj/naWvnWaibMg6PhioCbx3rNhRFx4sdyrNVCnpRrk/E4Li7ff7zg11uuFZ eRFRwaC8jimz0HSoNLnZU6xQWGibGsPjQjL7Ss8QRF7oJjhfdUARaRNc1M6rOEBvEvCe t9hy/U0bqIJpJYgv4yI1raU3XsITk8CA43uAofQQjVkIL9OoQA3ZxiVMUuSepwTpPG6N 4M6pg8wUqdDecjaxshXhdQGC9YIHlF+AshZdKle+IpvQca2ikZaZ2d02GSDlyxcUJtoo GpXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=h6Bf7sLu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bg4-20020a1709028e8400b00153b2d165a9si22214105plb.433.2022.03.30.22.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 22:14:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=h6Bf7sLu; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 57B311DEAB1; Wed, 30 Mar 2022 21:18:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229756AbiCaET1 (ORCPT + 99 others); Thu, 31 Mar 2022 00:19:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229704AbiCaESx (ORCPT ); Thu, 31 Mar 2022 00:18:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0096628E361; Wed, 30 Mar 2022 21:12:11 -0700 (PDT) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 1C74160C66; 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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ;)