From nobody Sat Jun 13 02:07:58 2026 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) (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 671A0374E7F for ; Mon, 11 May 2026 12:19:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778501946; cv=none; b=nkUDZCPh+sSUv9o+9hAt00VcqVHhZmUqbaQv5v0hVyKnKE5J+9ttEMubT9jVPbiKpQNtn+T03NgznugP/zuB8Ni0EINURbOMfPfdLGNFCoJQTDv1/HIgl2/PaPCqF0rfADnSShw8c9iZlAJJA/zfv4Vv/b/c2CE8IDX+szoKnJs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778501946; c=relaxed/simple; bh=3Sc2b+T9BBbcbR4EJMpe6T+JwDYN6djy3IZd6a7UqcU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nktLVdMiuGpekRY3rmpd+4kXuLM4iPAoU0jEnni1+dTQWmOZoIACXqm+5sVyDBSMXH0ALbLWtJorco5KjxO3AdZjLe59k81HKiBihxt2C9DceZpXGx0Oa3gFWWO4vVPiPlDi7fFVbM8zG4tjyZQyZqHrrUrvlhbELdz1vnPVL/0= 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=eqOA6S3/; arc=none smtp.client-ip=209.85.210.174 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="eqOA6S3/" Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-836ed29d1e5so1756488b3a.2 for ; Mon, 11 May 2026 05:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1778501941; x=1779106741; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8VpdnAcDyhUYZYtnluIlIHv/XtX78c/3y5QdZxX0T5M=; b=eqOA6S3/O5Q2/xDFCtVVEd15fuCc/MIHDakhMNni+kgI2+cc4vY8zHf+r2twddB8mN t/+ZG/IKmGuy9KuCilVQsU1+Hz0Dnc9WcN/OKdJKCPGPoGebv8G59B5Jsiiwqmpo8RvS fYfr4jUNV/xttmJdTQjaIKLALqAS9nUitzsc8U/qEcai7QoXaurqbQQagnX0kZvv4Blh Y8GYHOri3AliBxAki30p68YBnhaUeF8Tay9OCliEGG7SJLtb6UHeDYyj+LLwzbW06eGK pQnxdO1cpioZL0vDtrzNJhmhRz0L5FEqasqCnPWmMejiThIY/4WSQV8IG879rtEzB/7U 4v1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778501941; x=1779106741; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8VpdnAcDyhUYZYtnluIlIHv/XtX78c/3y5QdZxX0T5M=; b=i+zzHG3KM5kYPsjzQBJZM5usovJtRJlfPNqKhSlgISNEHBVPBfMlQlHtAnSfm4aBIn oIWadgi/xhqSg1wrAp8hF16LZxVFVtnKTd6EJWHsbfmlQP3UmDjF/5AeFitbtz6EMFGG ZzEHmhXx2C8htA4qt19e6OANjbWNu5/VmpnCsIZMjmeFETDWKWaIXxjjSmolccMnlxot sXCdIXhaszvK8el45eKVK5Ihsqnef3UIq3QB+XIazApBPpv0NQTJ6jfk0JPckIOaEr4z IKrb5CjcgkFFjX9FXFO6Sk9NFDtHjz4+HvaHA8MIA9lUwZOBA/EOluaPmcXFhJ2wBwd3 /27Q== X-Gm-Message-State: AOJu0Yymmjd1uUzckEXHpBinOgdSLi7nTr39iI7Mxg3AuCT6xfJrXMep cfMnVMyDCDmGl4XiXKv2K1hJjXPGS2usShk1/ojBU0rb3M1WkVj0ur2KGBOnXa8/mLM= X-Gm-Gg: Acq92OFeQlCERxAAFN1DHCWfdsrVmb4csNtcSzyrtnYDgJIRsyvhS1QeQZ4TK2ClCB0 eu58eCrhTNxy/G7TKtwnHVqmawYBS0GKSc3bwFJrl6si38lPxPDO22mHITcFy+s068bf0y6cghM jY4v5gs7gy0nwyNyjGUBUFkFQAERuTeDvtr3wBw+F9BPQ2hrN3EI8WgpLLLu2QvOYD7hDm+03qF /XWS0STy1SVRqYMRj+as9c1xLgfyTqCzEZ7YYwtPNs7uKAIDB+qTS0s4A/TmBMbBpQAosUNunCo VJXGVktCIk1YKx7g/YT73psO4XB5bq/v7EcPyOorDcQSjv+wEQUlqJ9lLuYIitNdT7zV3NcPiWA zo+PxN7ls/rsPuLLyXJvmZAil/Ng7nnb+kCvdWIDRFdsPO0Atev2NCYw13ePAQpI0wx6K8ugzBU nA80vKsdc4eDRVA8PY4g== X-Received: by 2002:a05:6a00:2d84:b0:837:a211:4ee2 with SMTP id d2e1a72fcca58-83a5e138879mr23565245b3a.38.1778501941401; Mon, 11 May 2026 05:19:01 -0700 (PDT) Received: from n232-176-004.byted.org ([240e:83:200::348]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8396563f127sm20567293b3a.5.2026.05.11.05.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 May 2026 05:19:00 -0700 (PDT) From: Muchun Song To: dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com Cc: linux-kernel@vger.kernel.org, Muchun Song , muchun.song@linux.dev Subject: [PATCH] x86/mm: Remove sync_global_pgds() from vmemmap_populate() Date: Mon, 11 May 2026 20:18:32 +0800 Message-ID: <20260511121832.2321221-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.54.0 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 Content-Type: text/plain; charset="utf-8" Commit f2d2f9598ebb ("mm: introduce and use {pgd,p4d}_populate_kernel()") made kernel top-level page table synchronization part of the generic pgd_populate_kernel() and p4d_populate_kernel() helpers. Since vmemmap page table population now goes through these helpers, the extra sync_global_pgds() in vmemmap_populate() is redundant. Remove it to simplify the code and reduce the sync overhead. Signed-off-by: Muchun Song --- arch/x86/mm/init_64.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 77b889b71cf3..5b9d7e88f066 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1559,24 +1559,20 @@ int __meminit vmemmap_check_pmd(pmd_t *pmd, int nod= e, int __meminit vmemmap_populate(unsigned long start, unsigned long end, int= node, struct vmem_altmap *altmap) { - int err; - VM_BUG_ON(!PAGE_ALIGNED(start)); VM_BUG_ON(!PAGE_ALIGNED(end)); =20 if (end - start < PAGES_PER_SECTION * sizeof(struct page)) - err =3D vmemmap_populate_basepages(start, end, node, NULL); - else if (boot_cpu_has(X86_FEATURE_PSE)) - err =3D vmemmap_populate_hugepages(start, end, node, altmap); - else if (altmap) { + return vmemmap_populate_basepages(start, end, node, NULL); + if (boot_cpu_has(X86_FEATURE_PSE)) + return vmemmap_populate_hugepages(start, end, node, altmap); + if (altmap) { pr_err_once("%s: no cpu support for altmap allocations\n", __func__); - err =3D -ENOMEM; - } else - err =3D vmemmap_populate_basepages(start, end, node, NULL); - if (!err) - sync_global_pgds(start, end - 1); - return err; + return -ENOMEM; + } + + return vmemmap_populate_basepages(start, end, node, NULL); } =20 #ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE base-commit: e98d21c170b01ddef366f023bbfcf6b31509fa83 --=20 2.54.0