From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 B12293822B7 for ; Fri, 12 Jun 2026 03:59:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781236798; cv=none; b=YwnyNWzDbalaZ7FNr3u7tA/Rg2foTT2wC5s6Ewn194lYBj7pnx3YUoGFZgIDZ2Ed8GOGo7ERe9CYIsWFlHKkYGtxerL9dNCWjBY5LQlN8FmJu9zjtoSE1TtH/2es6ZEzBHAig4OUNxG4Kfx1H6aXvkKIONHJtMO3bauQqVvym3A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781236798; c=relaxed/simple; bh=pz6r/6TS9le/+uYMzOFtX0jXs/BcUBelx0xgO5BVuDo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XRn85+Q3I78Kc3yUaNYB1MowyuKy/Oz9GPk7QD0ijpchErt3YjdaPmC5cOI/KVS8iaTN5MBb8Z8v0bvCbqKcIuYDcVYv+kDfIcq765RUr1nkIrxNezYbiVSPfXaNwilz2qwA7QIIHaX8xLAgqkSO/5wAXjp7+JgghzhZHXfDcCk= 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=Vo3cCML8; arc=none smtp.client-ip=209.85.210.182 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="Vo3cCML8" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-84275887a3fso1129335b3a.1 for ; Thu, 11 Jun 2026 20:59:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1781236797; x=1781841597; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BR0a3ryVRFpnQOFzhfXrKrFPrgwx6VYHHIteJPCS1zU=; b=Vo3cCML811075YcULc2//hCqvCjoq3axqHnFKsCIlY38Y2CxFjQ9IokBnWYMGBoX03 uMtVMUC7QOpOdEvVmE1eWyIn0Suu4xla61QVkNHX7v5s9qeR1OjOUpZxidtHr5SdE7Qr 7xz4Z7wM06yxJr8lNWI6PpDXZII4d9r8BEC5TR7zRnCuc2FsncJYjdsbXELob1y2HugG elKr0xZzaJbjhvSznIlPLGLSVWGIwpf8WaH/UhIIYu2ulehJGzXsbM/grRrdUfp6HiEA SXHjFpTQEpJsjVc5gcP9pQ6YOR8f2QxycWeLrvhgJ83VhP0dcTNW432ek4XQox/eGM+j 97YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781236797; x=1781841597; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=BR0a3ryVRFpnQOFzhfXrKrFPrgwx6VYHHIteJPCS1zU=; b=qbBoETq2LWVQ0tHq8H3I7mj8RqmMuILQ96k+Ta9ldXAXY3uIMjuRPHC5q7ebVOezP7 15kTGn5bmRA5dvQvScl/AVzV9nNHvXdegPKX3wj9UqbTsC/fg44IOlOorR+5RHq3HAet VzFt/KmDI52/5FKOZbmK+hj7nrXw0o5/o/6fnPUlM1INbamlyXeRiY5DaUx2YrKaSck3 9s0ZmZoZlw2eZmZlBkoeWIr36vh48KneK14LWL1/jNVc2vNsK3T4wG93GveBI6Iyrd44 0how+jmW35X3rRdR4VjMg2kLRpPmV6IR1GDcV9YIIbEuw8sxYWJyiwalvnyczo4p9DJq 3Pcw== X-Forwarded-Encrypted: i=1; AFNElJ+zIuBg72IF0EM6K4vKQh9i9J0jXjT+YtJaN/pwr8Fjer0gGX+KDNSYliVorcNflMYJIPwq6JYlpqkMqEc=@vger.kernel.org X-Gm-Message-State: AOJu0YwizcUltpYDbTYypxOFuq7vZb1tSlibFTTaOtz5kNo7eTJm2J/N lVy19O77m4P0jxnsVFHoy56jnUW+eIf8gE+JVSFpL0tiZoGumlmHdGahqoQug9Gau18= X-Gm-Gg: Acq92OEuisJKGEJtmkET/NIG9x4OwDkoHGPPe56Y9tOFRBQHaUcbz4pAdSe2NXpEPo7 rZBfzl3/xCSmOtYyjAcFaNyrugNhi8PcBr6T9W8kOr0b383jCrVAO2JzrCrx2r5lyPDiI47eRGd 9ecxIkwvYTKJOjICyCetY5Q+jb4ZNJbEPTN12ZpIy+2u7GIzHMK0J5GXEiIh7yZiSRpe6h7VCrO WFaetI/b2HzgdohEY1PLNo3WRDX0VouoDea19JEb6eKMTJny5CFklqhsSsYUMGaSJuhgLGPKQTv cc2JAbMpv2YIVgNp3AinOLINLq2UiJdbnhLedGJThy+CO1JU2EG9WjyyQFXccMMm8pqnL3xD50U WXXi43GIKaYO40113Ed3Rkth3Xp7aR24chcXhXkDn3tEyZ4pia18ZgATCWzKh7em33AojZOgRX6 VzqMU2Rcqrl6wK/oD7dpCe7z3ewGg0WhVFIO4n4dIskyw= X-Received: by 2002:a05:6a00:3e20:b0:81f:5acb:55fc with SMTP id d2e1a72fcca58-8434ceb5bfbmr869958b3a.10.1781236796968; Thu, 11 Jun 2026 20:59:56 -0700 (PDT) Received: from n232-176-004.byted.org ([36.110.163.99]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8434ad03fdcsm643352b3a.24.2026.06.11.20.59.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jun 2026 20:59:56 -0700 (PDT) From: Muchun Song To: Oscar Salvador , David Hildenbrand , Andrew Morton , Madhavan Srinivasan , Michael Ellerman Cc: Muchun Song , Mike Rapoport , Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Nicholas Piggin , Christophe Leroy , Ritesh Harjani , "Aneesh Kumar K . V" , linuxppc-dev@lists.ozlabs.org, Mike Kravetz , Muchun Song , "Oscar Salvador (SUSE)" Subject: [PATCH v4 09/19] mm/mm_init: Defer hugetlb reservation until after zone initialization Date: Fri, 12 Jun 2026 11:58:53 +0800 Message-ID: <20260612035903.2468601-10-songmuchun@bytedance.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260612035903.2468601-1-songmuchun@bytedance.com> References: <20260612035903.2468601-1-songmuchun@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit hugetlb_cma_reserve() and hugetlb_bootmem_alloc() currently run before free_area_init(), so HugeTLB reservation happens before zone state is initialized. Move the reservation step after free_area_init() so the relevant zone information is available before HugeTLB reserves memory. This is needed for later hugetlb changes that validate boot-time HugeTLB reservations against zone boundaries. Signed-off-by: Muchun Song Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Oscar Salvador (SUSE) --- mm/mm_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index bdeaceadb531..ccf494fa7586 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -2676,11 +2676,11 @@ void __init mm_core_init_early(void) { int nid; + free_area_init(); + hugetlb_cma_reserve(); hugetlb_bootmem_alloc(); - free_area_init(); - sparse_init(); for_each_node_state(nid, N_MEMORY) sparse_vmemmap_init_nid_late(nid); -- 2.54.0