From nobody Sun Feb 8 12:14:58 2026 Received: from sg-1-103.ptr.blmpb.com (sg-1-103.ptr.blmpb.com [118.26.132.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B390350D4D for ; Thu, 22 Jan 2026 03:50:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=118.26.132.103 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769053849; cv=none; b=L2sx3KMdYB9GKgGBb84Fg5xLgCybMMduPzwBJYOchlzW23PHO2DqmuxikGUCFBWzXOx6jkspaMXYi5wtiq2kl/dI6zD7z6j193ZQ1VZk2gLeq7AtFuKMUvWwqdSd3yIXGkK2gtx/Mf6Biwy0IYEym/iPCZLP4oHYVFPoHKxN9gA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769053849; c=relaxed/simple; bh=NFhuqLD20LzAGijgiLdpvn2eQuJIr41Y0LawsG3g6rg=; h=Mime-Version:Message-Id:Date:From:Subject:Cc:Content-Type:To; b=NUj1IHpKXG5Rs13ZjHjewTpwWwGKZuMPhki2rrYvhoZ29duov3T1nepJjxD0/vCTcSe8FFc1PWTPq7n7aW0XQ5vAViW62faLsI54S3W3qJX4E9lzVuAyPDgdiD1kvjim3b8LYh5O41cbuL1uN1J7tkvkL2h1H2nn+sH3Q/h3tgM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=HD0nDxR/; arc=none smtp.client-ip=118.26.132.103 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="HD0nDxR/" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1769053827; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=tUa5co6on1U0IzQ0RKE/MLpqVY6+mYgKaahledzzgqw=; b=HD0nDxR/guTekd2FFt47WR+VKbCTevshGyMTlSkuZkrEa4ezBSNZy/zMVWr2ledEV1ZNg6 xVSKEYhI3GgwieP0bF67e+caJsjUS54KiodMs7C9g4A6I8NIREh4jStTsWoomA8tBy8jvw 1kQKj30RcPL9aoHpyC3u7JAsizMPe5GslbjDTeyVJRct+OCqc9SS0sFAB138cSsaBuCG+J m8BTgogiFm6KWz10qoZRUyEPZd4Z6ca8e5dpj6UtnOo5XcanqilPHUFD7jc7cFWunS8gq/ W15GAsKWc9oGjAi/9ijf5n4YCyKHrRBjBNUS66axjzStz1a5K+Ar5gq4mP8oww== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <20260122035002.79958-1-lizhe.67@bytedance.com> X-Mailer: git-send-email 2.45.2 Date: Thu, 22 Jan 2026 11:50:02 +0800 From: "Li Zhe" Subject: [PATCH] hugetlb: increase hugepage reservations when using node-specific "hugepages=" cmdline X-Original-From: Li Zhe Cc: , , X-Lms-Return-Path: To: , , , Content-Type: text/plain; charset="utf-8" Commit 3dfd02c90037 ("hugetlb: increase number of reserving hugepages via cmdline") raised the number of hugepages that can be reserved through the boot-time "hugepages=3D" parameter for the non-node-specific case, but left the node-specific form of the same parameter unchanged. This patch extends the same optimization to node-specific reservations. When HugeTLB vmemmap optimization (HVO) is enabled and a node cannot satisfy the requested hugepages, the code first releases ordinary struct-page memory of hugepages obtained from the buddy allocator, allowing their struct-page memory to be reclaimed and reused for additional hugepage reservations on that node. This is particularly beneficial for configurations that require identical, large per-node hugepage reservations. On a four-node, 384 GB x86 VM, the patch raises the attainable 2 MiB hugepage reservation from under 374 GB to more than 379 GB. Signed-off-by: Li Zhe Acked-by: Oscar Salvador Reviewed-by: Muchun Song --- mm/hugetlb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index a1832da0f623..008315616c3b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3425,6 +3425,13 @@ static void __init hugetlb_hstate_alloc_pages_onenod= e(struct hstate *h, int nid) =20 folio =3D only_alloc_fresh_hugetlb_folio(h, gfp_mask, nid, &node_states[N_MEMORY], NULL); + if (!folio && !list_empty(&folio_list) && + hugetlb_vmemmap_optimizable_size(h)) { + prep_and_add_allocated_folios(h, &folio_list); + INIT_LIST_HEAD(&folio_list); + folio =3D only_alloc_fresh_hugetlb_folio(h, gfp_mask, nid, + &node_states[N_MEMORY], NULL); + } if (!folio) break; list_add(&folio->lru, &folio_list); --=20 2.20.1