From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-211.mta0.migadu.com [91.218.175.211]) (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 48BE043C058 for ; Wed, 19 Aug 2026 11:30:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.211 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787139039; cv=none; b=eslfq9al8xJts+6q001nntOa1w/2hibMWvQm6/fjYlcFYQzRS78OeJRcRYhcM1M1wvO7sCBWS1s6S0WnVs8HIArx8DPjFJXLBctOE2igdS6NRdw/5NWtHmNKceHQ8C/1uNZx4yd2dlNAcqYjELdqaDEj/ekF+4t84vGKZdOx6W8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787139039; c=relaxed/simple; bh=GioUN9ZNUFOOY2+qA7NRpGccjxk2FMqoVqjsSWyQoz8=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Message-Id:References:To; b=TgjN79szs33cuhO0tFSWLcjY3aqBIuZKb2evpgCrm+DeFoQw847BXE36XuMm1tvWZU6Roiya2Sh0U7A8tqkH0rf9k2Btz/Q4O879BDLr7/ieH6UIJWe7w7thr3FWmXTIhZGZp7MDbMLU1FYhY3nTtY6tyjUzNvYNGeZDl803G+w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=DXE1Ay5m; arc=none smtp.client-ip=91.218.175.211 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="DXE1Ay5m" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=GioUN9ZNUFOOY2+qA7NRpGccjxk2FMqoVqjsSWyQoz8=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1787139034; v=1; x=1787743834; b=DXE1Ay5m1RT/7nBrQGBojVBFawQcROHxp4FIhaIp8CaZh4/McEHtilF8ugqdZmg1XwSPtRqM YbBysE+vRepq6BcSf/1/rBKaEuIcksqS3A8aRWGezt3FiFaWSJku2pGMBmQrh2ieX2jl2iD5IyY 3vNjHjJoI8Yx/Tmkf4BSxG3s= X-Envelope-To: linux-kernel@vger.kernel.org Received: from smtpclient.apple (2408:8606:1800:501::1:7) by mta10.migadu.com with ESMTPS id 2806ab966b61ca88; Wed, 19 Aug 2026 11:30:34 +0000 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset=us-ascii Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.600.51.1.1\)) Subject: Re: [PATCH v4 00/17] mm: Introduce section-based vmemmap optimization for HugeTLB From: Muchun Song In-Reply-To: <20260819095140.17252-1-songmuchun@bytedance.com> Date: Wed, 19 Aug 2026 19:30:15 +0800 Cc: Andrew Morton , Oscar Salvador , David Hildenbrand , Mike Rapoport , Vlastimil Babka , Lorenzo Stoakes , Michal Hocko , David Laight , "Liam R . Howlett" , Suren Baghdasaryan , linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20260819095140.17252-1-songmuchun@bytedance.com> To: Muchun Song X-Mailer: Apple Mail (2.3864.600.51.1.1) > On Aug 19, 2026, at 17:51, Muchun Song = wrote: >=20 > This series is split out from the earlier, larger series "mm: = Generalize > HVO for HugeTLB and device DAX" [1]. While the parent series = generalizes > vmemmap optimization across HugeTLB and device DAX, this subset = addresses > a single, self-contained step: making the generic sparse-vmemmap code > section-based optimization aware and switching HugeTLB bootmem pages = to > this path. >=20 > HugeTLB vmemmap optimization currently has its own early boot setup > path. It pre-populates optimized vmemmap mappings before the normal > sparse-vmemmap population code runs, and sparsemem carries > SPARSEMEM_VMEMMAP_PREINIT only to support that special case. >=20 > That makes the HugeTLB vmemmap optimization path harder to share with > other users of sparse-vmemmap optimization and leaves a fair amount of > HugeTLB-specific boot-time state in the generic memory initialization > flow. >=20 > This series introduces section-based vmemmap optimization support in > the sparse-vmemmap code and switches HugeTLB bootmem pages over to it. > Instead of having HugeTLB pre-populate optimized vmemmap mappings > itself, HugeTLB now records the compound page order in the = corresponding > memory sections. The generic sparse-vmemmap population path can then > allocate or reuse shared tail vmemmap pages based on section metadata. >=20 > The patches are organized as follows: >=20 > - patches 1-2 prepare sparsemem and vmemmap optimization metadata > - patches 3-8 teach the common sparse-vmemmap paths to use that state > - patches 9-10 switch HugeTLB bootmem optimization to the > section-based path > - patches 11-17 clean up sparsemem and HugeTLB bootmem code that is = no > longer needed after the conversion >=20 > This is intended to be the second smaller step toward the broader HVO > generalization. The device DAX conversion and the wider HVO > consolidation are left for follow-up series. I've confirmed that all the reports from Sashiko are false positives in this version, and they also appeared as duplicates in the previous one. Thanks. >=20 > v4: > - Rename pfn_vmemmap_optimizable() to vmemmap_optimizable_pfn() for > consistency with vmemmap_optimizable_order(). > - Move section_nr_vmemmap_pages() outside CONFIG_MEMORY_HOTPLUG to fix > CONFIG_MEMORY_HOTPLUG=3Dn builds (reported by kernel test robot). >=20 > v3: > - Replaced the !SPARSEMEM __pfn_to_section() stub with > pfn_to_section_order() so callers can keep mem_section access inside > sparse helpers (suggested by Mike Rapoport). > - Added vmemmap_optimizable_order() for order-based vmemmap > optimization checks and used it for HugeTLB bootmem decisions. > - Fixed the pfn_to_zone() commit message to name mm/mm_init.h instead > of mm/internal.h. > - Collected Acked-by tags from Mike Rapoport. >=20 > v2: > - Kept struct mem_section aligned after relaxing lookup constraints > (suggested by David Laight). > - Folded section order tracking into the first user instead of keeping > a standalone API-only patch (suggested by Mike Rapoport). > - Renamed the HVO order macros with a VMEMMAP_OPTIMIZATION prefix > (suggested by Mike Rapoport). > - Moved pfn_to_zone() before the sparse-vmemmap optimization changes > (suggested by Mike Rapoport). > - Kept vmemmap accounting and population logic in sparse-vmemmap.c > (suggested by Mike Rapoport). > - Renamed the early sparsemem helper to sparse_sections_init() > (suggested by Mike Rapoport). > - Fixed the !SPARSEMEM stub name so SPARSEMEM=3Dn builds compile > (reported by Sashiko). > - Guarded section_order() with CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP so > it returns 0 when HVO is disabled and lets the compiler optimize the > code as much as possible (suggested by Mike Rapoport). > - Collected Acked-by tags from Mike Rapoport. >=20 > [1] = https://lore.kernel.org/linux-mm/20260513130542.35604-1-songmuchun@bytedan= ce.com/ >=20 > Muchun Song (17): > mm/sparse: relax struct mem_section size constraints > mm/sparse-vmemmap: rename HVO order macros > mm/mm_init: skip initializing shared vmemmap tail pages > mm/sparse-vmemmap: initialize shared tail vmemmap pages on allocation > mm/sparse-vmemmap: support section-based vmemmap accounting > mm/mm_init: factor out pfn_to_zone() > mm/sparse-vmemmap: move vmemmap_get_tail() before PTE population > mm/sparse-vmemmap: support section-based vmemmap optimization > mm/sparse: initialize memory sections earlier > mm/hugetlb: switch HugeTLB to section-based vmemmap optimization > mm/sparse-vmemmap: remove SPARSEMEM_VMEMMAP_PREINIT support > mm/sparse: inline usemap allocation into sparse_init_nid() > mm/sparse: remove section_map_size() > mm/hugetlb: remove HUGE_BOOTMEM_HVO > mm/hugetlb: remove HUGE_BOOTMEM_CMA > mm/hugetlb: localize struct huge_bootmem_page > mm/hugetlb: localize HUGE_BOOTMEM_ZONES_VALID >=20 > arch/x86/Kconfig | 1 - > fs/Kconfig | 1 - > include/linux/hugetlb.h | 5 - > include/linux/mm.h | 4 - > include/linux/mmzone.h | 66 ++++-------- > mm/Kconfig | 5 - > mm/hugetlb.c | 64 ++++-------- > mm/hugetlb_vmemmap.c | 103 +------------------ > mm/hugetlb_vmemmap.h | 13 +-- > mm/internal.h | 7 -- > mm/mm_init.c | 63 +++++++----- > mm/mm_init.h | 1 + > mm/sparse-vmemmap.c | 216 ++++++++++++++++++---------------------- > mm/sparse.c | 94 ++++------------- > mm/sparse.h | 85 ++++++++++++++++ > scripts/gdb/linux/mm.py | 6 +- > 16 files changed, 285 insertions(+), 449 deletions(-) >=20 >=20 > base-commit: 5453bc3279e9f8578ac3e534d476240e40c879e1 > --=20 > 2.54.0 >=20