From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0EDC4397339 for ; Tue, 12 May 2026 13:17:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778591865; cv=none; b=aC8BtgaNEYf8DAjoffiE6cbQTXLWvzn1tkfEwTosCKn5OBjLtGn6JtZQkynOW5q1ddL9q4/4TZk5SLZghb5NK6h1zoZelOWKvscb5VokaecUgvLlwiJspIDPocgYIiEtFCcCntcn8K3yvuQT1GdulLqWxmgLyJwpSYMh/fzkutI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778591865; c=relaxed/simple; bh=H2b4mRDVnk8OYzLUI1g29z6acV4is3XjJAIYUjrPJQ0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=cHW6WmuTdPZa0gwwmocMZoyD/w3zkV0upQlg79ku5LqYwekrw4luyNCos1fnssaXbSbNjg4k2MVGoZGU3tdh70DetBySranSASn/eV+ip7ybGdFlLdB0UvqlPUVMfWLQcauKBHnjf/qiClw17FtV3A/XMwt196Tpqawe8cHpXMA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ASnKgMfS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ASnKgMfS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9723AC2BCF6; Tue, 12 May 2026 13:17:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1778591864; bh=H2b4mRDVnk8OYzLUI1g29z6acV4is3XjJAIYUjrPJQ0=; h=Subject:To:Cc:From:Date:From; b=ASnKgMfSzoQdtFpqa9BP+YGz0aa9cY092ttkJruyb2PCIDxmjhPvA8sORpdh/W0RO 9G8zhYwYqWmYnRAYcOdL+8MRTy7iTJ52ddFipcrIcP4y+VD5VCCDoJ0gXH7V+2W7mk aDAvTP6x5r2C0arXhNjt/8wUy5mm4AfKPkXCorKY= Subject: FAILED: patch "[PATCH] mm/hugetlb_cma: round up per_node before logging it" failed to apply to 6.6-stable tree To: ekffu200098@gmail.com,akpm@linux-foundation.org,david@kernel.org,muchun.song@linux.dev,osalvador@suse.de,stable@vger.kernel.org Cc: From: Date: Tue, 12 May 2026 15:17:41 +0200 Message-ID: <2026051241-flakily-uniquely-50ca@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x 8f5ce56b76303c55b78a87af996e2e0f8535f979 # git commit -s git send-email --to '' --in-reply-to '2026051241-flakily-uniquely-50ca@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 8f5ce56b76303c55b78a87af996e2e0f8535f979 Mon Sep 17 00:00:00 2001 From: Sang-Heon Jeon Date: Wed, 22 Apr 2026 23:33:53 +0900 Subject: [PATCH] mm/hugetlb_cma: round up per_node before logging it When the user requests a total hugetlb CMA size without per-node specification, hugetlb_cma_reserve() computes per_node from hugetlb_cma_size and the number of nodes that have memory per_node = DIV_ROUND_UP(hugetlb_cma_size, nodes_weight(hugetlb_bootmem_nodes)); The reservation loop later computes size = round_up(min(per_node, hugetlb_cma_size - reserved), PAGE_SIZE << order); So the actually reserved per_node size is multiple of (PAGE_SIZE << order), but the logged per_node is not rounded up, so it may be smaller than the actual reserved size. For example, as the existing comment describes, if a 3 GB area is requested on a machine with 4 NUMA nodes that have memory, 1 GB is allocated on the first three nodes, but the printed log is hugetlb_cma: reserve 3072 MiB, up to 768 MiB per node Round per_node up to (PAGE_SIZE << order) before logging so that the printed log always matches the actual reserved size. No functional change to the actual reservation size, as the following case analysis shows 1. remaining (hugetlb_cma_size - reserved) >= rounded per_node - AS-IS: min() picks unrounded per_node; round_up() returns rounded per_node - TO-BE: min() picks rounded per_node; round_up() returns rounded per_node (no-op) 2. remaining < unrounded per_node - AS-IS: min() picks remaining; round_up() returns round_up(remaining) - TO-BE: min() picks remaining; round_up() returns round_up(remaining) 3. unrounded per_node <= remaining < rounded per_node - AS-IS: min() picks unrounded per_node; round_up() returns rounded per_node - TO-BE: min() picks remaining; round_up() returns round_up(remaining) equals rounded per_node Link: https://lore.kernel.org/20260422143353.852257-1-ekffu200098@gmail.com Fixes: cf11e85fc08c ("mm: hugetlb: optionally allocate gigantic hugepages using cma") # 5.7 Signed-off-by: Sang-Heon Jeon Reviewed-by: Muchun Song Cc: David Hildenbrand Cc: Oscar Salvador Cc: Signed-off-by: Andrew Morton diff --git a/mm/hugetlb_cma.c b/mm/hugetlb_cma.c index f83ae4998990..7693ccefd0c6 100644 --- a/mm/hugetlb_cma.c +++ b/mm/hugetlb_cma.c @@ -204,6 +204,7 @@ void __init hugetlb_cma_reserve(void) */ per_node = DIV_ROUND_UP(hugetlb_cma_size, nodes_weight(hugetlb_bootmem_nodes)); + per_node = round_up(per_node, PAGE_SIZE << order); pr_info("hugetlb_cma: reserve %lu MiB, up to %lu MiB per node\n", hugetlb_cma_size / SZ_1M, per_node / SZ_1M); }