From: Ackerley Tng Date: Wed, 22 Jul 2026 16:41:19 -0700 Subject: [PATCH v4 11/16] WIP: mm: hugetlb: Make struct hugepage_subpool private to hugetlb_subpool.c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260722-hugetlb-alloc-failure-fixes-v4-11-88e8b81970dc@google.com> References: <20260722-hugetlb-alloc-failure-fixes-v4-0-88e8b81970dc@google.com> In-Reply-To: <20260722-hugetlb-alloc-failure-fixes-v4-0-88e8b81970dc@google.com> To: Muchun Song , Oscar Salvador , David Hildenbrand , Joshua Hahn , Shakeel Butt , Nhat Pham , Andrew Morton , Peter Xu , Wupeng Ma , fvdl@google.com, rientjes@google.com, jthoughton@google.com, Mike Kravetz , Johannes Weiner , Michal Hocko , Roman Gushchin , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jonathan Corbet , Shuah Khan , Alex Shi , Yanteng Si , Dongliang Mu , Hongxiang Lou , Miaohe Lin Cc: vannapurve@google.com, erdemaktas@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-doc@vger.kernel.org, Ackerley Tng X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784763678; l=2210; i=ackerleytng@google.com; s=20260225; h=from:subject:message-id; bh=lOjGCQX3/m/ifrV7JiSqPXOvpZ1jml5gEVW64pYajUU=; b=62CKcF92BwyBeZ4+JVII0ser/DgCEfN1PyHCWdGDtFmjFrAuQZH+HIAkkbwAgIhRX0bTFA9mn 4K8I6LvaxRBBops7keMTrhLFMeObPf79bBddWfrNINpTiku9RWX/K7X X-Developer-Key: i=ackerleytng@google.com; a=ed25519; pk=sAZDYXdm6Iz8FHitpHeFlCMXwabodTm7p8/3/8xUxuU= X-Endpoint-Received: by B4 Relay for ackerleytng@google.com/20260225 with auth_id=649 List-Id: B4 Relay Submissions Now that all filesystem and memory management subpool functions across fs/hugetlbfs/inode.c and mm/ use getters, transition struct hugepage_subpool out of the public header include/linux/hugetlb.h and encapsulate it privately inside mm/hugetlb_subpool.c. Replace the header definition with a forward declaration. Signed-off-by: Ackerley Tng --- include/linux/hugetlb.h | 13 ++----------- mm/hugetlb_subpool.c | 12 ++++++++++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index f36be371c6e88..074a45903973e 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -18,6 +18,7 @@ struct mmu_gather; struct node; +struct hstate; void free_huge_folio(struct folio *folio); @@ -34,17 +35,7 @@ void free_huge_folio(struct folio *folio); */ #define __NR_USED_SUBPAGE 3 -struct hugepage_subpool { - spinlock_t lock; - long count; - long max_hpages; /* Maximum huge pages or -1 if no maximum. */ - long used_hpages; /* Used page count, includes both */ - /* allocated and reserved pages. */ - struct hstate *hstate; - long min_hpages; /* Minimum huge pages or -1 if no minimum. */ - long rsv_hpages; /* Pages reserved against global pool to */ - /* satisfy minimum size. */ -}; +struct hugepage_subpool; struct resv_map { struct kref refs; diff --git a/mm/hugetlb_subpool.c b/mm/hugetlb_subpool.c index ac0f9057b4921..39413515a2722 100644 --- a/mm/hugetlb_subpool.c +++ b/mm/hugetlb_subpool.c @@ -14,6 +14,18 @@ #include #include "hugetlb_subpool.h" +struct hugepage_subpool { + spinlock_t lock; + long count; + long max_hpages; /* Maximum huge pages or -1 if no maximum. */ + long used_hpages; /* Used page count, includes both */ + /* allocated and reserved pages. */ + struct hstate *hstate; + long min_hpages; /* Minimum huge pages or -1 if no minimum. */ + long rsv_hpages; /* Pages reserved against global pool to */ + /* satisfy minimum size. */ +}; + static inline bool subpool_is_free(struct hugepage_subpool *spool) { if (spool->count) -- 2.55.0.229.g6434b31f56-goog