From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 65B2D34C826 for ; Wed, 15 Apr 2026 11:14:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776251663; cv=none; b=c6H6OVpDCe0IMrbPJj+pE3+xT0SpC2nPklNwFDE7aDG5NXT+HgjAD9ezdWkAcRAoIVgKo3r8ujfRDQtKjHANspjge6/dr7NYALU4Ttac1KfVPyYssZR3K5Vi6Fhr/qyf8g4PZIzJV9uIBGNc9+WvHcTPg2d8I9sbXm0EIHJX3F8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776251663; c=relaxed/simple; bh=HANIfPqjbxezU0P2xGEIaQMU94H9miDKAVfiRjcQR64=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=o/gQ2d51C6PintuOvA02vF4qKXDZ8o50sPuLNLwXqgGBMjnPnGUWzMniXiLvQKLOScFu6Ke5f8I91oRn9h6gPxvDNa3V9Yzwy+WfB3yJzjAgjuXLUrpCsL4PVsEO5Z+ozV2mI5Wj4r9PCIw9Eieg/zDRjucNHW3Di5/qC8dtpwo= 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=CFPh+3f5; arc=none smtp.client-ip=209.85.214.170 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="CFPh+3f5" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2a7a9b8ed69so50753125ad.2 for ; Wed, 15 Apr 2026 04:14:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1776251661; x=1776856461; 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=Hg37UlEcW10cmklaT0P772ahobtvEU06guOHNmMT8sw=; b=CFPh+3f53oRLf0GrnjuZAUubb3jJUpIjU5h2SyLcNEerSlY7WhT/sYVFTl+XcXRCYA yBQWYTSKcypdyT2GaBTgSlipKc76Ji3m88RKBWL8eFzCNTprYSptF1tW2GeP+cOyfYyu GbK6WKHIKQRfihnXP5/lIp+AEqeoN0wtpuOBruy4R9I+VYWvRGFaoVnUkq3YVpf3vnNf qEAhIRAR8OnuwzCOpI+WBR3x/lmiK0pSbllmZDtuGUBlroMHHfoPvgGt50oqzA0QLd9R kWi2KRpNzS8Eu6y3LQMbNlxyncG2UWwMelPl3TZ+iGyhLptPQLFwNjs/6KEUxaLRf4+7 wRwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776251661; x=1776856461; 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=Hg37UlEcW10cmklaT0P772ahobtvEU06guOHNmMT8sw=; b=cW4ckSlCtctgDvkM0uAD5bM993kQoIFsis8OXoOVdeTfMcF6vqLhVXdy0UQ4O6JIHD xT+g7yA+4QFQnZrOIjD6OIcVVfoK/e8QMUf12XjlNhie96bop3z7MXCyySrVncJsKhl6 MjM0IYdGlVsQ5+TTSra4IPnKN+Y+kMfNqNUEHOxZCnxBIlUt+hd9GyeLnl5JmJxxPyuU Haocm0WOYgFvv1aFrYy3KTtdSXicgYY5EWWSrexqO+5yL7s97pAULNVp781izWCpk7NE kaYX6OSSPHOeebJeePXK2DwrzndjuvKmCcexS0WjPm5huHPzEUJ0PGXmBz0aR9ezn+lK p3nw== X-Forwarded-Encrypted: i=1; AFNElJ/8vR2P9w54GOyskAkeyU+a/pI1/z3lyIzlHWrAvcshYfYkZTQW6UI3+/5nZuyULN5PaKae9/Mdb+hkpto=@vger.kernel.org X-Gm-Message-State: AOJu0Yy7E1rBCzDgk2yzcLrW8PV5aswe0z8QTeQem9One/s0Ei4sm2k4 2QKy3UfDTls1HNgXWn/sGHltFNEW29nrjkiPjAsZVAvwW2X8ox7H7eTUH0FhX5vlzfc= X-Gm-Gg: AeBDievSlTpVaGwnLxxG+CEh3F5ScLoFvFYKzL/gXbt4r07qBmyGiphB4Tm4NbmJ3zz XvPKfQAL8OXIeFZaGzO6a9JGsI7C8uX0CnKI8Cd3addHrkivOAYPQAuntqDo36kPG32SzU8SE9V EQJaDK2QGBI6VlSlyT+V+9LjVq/7onvA6eP+khTx+RNPcadfwc+VewZAbkofL64WaVXcsTKaBrU ypJ4Wr+8R097zIHzk7w0vGaSynnKdHV7+9o/5mDabc4dUie1Bm2YOxZ37keZxNNFbIsKXbAR3Ml 8QY+A0DC5U4eGIsZ2ONRmHV5kPclqDzIP/EIPwhkGRfossBj6ps/7L3aaFnXF5KqvcqRLoz+Xdw WAP4W32msYHSONEEGIAkh0zEAopYmDKLwQ3IHJpsHbrLsJ3IF2A1UiWQ2hkLrWRvw0WSrUJ6B1T EecmB1TXXtr3b0o8iZ4oBAAftnau9M/oFfdc5gTEe4KUc= X-Received: by 2002:a17:903:5cd:b0:2b2:42f8:1a45 with SMTP id d9443c01a7336-2b2d5a8ebc5mr145530325ad.39.1776251660541; Wed, 15 Apr 2026 04:14:20 -0700 (PDT) Received: from n232-176-004.byted.org ([36.110.163.96]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b477fd3724sm19509485ad.0.2026.04.15.04.14.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Apr 2026 04:14:19 -0700 (PDT) From: Muchun Song To: Andrew Morton , David Hildenbrand , Muchun Song , Oscar Salvador , Michael Ellerman , Madhavan Srinivasan Cc: Lorenzo Stoakes , "Liam R . Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Nicholas Piggin , Christophe Leroy , aneesh.kumar@linux.ibm.com, joao.m.martins@oracle.com, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Muchun Song Subject: [PATCH v2 0/6] mm: Fix vmemmap optimization accounting and initialization Date: Wed, 15 Apr 2026 19:14:06 +0800 Message-Id: <20260415111412.1003526-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.20.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patch series fixes a number of issues related to vmemmap optimization for compound pages (e.g., DAX), including incorrect page accounting and missing architecture-specific initialization steps. The series addresses these issues through the following steps: - Patch 1: Fixes a vmemmap accounting underflow in error paths. - Patch 2-3: Fixes DAX vmemmap accounting by plumbing the pgmap argument through memory deactivation paths. - Patch 4-5: Fixes missing architecture-specific page table syncs by plumbing the pgmap argument through vmemmap_populate APIs. - Patch 6: Fixes pageblock migratetype initialization for large compound ZONE_DEVICE pages. Changelog: v1 -> v2: - Moved vmemmap accounting to populate_section_memmap() / depopulate_section_memmap() to fix accounting underflow, suggested by Mike. - Replaced VM_BUG_ON with VM_WARN_ON_ONCE as requested by David. - Reduced frequency of calling cond_resched() in pageblock_migratetype_init_range() based on feedback from David and Mike. - Extracted all bugfix patches from a larger patchset (https://lore.kernel.org/linux-mm/20260405125240.2558577-1-songmuchun@bytedance.com/) into this separate patchset, suggested by David. Muchun Song (6): mm/sparse-vmemmap: Fix vmemmap accounting underflow mm/sparse-vmemmap: Pass @pgmap argument to memory deactivation paths mm/sparse-vmemmap: Fix DAX vmemmap accounting with optimization mm/sparse-vmemmap: Pass @pgmap argument to arch vmemmap_populate() mm/sparse-vmemmap: Fix missing architecture-specific page table sync mm/mm_init: Fix pageblock migratetype for ZONE_DEVICE compound pages arch/arm64/mm/mmu.c | 11 +-- arch/loongarch/mm/init.c | 12 +-- arch/powerpc/include/asm/book3s/64/radix.h | 9 +-- arch/powerpc/mm/book3s64/radix_pgtable.c | 18 +++-- arch/powerpc/mm/init_64.c | 4 +- arch/powerpc/mm/mem.c | 5 +- arch/riscv/mm/init.c | 9 ++- arch/s390/mm/init.c | 5 +- arch/s390/mm/vmem.c | 2 +- arch/sparc/mm/init_64.c | 5 +- arch/x86/mm/init_64.c | 13 +-- include/linux/memory_hotplug.h | 8 +- include/linux/mm.h | 8 +- mm/hugetlb_vmemmap.c | 4 +- mm/memory_hotplug.c | 12 +-- mm/memremap.c | 4 +- mm/mm_init.c | 42 ++++++---- mm/sparse-vmemmap.c | 93 ++++++++++++++-------- 18 files changed, 160 insertions(+), 104 deletions(-) -- 2.20.1