From patchwork Fri Jun 24 17:36:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Houghton X-Patchwork-Id: 12894926 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 A6D1EC43334 for ; Fri, 24 Jun 2022 17:37:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 390028E023F; Fri, 24 Jun 2022 13:37:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F1338E020E; Fri, 24 Jun 2022 13:37:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F5EC8E023F; Fri, 24 Jun 2022 13:37:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id EF9E08E020E for ; Fri, 24 Jun 2022 13:37:12 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id C56B660830 for ; Fri, 24 Jun 2022 17:37:12 +0000 (UTC) X-FDA: 79613835504.26.9CB1415 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf15.hostedemail.com (Postfix) with ESMTP id 5EF87A0022 for ; Fri, 24 Jun 2022 17:37:12 +0000 (UTC) Received: by mail-yb1-f202.google.com with SMTP id s6-20020a255e06000000b00669b21c51b5so2716064ybb.21 for ; Fri, 24 Jun 2022 10:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=0YfnJKuQrbw7pcq3GiMHpIZjYaYv7/J4Psozl7GAbkY=; b=rhedzQCKx2wNhVDSGuAJpH9VZYMHroyUpR1McnELZRf5xZDgeN7uNFXQFUQY36oI+V sQBZjS3MbDOeENElKNgbkCSeJdkA4KvbvhCfXewwUZV8VRhUz4h9mZPxYQQ152Wr/FN/ 5BdmdPLWcel0PhshC6zVgGbHZJRq7Q7vjb3TkLcOA4+olBP02aOCGQ9Oozydj+ubNW0a x/51FkRIRk4fHQ5AYf3+Jpxz4mZgUNsIXL+ynW22YI6IcrDX3OU3vcAglWcWj6mxHBI5 z3zP8e+fcp3Sh89Okw6YqgR52njYR4st6QIktXU0C0bgCozw42NZ4PuV/5cZ6iJXZUXt qYDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=0YfnJKuQrbw7pcq3GiMHpIZjYaYv7/J4Psozl7GAbkY=; b=ms/G3CvBGACYk0EQYR7WA2F2A/qW8OWhbv+H/AqVZ22Eb61mOxeWizbHsMsnNxs/yh wEax5QkUuxbU4M90doZhEZrjGl3Et0guaG6TVjK8J6AAik3y88qDmkiYQNTvy8lbMxf9 QqvhPOkYbV2n3y1M+BeH91v0rHxwDVqYnnXdmqGtKV+x4VrXTg5/OkohmjRq+mOyuHUX XF2H+UfIf28c7t4DDZBaA4pM4dofwML8vMa5/1WFoarl3rY0F5bx0xq/KUZfPejaAOuc Jzojov5VvcKmY97Kf53kqmaRsFqiu5qpjpA/ENrcfqIXRfiKEdD2sQIYeKwu3eO7zR1m +HAg== X-Gm-Message-State: AJIora9I20RUD9RZilvV7K2clbnuBvcLFcIFGtlKzE4ueQrj8+g6TeA7 sm/djI+YHW7SbwbJfsIo/GCDCabFdlgxS1Xt X-Google-Smtp-Source: AGRyM1s/D7w5lW8rHIOJ8tPXZ//y7BlXl1scm2CvIFSsZAI4asuL+1307Qq/vgDdbLiEG20sjasM/mVp1mTCdeSz X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a0d:f4c5:0:b0:317:7f89:f547 with SMTP id d188-20020a0df4c5000000b003177f89f547mr18475ywf.334.1656092231687; Fri, 24 Jun 2022 10:37:11 -0700 (PDT) Date: Fri, 24 Jun 2022 17:36:31 +0000 In-Reply-To: <20220624173656.2033256-1-jthoughton@google.com> Message-Id: <20220624173656.2033256-2-jthoughton@google.com> Mime-Version: 1.0 References: <20220624173656.2033256-1-jthoughton@google.com> X-Mailer: git-send-email 2.37.0.rc0.161.g10f37bed90-goog Subject: [RFC PATCH 01/26] hugetlb: make hstate accessor functions const From: James Houghton To: Mike Kravetz , Muchun Song , Peter Xu Cc: 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, James Houghton ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656092232; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0YfnJKuQrbw7pcq3GiMHpIZjYaYv7/J4Psozl7GAbkY=; b=g9iPEINwbvfbrwqTWMIxJxrwd96amg+r6f/kdFXnlBVEvH+kodEXVzNiA7AWe8cDTeQkxn KssjMZfK98GvRIMuqRR74jdxvRLIfk+tR4BG+P7P9J5kUqTHqDqG4zKsZUz9YhBnxeMJt1 7BXB197ujrHDtSoXX6XhtMWx+/13Rbs= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=rhedzQCK; spf=pass (imf15.hostedemail.com: domain of 3R_a1YgoKCCgNXLSYKLXSRKSSKPI.GSQPMRYb-QQOZEGO.SVK@flex--jthoughton.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3R_a1YgoKCCgNXLSYKLXSRKSSKPI.GSQPMRYb-QQOZEGO.SVK@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656092232; a=rsa-sha256; cv=none; b=XEQdeA+RmAPmRW7RzVQoFD6kAAW4tJ+hxqtJHgWJ0A4c/jL1X29FaO/yBUgAMC2+aRJXry 3PUdR/8M8ZitrMgGRYqOzx2cNqsa4IcMMR0G4JQoJtO+orYYJm6Xm02KjKP+AoqPNgpCs9 nWJvhDU84vd4Y/PBM/BosBzMgNZugZU= Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=rhedzQCK; spf=pass (imf15.hostedemail.com: domain of 3R_a1YgoKCCgNXLSYKLXSRKSSKPI.GSQPMRYb-QQOZEGO.SVK@flex--jthoughton.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3R_a1YgoKCCgNXLSYKLXSRKSSKPI.GSQPMRYb-QQOZEGO.SVK@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: rhmgixquu1rmmgkqjsmuuqmkktxhcqro X-Rspamd-Queue-Id: 5EF87A0022 X-HE-Tag: 1656092232-977833 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: 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 Reviewed-By: Mina Almasry --- 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; }