Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp289071iog; Tue, 28 Jun 2022 23:30:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ud0SgWp5zL5OsL4FZ/PclDgm2dl2S2QU6ArzrBmvlf5i2f7nnXu8Q4bo2NhOP9EKar6gGL X-Received: by 2002:a05:6402:398:b0:435:6df7:b7e4 with SMTP id o24-20020a056402039800b004356df7b7e4mr2191905edv.306.1656484205859; Tue, 28 Jun 2022 23:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656484205; cv=none; d=google.com; s=arc-20160816; b=hJs+xZkWcG0CxjOsP0LQeFJPvZIEWHnrmNupWAj3eeywS3bG49RT7EgRvQAxKTkqyX 61Jj7P0ahIIcfPeMTJE6AkmHlSxFj4k8E8Vk+yPiJGqxpKe2qs3d7NAsDkeoJrgatwQm ckoscgDDYV/LsMdwmmaPc+Z+9xEeQ8QKKgHrzN5hvyUaSftkolGrQAM9JbW/+1JRaqXZ Pm/3+zqULAZ9cxWWBXWdhpeKlzYBoiaC++/fiUhLSEuElOVVjKNVTcBKjo5zeLJPei/0 4HqewQVGIQ8ZIT+eEUcMAsDhTf5tUZGpPxSjXKTM3Xb9wrd538TRG7QD+ZBEUnybgcTZ vLaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FurANPoXFgLl4yATK+0eEznj1edHZa5nVDv5uuc4bDo=; b=r62+kXpB3WBc5rbB6+0xwD97+MINN/jTZbh+5+3V09GUC9J0RslwHaQggDDY0j1gRc CvnWdxaYTxN668OeWl+BeeDHV8iH2GAO7rPqq3ShHugVEG/QpreuUCSzN5t4lV2oviMd 9th+QHifsdMJHHv9y9qXhQfRIWbJv5X/fhahFMXKAB2dopg/AeSP5+tXMD6C8wgzGHP/ 1QXbHjnrElLxREbTmxtcp2twoUT3C0arrdkPN04+vsC6xCvNFGI+COydM9NjMk/svytK 8W1SZNOcNsgMp8ui44mO5my85pDiKasKKEbKzlWZCvnJPp7m4bqZHaHlTYB3YxdYS2h6 hWpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=SgHO+LNG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz18-20020a1709077d9200b006f392f11feasi426454ejc.20.2022.06.28.23.29.40; Tue, 28 Jun 2022 23:30:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=SgHO+LNG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231909AbiF2GS0 (ORCPT + 99 others); Wed, 29 Jun 2022 02:18:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbiF2GSZ (ORCPT ); Wed, 29 Jun 2022 02:18:25 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9842EE16 for ; Tue, 28 Jun 2022 23:18:24 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id a15so14097612pfv.13 for ; Tue, 28 Jun 2022 23:18:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=FurANPoXFgLl4yATK+0eEznj1edHZa5nVDv5uuc4bDo=; b=SgHO+LNGTa1ZjEU1fOMIoa78TDbXDU0lSMDcOCNqg0P90+bK2g9CGB4PHOz1BHZOzU A/KQWOveXJNoOlNAY02aABLZHERdexNI663akY+LgpXN1DUAHH9eCJ+22DdUpvnI/UCu tn97Z8uK2JPGB8CY3Qw9eezEHLDyofmdFw7CNsVtAbKu2DL7KpjlMtk4wLNj6rTiWTS1 diY4j1pPbUfu+IlCcOa6XUSMqAB2FmGHRdf5SV1nzTYI0z3qx9NKXucW3idRY15a/bnv mtUybon/6E1Vyjdpvg63bGY4RbGOwHCIOjJoE7ZKmQv7MjsxaEkAm4wvkz++hcHfmYyC ebzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FurANPoXFgLl4yATK+0eEznj1edHZa5nVDv5uuc4bDo=; b=hHZZre/2Y4yvF5bfn6OCf+15LXuop8mGAr75vdNEiQZrCtHEQ3XowgbJEPAIgR+egc wcnG0pa7bVmGhSphm5SoPhCYpZ77k3RxYsgOB2vHtG95XYrRTz+Gl9uH1xpJxVvjiI5Q aPFR5d/0ZC2femZbfYkf403Su0boBQUMnMi6PsaP3E34cUPssh7o6pvfuslYeAsPRavS UpZup1io1djLBuqLbTNkhAcY1UKZPOXDZb59nOx8V3ZndPQ+NbKyAaGIRW8dowdaoSei vnM/Dnzskr0fVO9+oX6QC8wt1cGxFSW1Ty4GcnFxwb1h4iyi7Z9LLxxZpoFVtG6Yagb4 I9qg== X-Gm-Message-State: AJIora8RbVr42GFLhV9ghDPm9kUvT521MDvS3jrYkx2l/PDRbgYkrvRE Od6hibNbe1T8Uxsgvq/wURMkOg== X-Received: by 2002:a63:ee54:0:b0:3fe:30cc:899f with SMTP id n20-20020a63ee54000000b003fe30cc899fmr1703757pgk.234.1656483504443; Tue, 28 Jun 2022 23:18:24 -0700 (PDT) Received: from localhost ([139.177.225.245]) by smtp.gmail.com with ESMTPSA id q13-20020a170902a3cd00b0016403cae7desm10453132plb.276.2022.06.28.23.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 23:18:24 -0700 (PDT) Date: Wed, 29 Jun 2022 14:18:20 +0800 From: Muchun Song To: James Houghton Cc: Mike Kravetz , Peter Xu , David Hildenbrand , David Rientjes , Axel Rasmussen , Mina Almasry , Jue Wang , Manish Mishra , "Dr . David Alan Gilbert" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 01/26] hugetlb: make hstate accessor functions const Message-ID: References: <20220624173656.2033256-1-jthoughton@google.com> <20220624173656.2033256-2-jthoughton@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220624173656.2033256-2-jthoughton@google.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Fri, Jun 24, 2022 at 05:36:31PM +0000, James Houghton wrote: > This is just a const-correctness change so that the new hugetlb_pte > changes can be const-correct too. > > Acked-by: David Rientjes > > Signed-off-by: James Houghton This is a good start. I also want to make those helpers take const type parameter. Seems you have forgotten to update them when !CONFIG_HUGETLB_PAGE. Thanks. > --- > include/linux/hugetlb.h | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h > index e4cff27d1198..498a4ae3d462 100644 > --- a/include/linux/hugetlb.h > +++ b/include/linux/hugetlb.h > @@ -715,7 +715,7 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) > return hstate_file(vma->vm_file); > } > > -static inline unsigned long huge_page_size(struct hstate *h) > +static inline unsigned long huge_page_size(const struct hstate *h) > { > return (unsigned long)PAGE_SIZE << h->order; > } > @@ -729,27 +729,27 @@ static inline unsigned long huge_page_mask(struct hstate *h) > return h->mask; > } > > -static inline unsigned int huge_page_order(struct hstate *h) > +static inline unsigned int huge_page_order(const struct hstate *h) > { > return h->order; > } > > -static inline unsigned huge_page_shift(struct hstate *h) > +static inline unsigned huge_page_shift(const struct hstate *h) > { > return h->order + PAGE_SHIFT; > } > > -static inline bool hstate_is_gigantic(struct hstate *h) > +static inline bool hstate_is_gigantic(const struct hstate *h) > { > return huge_page_order(h) >= MAX_ORDER; > } > > -static inline unsigned int pages_per_huge_page(struct hstate *h) > +static inline unsigned int pages_per_huge_page(const struct hstate *h) > { > return 1 << h->order; > } > > -static inline unsigned int blocks_per_huge_page(struct hstate *h) > +static inline unsigned int blocks_per_huge_page(const struct hstate *h) > { > return huge_page_size(h) / 512; > } > -- > 2.37.0.rc0.161.g10f37bed90-goog > >