From nobody Tue Feb 10 00:22:30 2026 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 B05051DE2B3 for ; Mon, 27 Jan 2025 23:22:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738020154; cv=none; b=s0l8mC8EUZhex+ElTvCSiQ5vmU8CewZ/voiExU82iRsSRfyYD/cMmmzwtnmGuRud4foQZDLWcyWr/mXGVsbcENPdONjhzjqHBhnIG5aKKDF7fWDmUEA43fRaoKgtrCwpMfDn6JUFknmX1A4Chkxud5RT5Qv5cgdRGPVIaoGi+HY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738020154; c=relaxed/simple; bh=JagqUN1+YZnwltrXmjna1Ngdn4L4pK/DyLEcqpvGgAk=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=NzAoSE1TshEGGOua2DpsnUVv3QvTddZ61/7V5HUqZ0RWrZ0FqYUv6nEd0M+S94fJSDRuRujiIWjG/B3Pk6uSutcZWxI8KeICulNY15ClyPJeZ48Tp7NbSDFSFdEcIH0FN852X8aq+5LQgFT8QQo9ROGVdTzykzqIXd2f7Kzt460= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--fvdl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=YYSyy2hJ; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--fvdl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YYSyy2hJ" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2ef7fbd99a6so9590956a91.1 for ; Mon, 27 Jan 2025 15:22:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738020152; x=1738624952; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=3cL+TUH11/smaxLgrRBkwnVa/XBTlyU3EXvG7o/S9Vk=; b=YYSyy2hJmJ8Bgqede5TN5h1kgHsgNUtsG+3wdscxY09x8FB/PZBy+F96J4xKZttzcN Cgtc4KpjEgKtJY4To8qG3lW4nx99hZ7Lym2no2H+7Cp27Jix6mFkHhFTOqr+ESZZMD42 tB8CdFptBkx0bhch3S0nLfjP2OmYMYgm98G/Oxd3B5F7jKsoidIBc2m7pmV59Ri4vouT 7+pUApL9nmam8Y5TzptmvKY9TpvBcWgak/0k8S/AKRgfnErppjWnm2ABCRIPRTKbViyh hNViGvyJxCc/z65JvxJXmNx/DAlTp6keh/k2SvpQE9O3iJlF/zQ0eUECoXi+OPflQyMS GTJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738020152; x=1738624952; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3cL+TUH11/smaxLgrRBkwnVa/XBTlyU3EXvG7o/S9Vk=; b=rurS/ThJJaW4+APyJvlgdYrMw80jhcdLsPcqxCqo8loU2eAyrVatMMXCkRFHBRqRhj 3E+T9obhP7vX7QyF7uNfuR/2rEgjU14wo+7zl65uQueSkaE0Vgi7aIK3IfAUXfi9B5xh +zuCqG+znGjykzxGElg0h1aXMW+HAn2oXl47yfzKaP1h6rZhOVagw5Jvc5ryodrB4jIv Ip0doecsDVuojyZ65ASG4n/tVb4j2fWbZrt5y2HweIQx8PBM64MvufvvE9L+KGGOLg7U XLojXcdurL3rZWxnbRx58blvOzUbGGesj6fQ07eUXy0RmAeL3CORaiatT7QxC+Jvf52d lw1w== X-Forwarded-Encrypted: i=1; AJvYcCU+5xrtJCofgxzrKDmDes27qORFcw8RbVLt0ld8McRlDylRfx78TspxvoafLU2vq0LJvCcR9inOEPrYQ7w=@vger.kernel.org X-Gm-Message-State: AOJu0YwHwHIrzhF5IvzSVr/bFG8cvBcH7DCMKtU5gzgGus6zn4TRq1SN OzwVCMDpD4VX+76tY7RDhgLtp6GPPf46es3a8GdKBencXBrkuq81tck2dEi8DEV5sp5zFQ== X-Google-Smtp-Source: AGHT+IGgN6UDyZ6CnhbCZLqRUCN/vH+l2DkjmSnZAo2yRRKakYvM4vMlM8AITyVlOysWw5h6u6wtZxFn X-Received: from pfbbd41.prod.google.com ([2002:a05:6a00:27a9:b0:725:e05b:5150]) (user=fvdl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:21ca:b0:727:3fd5:b530 with SMTP id d2e1a72fcca58-72dafb36d75mr57071331b3a.15.1738020152104; Mon, 27 Jan 2025 15:22:32 -0800 (PST) Date: Mon, 27 Jan 2025 23:21:45 +0000 In-Reply-To: <20250127232207.3888640-1-fvdl@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250127232207.3888640-1-fvdl@google.com> X-Mailer: git-send-email 2.48.1.262.g85cc9f2d1e-goog Message-ID: <20250127232207.3888640-6-fvdl@google.com> Subject: [PATCH 05/27] mm/hugetlb: fix round-robin bootmem allocation From: Frank van der Linden To: akpm@linux-foundation.org, muchun.song@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: yuzhao@google.com, usama.arif@bytedance.com, joao.m.martins@oracle.com, roman.gushchin@linux.dev, Frank van der Linden , Zhenguo Yao Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit b5389086ad7b ("hugetlbfs: extend the definition of hugepages paramet= er to support node allocation") changed the NUMA_NO_NODE round-robin allocation behavior in case of a failure to allocate from one NUMA node. The code originally moved on to the next node to try again, but now it immediately breaks out of the loop. Restore the original behavior. Fixes: b5389086ad7b ("hugetlbfs: extend the definition of hugepages paramet= er to support node allocation") Cc: Zhenguo Yao Signed-off-by: Frank van der Linden --- mm/hugetlb.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index b187843e38fe..1441a3916b32 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3156,16 +3156,13 @@ int __alloc_bootmem_huge_page(struct hstate *h, int= nid) m =3D memblock_alloc_try_nid_raw( huge_page_size(h), huge_page_size(h), 0, MEMBLOCK_ALLOC_ACCESSIBLE, node); - /* - * Use the beginning of the huge page to store the - * huge_bootmem_page struct (until gather_bootmem - * puts them into the mem_map). - */ - if (!m) - return 0; - goto found; + if (m) + break; } =20 + if (!m) + return 0; + found: =20 /* @@ -3177,7 +3174,14 @@ int __alloc_bootmem_huge_page(struct hstate *h, int = nid) */ memblock_reserved_mark_noinit(virt_to_phys((void *)m + PAGE_SIZE), huge_page_size(h) - PAGE_SIZE); - /* Put them into a private list first because mem_map is not up yet */ + /* + * Use the beginning of the huge page to store the + * huge_bootmem_page struct (until gather_bootmem + * puts them into the mem_map). + * + * Put them into a private list first because mem_map + * is not up yet. + */ INIT_LIST_HEAD(&m->list); list_add(&m->list, &huge_boot_pages[node]); m->hstate =3D h; --=20 2.48.1.262.g85cc9f2d1e-goog